From d7fdd5003034de745492ab1ffe88455f7e49c58f Mon Sep 17 00:00:00 2001 From: Sunli Date: Fri, 19 Nov 2021 08:10:08 +0800 Subject: [PATCH 001/102] Add tide examples --- Cargo.toml | 5 + README.md | 4 +- tide/dataloader-postgres/Cargo.toml | 18 +++ tide/dataloader-postgres/src/main.rs | 189 +++++++++++++++++++++++++++ tide/dataloader/Cargo.toml | 18 +++ tide/dataloader/src/main.rs | 187 ++++++++++++++++++++++++++ tide/starwars/Cargo.toml | 16 +++ tide/starwars/src/main.rs | 96 ++++++++++++++ tide/subscription/Cargo.toml | 12 ++ tide/subscription/src/main.rs | 48 +++++++ 10 files changed, 592 insertions(+), 1 deletion(-) create mode 100644 tide/dataloader-postgres/Cargo.toml create mode 100644 tide/dataloader-postgres/src/main.rs create mode 100644 tide/dataloader/Cargo.toml create mode 100644 tide/dataloader/src/main.rs create mode 100644 tide/starwars/Cargo.toml create mode 100644 tide/starwars/src/main.rs create mode 100644 tide/subscription/Cargo.toml create mode 100644 tide/subscription/src/main.rs diff --git a/Cargo.toml b/Cargo.toml index 6c56054..febc8c6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,4 +28,9 @@ members = [ "axum/starwars", "axum/subscription", + + "tide/starwars", + "tide/dataloader", + "tide/dataloader-postgres", + "tide/subscription", ] diff --git a/README.md b/README.md index b95b8c0..dd71a2b 100644 --- a/README.md +++ b/README.md @@ -5,5 +5,7 @@ - [poem] Examples for `poem` - [actix-web] Examples for `actix-web` - [warp] Examples for `warp` -- [federation] Examples for `Federation` - [tide] Examples for `tide` +- [rocket] Examples for `rocket` +- [axum] Examples for `axum` +- [federation] Examples for `Federation` diff --git a/tide/dataloader-postgres/Cargo.toml b/tide/dataloader-postgres/Cargo.toml new file mode 100644 index 0000000..e4881ee --- /dev/null +++ b/tide/dataloader-postgres/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "dataloader-postgres" +version = "0.1.0" +authors = ["ejez "] +edition = "2018" + +[dependencies] +async-graphql = { path = "../../..", features = ["dataloader"] } +async-graphql-tide = { path = "../../../integrations/tide" } +async-std = "1.9.0" +async-trait = "0.1.42" +itertools = "0.10.0" +sqlx = { version = "0.5.5", features = ["runtime-async-std-rustls", "postgres"] } +tide = "0.16.0" + +[dev-dependencies] +serde_json = "1.0.61" +surf = "2.1.0" diff --git a/tide/dataloader-postgres/src/main.rs b/tide/dataloader-postgres/src/main.rs new file mode 100644 index 0000000..ed8d500 --- /dev/null +++ b/tide/dataloader-postgres/src/main.rs @@ -0,0 +1,189 @@ +use async_graphql::dataloader::{DataLoader, Loader}; +use async_graphql::futures_util::TryStreamExt; +use async_graphql::http::{playground_source, GraphQLPlaygroundConfig}; +use async_graphql::{ + Context, EmptyMutation, EmptySubscription, FieldError, Object, Result, Schema, SimpleObject, +}; +use async_std::task; +use async_trait::async_trait; +use itertools::Itertools; +use sqlx::{Pool, Postgres}; +use std::collections::HashMap; +use std::env; +use tide::{http::mime, Body, Response, StatusCode}; + +#[derive(sqlx::FromRow, Clone, SimpleObject)] +pub struct Book { + id: i32, + name: String, + author: String, +} + +pub struct BookLoader(Pool); + +impl BookLoader { + fn new(postgres_pool: Pool) -> Self { + Self(postgres_pool) + } +} + +#[async_trait] +impl Loader for BookLoader { + type Value = Book; + type Error = FieldError; + + async fn load(&self, keys: &[i32]) -> Result, Self::Error> { + println!("load book by batch {:?}", keys); + + if keys.contains(&9) { + return Err("MOCK DBError".into()); + } + + let query = format!( + "SELECT id, name, author FROM books WHERE id IN ({})", + keys.iter().join(",") + ); + Ok(sqlx::query_as(&query) + .fetch(&self.0) + .map_ok(|book: Book| (book.id, book)) + .try_collect() + .await?) + } +} + +struct QueryRoot; + +#[Object] +impl QueryRoot { + async fn book(&self, ctx: &Context<'_>, id: i32) -> Result> { + println!("pre load book by id {:?}", id); + Ok(ctx + .data_unchecked::>() + .load_one(id) + .await?) + } +} + +#[derive(Clone)] +struct AppState { + schema: Schema, +} + +fn main() -> Result<()> { + task::block_on(run()) +} + +async fn run() -> Result<()> { + let postgres_pool: Pool = Pool::connect(&env::var("DATABASE_URL")?).await?; + + sqlx::query( + r#" + CREATE TABLE IF NOT EXISTS books ( + id INTEGER PRIMARY KEY NOT NULL, + name TEXT NOT NULL, + author TEXT NOT NULL + ); + "#, + ) + .execute(&postgres_pool) + .await?; + + sqlx::query( + r#" + INSERT INTO books (id, name, author) + VALUES (1, 'name1', 'author1'), (2, 'name2', 'author2'), (3, 'name3', 'author3') + ON CONFLICT (id) DO NOTHING + ; + "#, + ) + .execute(&postgres_pool) + .await?; + + let schema = Schema::build(QueryRoot, EmptyMutation, EmptySubscription) + .data(DataLoader::new(BookLoader::new(postgres_pool))) + .finish(); + + let mut app = tide::new(); + + app.at("/graphql").post(async_graphql_tide::graphql(schema)); + app.at("/").get(|_| async move { + let mut resp = Response::new(StatusCode::Ok); + resp.set_body(Body::from_string(playground_source( + GraphQLPlaygroundConfig::new("/graphql"), + ))); + resp.set_content_type(mime::HTML); + Ok(resp) + }); + + println!("Playground: http://127.0.0.1:8000"); + app.listen("127.0.0.1:8000").await?; + + Ok(()) +} + +#[cfg(test)] +mod tests { + use super::*; + use async_std::prelude::*; + use serde_json::{json, Value}; + use std::time::Duration; + + #[test] + fn sample() -> Result<()> { + task::block_on(async { + let server: task::JoinHandle> = task::spawn(async move { + run().await?; + Ok(()) + }); + + let client: task::JoinHandle> = task::spawn(async move { + task::sleep(Duration::from_millis(1000)).await; + + // + let string = surf::post("http://127.0.0.1:8000/graphql") + .body( + Body::from(r#"{"query":"{ book1: book(id: 1) {id, name, author} book2: book(id: 2) {id, name, author} book3: book(id: 3) {id, name, author} book4: book(id: 4) {id, name, author} }"}"#), + ) + .header("Content-Type", "application/json") + .recv_string() + .await?; + println!("{}", string); + + let v: Value = serde_json::from_str(&string)?; + assert_eq!( + v["data"]["book1"], + json!({"id": 1, "name": "name1", "author": "author1"}) + ); + assert_eq!( + v["data"]["book2"], + json!({"id": 2, "name": "name2", "author": "author2"}) + ); + assert_eq!( + v["data"]["book3"], + json!({"id": 3, "name": "name3", "author": "author3"}) + ); + assert_eq!(v["data"]["book4"], json!(null)); + + // + let string = surf::post( "http://127.0.0.1:8000/graphql") + .body( + Body::from(r#"{"query":"{ book1: book(id: 1) {id, name, author} book4: book(id: 4) {id, name, author} book9: book(id: 9) {id, name, author} }"}"#), + ) + .header("Content-Type", "application/json") + .recv_string() + .await?; + println!("{}", string); + + let v: Value = serde_json::from_str(&string)?; + let error = v["errors"].as_array().unwrap()[0].clone(); + assert_eq!(error["message"], json!("MOCK DBError")); + + Ok(()) + }); + + server.race(client).await?; + + Ok(()) + }) + } +} diff --git a/tide/dataloader/Cargo.toml b/tide/dataloader/Cargo.toml new file mode 100644 index 0000000..ec7da1d --- /dev/null +++ b/tide/dataloader/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "tide-dataloader" +version = "0.1.1" +authors = ["vkill "] +edition = "2018" + +[dependencies] +async-graphql = { path = "../../..", features = ["dataloader"] } +async-graphql-tide = { path = "../../../integrations/tide" } +tide = "0.16" +async-std = "1.9.0" +sqlx = { version = "0.5.5", features = ["sqlite", "runtime-async-std-rustls"] } +async-trait = "0.1.30" +itertools = "0.9.0" + +[dev-dependencies] +serde_json = "1.0.51" +surf = "2.0.0-alpha.1" diff --git a/tide/dataloader/src/main.rs b/tide/dataloader/src/main.rs new file mode 100644 index 0000000..56f086c --- /dev/null +++ b/tide/dataloader/src/main.rs @@ -0,0 +1,187 @@ +use async_graphql::dataloader::{DataLoader, Loader}; +use async_graphql::futures_util::TryStreamExt; +use async_graphql::http::{playground_source, GraphQLPlaygroundConfig}; +use async_graphql::{ + Context, EmptyMutation, EmptySubscription, FieldError, Object, Result, Schema, SimpleObject, +}; +use async_std::task; +use async_trait::async_trait; +use itertools::Itertools; +use sqlx::{Pool, Sqlite}; +use std::collections::HashMap; +use tide::{http::mime, Body, Response, StatusCode}; + +#[derive(sqlx::FromRow, Clone, SimpleObject)] +pub struct Book { + id: i32, + name: String, + author: String, +} + +pub struct BookLoader(Pool); + +impl BookLoader { + fn new(sqlite_pool: Pool) -> Self { + Self(sqlite_pool) + } +} + +#[async_trait] +impl Loader for BookLoader { + type Value = Book; + type Error = FieldError; + + async fn load(&self, keys: &[i32]) -> Result, Self::Error> { + println!("load book by batch {:?}", keys); + + if keys.contains(&9) { + return Err("MOCK DBError".into()); + } + + let query = format!( + "SELECT id, name, author FROM books WHERE id IN ({})", + keys.iter().join(",") + ); + Ok(sqlx::query_as(&query) + .fetch(&self.0) + .map_ok(|book: Book| (book.id, book)) + .try_collect() + .await?) + } +} + +struct QueryRoot; + +#[Object] +impl QueryRoot { + async fn book(&self, ctx: &Context<'_>, id: i32) -> Result> { + println!("pre load book by id {:?}", id); + Ok(ctx + .data_unchecked::>() + .load_one(id) + .await?) + } +} + +#[derive(Clone)] +struct AppState { + schema: Schema, +} + +fn main() -> Result<()> { + task::block_on(run()) +} + +async fn run() -> Result<()> { + let sqlite_pool: Pool = Pool::connect("sqlite::memory:").await?; + + sqlx::query( + r#" + CREATE TABLE IF NOT EXISTS books ( + id INTEGER PRIMARY KEY NOT NULL, + name TEXT NOT NULL, + author TEXT NOT NULL + ); + "#, + ) + .execute(&sqlite_pool) + .await?; + + sqlx::query( + r#" + INSERT OR IGNORE INTO books (id, name, author) + VALUES (1, 'name1', 'author1'), (2, 'name2', 'author2'), (3, 'name3', 'author3') + ; + "#, + ) + .execute(&sqlite_pool) + .await?; + + let schema = Schema::build(QueryRoot, EmptyMutation, EmptySubscription) + .data(DataLoader::new(BookLoader::new(sqlite_pool))) + .finish(); + + let mut app = tide::new(); + + app.at("/graphql").post(async_graphql_tide::graphql(schema)); + app.at("/").get(|_| async move { + let mut resp = Response::new(StatusCode::Ok); + resp.set_body(Body::from_string(playground_source( + GraphQLPlaygroundConfig::new("/graphql"), + ))); + resp.set_content_type(mime::HTML); + Ok(resp) + }); + + println!("Playground: http://127.0.0.1:8000"); + app.listen("127.0.0.1:8000").await?; + + Ok(()) +} + +#[cfg(test)] +mod tests { + use super::*; + use async_std::prelude::*; + use serde_json::{json, Value}; + use std::time::Duration; + + #[test] + fn sample() -> Result<()> { + task::block_on(async { + let server: task::JoinHandle> = task::spawn(async move { + run().await?; + Ok(()) + }); + + let client: task::JoinHandle> = task::spawn(async move { + task::sleep(Duration::from_millis(1000)).await; + + // + let string = surf::post("http://127.0.0.1:8000/graphql") + .body( + Body::from(r#"{"query":"{ book1: book(id: 1) {id, name, author} book2: book(id: 2) {id, name, author} book3: book(id: 3) {id, name, author} book4: book(id: 4) {id, name, author} }"}"#), + ) + .header("Content-Type", "application/json") + .recv_string() + .await?; + println!("{}", string); + + let v: Value = serde_json::from_str(&string)?; + assert_eq!( + v["data"]["book1"], + json!({"id": 1, "name": "name1", "author": "author1"}) + ); + assert_eq!( + v["data"]["book2"], + json!({"id": 2, "name": "name2", "author": "author2"}) + ); + assert_eq!( + v["data"]["book3"], + json!({"id": 3, "name": "name3", "author": "author3"}) + ); + assert_eq!(v["data"]["book4"], json!(null)); + + // + let string = surf::post( "http://127.0.0.1:8000/graphql") + .body( + Body::from(r#"{"query":"{ book1: book(id: 1) {id, name, author} book4: book(id: 4) {id, name, author} book9: book(id: 9) {id, name, author} }"}"#), + ) + .header("Content-Type", "application/json") + .recv_string() + .await?; + println!("{}", string); + + let v: Value = serde_json::from_str(&string)?; + let error = v["errors"].as_array().unwrap()[0].clone(); + assert_eq!(error["message"], json!("MOCK DBError")); + + Ok(()) + }); + + server.race(client).await?; + + Ok(()) + }) + } +} diff --git a/tide/starwars/Cargo.toml b/tide/starwars/Cargo.toml new file mode 100644 index 0000000..3dd2845 --- /dev/null +++ b/tide/starwars/Cargo.toml @@ -0,0 +1,16 @@ +[package] +name = "tide-starwars" +version = "0.1.1" +authors = ["vkill "] +edition = "2018" + +[dependencies] +async-graphql = { path = "../../.." } +async-graphql-tide = { path = "../../../integrations/tide" } +tide = "0.16" +async-std = "1.9.0" +starwars = { path = "../../models/starwars" } + +[dev-dependencies] +serde_json = "1.0.51" +surf = "2.0.0-alpha.5" diff --git a/tide/starwars/src/main.rs b/tide/starwars/src/main.rs new file mode 100644 index 0000000..198b8c1 --- /dev/null +++ b/tide/starwars/src/main.rs @@ -0,0 +1,96 @@ +use async_graphql::http::{playground_source, GraphQLPlaygroundConfig}; +use async_graphql::{EmptyMutation, EmptySubscription, Schema}; +use async_std::task; +use starwars::{QueryRoot, StarWars}; +use std::env; +use tide::{http::mime, Body, Response, StatusCode}; +type Result = std::result::Result>; + +#[derive(Clone)] +struct AppState { + schema: Schema, +} + +fn main() -> Result<()> { + task::block_on(run()) +} + +async fn run() -> Result<()> { + let listen_addr = env::var("LISTEN_ADDR").unwrap_or_else(|_| "localhost:8000".to_owned()); + + let schema = Schema::build(QueryRoot, EmptyMutation, EmptySubscription) + .data(StarWars::new()) + .finish(); + + println!("Playground: http://{}", listen_addr); + + let mut app = tide::new(); + + app.at("/graphql").post(async_graphql_tide::graphql(schema)); + + app.at("/").get(|_| async move { + let mut resp = Response::new(StatusCode::Ok); + resp.set_body(Body::from_string(playground_source( + GraphQLPlaygroundConfig::new("/graphql"), + ))); + resp.set_content_type(mime::HTML); + Ok(resp) + }); + + app.listen(listen_addr).await?; + + Ok(()) +} + +#[cfg(test)] +mod tests { + use super::*; + use async_std::prelude::*; + use serde_json::json; + use std::time::Duration; + + #[test] + fn sample() -> Result<()> { + task::block_on(async { + let listen_addr = find_listen_addr().await; + env::set_var("LISTEN_ADDR", format!("{}", listen_addr)); + + let server: task::JoinHandle> = task::spawn(async move { + run().await?; + + Ok(()) + }); + + let client: task::JoinHandle> = task::spawn(async move { + let listen_addr = env::var("LISTEN_ADDR").unwrap(); + + task::sleep(Duration::from_millis(300)).await; + + let string = surf::post(format!("http://{}/graphql", listen_addr)) + .body(Body::from(r#"{"query":"{ human(id:\"1000\") {name} }"}"#)) + .header("Content-Type", "application/json") + .recv_string() + .await?; + + assert_eq!( + string, + json!({"data":{"human":{"name":"Luke Skywalker"}}}).to_string() + ); + + Ok(()) + }); + + server.race(client).await?; + + Ok(()) + }) + } + + async fn find_listen_addr() -> async_std::net::SocketAddr { + async_std::net::TcpListener::bind("localhost:0") + .await + .unwrap() + .local_addr() + .unwrap() + } +} diff --git a/tide/subscription/Cargo.toml b/tide/subscription/Cargo.toml new file mode 100644 index 0000000..3f05f52 --- /dev/null +++ b/tide/subscription/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "tide-subscription" +version = "0.1.0" +authors = ["Sunli "] +edition = "2018" + +[dependencies] +async-graphql = { path = "../../.." } +async-graphql-tide = { path = "../../../integrations/tide" } +books = { path = "../../models/books" } +tide = "0.16" +async-std = "1.9.0" diff --git a/tide/subscription/src/main.rs b/tide/subscription/src/main.rs new file mode 100644 index 0000000..a1bfc71 --- /dev/null +++ b/tide/subscription/src/main.rs @@ -0,0 +1,48 @@ +use std::env; + +use async_graphql::http::{playground_source, GraphQLPlaygroundConfig}; +use async_graphql::Schema; +use async_std::task; +use books::{BooksSchema, MutationRoot, QueryRoot, Storage, SubscriptionRoot}; +use tide::http::mime; +use tide::{Body, Response, StatusCode}; + +type Result = std::result::Result>; + +#[derive(Clone)] +struct AppState { + schema: BooksSchema, +} + +fn main() -> Result<()> { + task::block_on(run()) +} + +async fn run() -> Result<()> { + let listen_addr = env::var("LISTEN_ADDR").unwrap_or_else(|_| "localhost:8000".to_owned()); + + let schema = Schema::build(QueryRoot, MutationRoot, SubscriptionRoot) + .data(Storage::default()) + .finish(); + + println!("Playground: http://{}", listen_addr); + + let mut app = tide::new(); + + app.at("/graphql") + .post(async_graphql_tide::graphql(schema.clone())) + .get(async_graphql_tide::GraphQLSubscription::new(schema).build()); + + app.at("/").get(|_| async move { + let mut resp = Response::new(StatusCode::Ok); + resp.set_body(Body::from_string(playground_source( + GraphQLPlaygroundConfig::new("/graphql").subscription_endpoint("/graphql"), + ))); + resp.set_content_type(mime::HTML); + Ok(resp) + }); + + app.listen(listen_addr).await?; + + Ok(()) +} From 49939003f9f0daf11a97522d7c3489d3beb85adb Mon Sep 17 00:00:00 2001 From: Sunli Date: Fri, 19 Nov 2021 08:14:23 +0800 Subject: [PATCH 002/102] bump actix-web from `4.0.0-beta.10` to `4.0.0-beta.11` --- actix-web/error-extensions/Cargo.toml | 2 +- actix-web/starwars/Cargo.toml | 2 +- actix-web/subscription/Cargo.toml | 2 +- actix-web/token-from-header/Cargo.toml | 2 +- actix-web/upload/Cargo.toml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/actix-web/error-extensions/Cargo.toml b/actix-web/error-extensions/Cargo.toml index a39f561..5ea3e8b 100644 --- a/actix-web/error-extensions/Cargo.toml +++ b/actix-web/error-extensions/Cargo.toml @@ -7,6 +7,6 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-actix-web = { path = "../../../integrations/actix-web" } -actix-web = { version = "4.0.0-beta.10", default-features = false } +actix-web = { version = "4.0.0-beta.11", default-features = false } thiserror = "1.0" serde_json = "1.0" diff --git a/actix-web/starwars/Cargo.toml b/actix-web/starwars/Cargo.toml index c0ee217..a8e48eb 100644 --- a/actix-web/starwars/Cargo.toml +++ b/actix-web/starwars/Cargo.toml @@ -7,5 +7,5 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-actix-web = { path = "../../../integrations/actix-web" } -actix-web = { version = "4.0.0-beta.10", default-features = false } +actix-web = { version = "4.0.0-beta.11", default-features = false } starwars = { path = "../../models/starwars" } diff --git a/actix-web/subscription/Cargo.toml b/actix-web/subscription/Cargo.toml index dc119a7..80f0c28 100644 --- a/actix-web/subscription/Cargo.toml +++ b/actix-web/subscription/Cargo.toml @@ -7,5 +7,5 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-actix-web = { path = "../../../integrations/actix-web" } -actix-web = { version = "4.0.0-beta.10", default-features = false } +actix-web = { version = "4.0.0-beta.11", default-features = false } books = { path = "../../models/books" } diff --git a/actix-web/token-from-header/Cargo.toml b/actix-web/token-from-header/Cargo.toml index cc73cdb..3492f95 100644 --- a/actix-web/token-from-header/Cargo.toml +++ b/actix-web/token-from-header/Cargo.toml @@ -7,5 +7,5 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-actix-web = { path = "../../../integrations/actix-web" } -actix-web = { version = "4.0.0-beta.10", default-features = false } +actix-web = { version = "4.0.0-beta.11", default-features = false } token = { path = "../../models/token" } diff --git a/actix-web/upload/Cargo.toml b/actix-web/upload/Cargo.toml index e3015ec..4e488be 100644 --- a/actix-web/upload/Cargo.toml +++ b/actix-web/upload/Cargo.toml @@ -7,5 +7,5 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-actix-web = { path = "../../../integrations/actix-web" } -actix-web = { version = "4.0.0-beta.10", default-features = false } +actix-web = { version = "4.0.0-beta.11", default-features = false } files = { path = "../../models/files" } From c4043062a12f17ef80373d84a67986e3a27f3421 Mon Sep 17 00:00:00 2001 From: Sunli Date: Tue, 23 Nov 2021 09:02:32 +0800 Subject: [PATCH 003/102] Update examples --- actix-web/error-extensions/src/main.rs | 2 +- tide/dataloader-postgres/src/main.rs | 5 ----- tide/dataloader/src/main.rs | 5 ----- tide/starwars/src/main.rs | 6 +----- tide/subscription/src/main.rs | 7 +------ 5 files changed, 3 insertions(+), 22 deletions(-) diff --git a/actix-web/error-extensions/src/main.rs b/actix-web/error-extensions/src/main.rs index 6ead6c7..d1596ff 100644 --- a/actix-web/error-extensions/src/main.rs +++ b/actix-web/error-extensions/src/main.rs @@ -24,7 +24,7 @@ pub enum MyError { impl ErrorExtensions for MyError { // lets define our base extensions - fn extend(self) -> FieldError { + fn extend(&self) -> FieldError { self.extend_with(|err, e| match err { MyError::NotFound => e.set("code", "NOT_FOUND"), MyError::ServerError(reason) => e.set("reason", reason.to_string()), diff --git a/tide/dataloader-postgres/src/main.rs b/tide/dataloader-postgres/src/main.rs index ed8d500..c82ae26 100644 --- a/tide/dataloader-postgres/src/main.rs +++ b/tide/dataloader-postgres/src/main.rs @@ -64,11 +64,6 @@ impl QueryRoot { } } -#[derive(Clone)] -struct AppState { - schema: Schema, -} - fn main() -> Result<()> { task::block_on(run()) } diff --git a/tide/dataloader/src/main.rs b/tide/dataloader/src/main.rs index 56f086c..57b2527 100644 --- a/tide/dataloader/src/main.rs +++ b/tide/dataloader/src/main.rs @@ -63,11 +63,6 @@ impl QueryRoot { } } -#[derive(Clone)] -struct AppState { - schema: Schema, -} - fn main() -> Result<()> { task::block_on(run()) } diff --git a/tide/starwars/src/main.rs b/tide/starwars/src/main.rs index 198b8c1..6ba431b 100644 --- a/tide/starwars/src/main.rs +++ b/tide/starwars/src/main.rs @@ -4,12 +4,8 @@ use async_std::task; use starwars::{QueryRoot, StarWars}; use std::env; use tide::{http::mime, Body, Response, StatusCode}; -type Result = std::result::Result>; -#[derive(Clone)] -struct AppState { - schema: Schema, -} +type Result = std::result::Result>; fn main() -> Result<()> { task::block_on(run()) diff --git a/tide/subscription/src/main.rs b/tide/subscription/src/main.rs index a1bfc71..09f4812 100644 --- a/tide/subscription/src/main.rs +++ b/tide/subscription/src/main.rs @@ -3,17 +3,12 @@ use std::env; use async_graphql::http::{playground_source, GraphQLPlaygroundConfig}; use async_graphql::Schema; use async_std::task; -use books::{BooksSchema, MutationRoot, QueryRoot, Storage, SubscriptionRoot}; +use books::{MutationRoot, QueryRoot, Storage, SubscriptionRoot}; use tide::http::mime; use tide::{Body, Response, StatusCode}; type Result = std::result::Result>; -#[derive(Clone)] -struct AppState { - schema: BooksSchema, -} - fn main() -> Result<()> { task::block_on(run()) } From c0858747f6b8c39cb7b1a8d2bf6e15ba97299b0f Mon Sep 17 00:00:00 2001 From: Sunli Date: Thu, 25 Nov 2021 16:30:39 +0800 Subject: [PATCH 004/102] Update examples --- poem/starwars/Cargo.toml | 2 +- poem/starwars/src/main.rs | 7 ++++--- poem/subscription/Cargo.toml | 2 +- poem/subscription/src/main.rs | 7 ++++--- poem/token-from-header/Cargo.toml | 2 +- poem/token-from-header/src/main.rs | 7 ++++--- 6 files changed, 15 insertions(+), 12 deletions(-) diff --git a/poem/starwars/Cargo.toml b/poem/starwars/Cargo.toml index 683f1b3..af7a5b4 100644 --- a/poem/starwars/Cargo.toml +++ b/poem/starwars/Cargo.toml @@ -8,4 +8,4 @@ async-graphql = { path = "../../.." } async-graphql-poem = { path = "../../../integrations/poem" } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } starwars = { path = "../../models/starwars" } -poem = "1.0.19" \ No newline at end of file +poem = "1.0.30" \ No newline at end of file diff --git a/poem/starwars/src/main.rs b/poem/starwars/src/main.rs index 9bcb68e..914911e 100644 --- a/poem/starwars/src/main.rs +++ b/poem/starwars/src/main.rs @@ -20,7 +20,8 @@ async fn main() { let app = Route::new().at("/", get(graphql_playground).post(GraphQL::new(schema))); println!("Playground: http://localhost:8000"); - - let listener = TcpListener::bind("0.0.0.0:8000"); - Server::new(listener).await.unwrap().run(app).await.unwrap(); + Server::new(TcpListener::bind("0.0.0.0:8000")) + .run(app) + .await + .unwrap(); } diff --git a/poem/subscription/Cargo.toml b/poem/subscription/Cargo.toml index 7a03feb..d0b02f3 100644 --- a/poem/subscription/Cargo.toml +++ b/poem/subscription/Cargo.toml @@ -8,4 +8,4 @@ async-graphql = { path = "../../.." } async-graphql-poem = { path = "../../../integrations/poem" } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } books = { path = "../../models/books" } -poem = { version = "1.0.19", features = ["websocket"] } +poem = { version = "1.0.30", features = ["websocket"] } diff --git a/poem/subscription/src/main.rs b/poem/subscription/src/main.rs index 9fff9ca..b33557c 100644 --- a/poem/subscription/src/main.rs +++ b/poem/subscription/src/main.rs @@ -27,7 +27,8 @@ async fn main() { .at("/ws", get(GraphQLSubscription::new(schema))); println!("Playground: http://localhost:8000"); - - let listener = TcpListener::bind("0.0.0.0:8000"); - Server::new(listener).await.unwrap().run(app).await.unwrap(); + Server::new(TcpListener::bind("0.0.0.0:8000")) + .run(app) + .await + .unwrap(); } diff --git a/poem/token-from-header/Cargo.toml b/poem/token-from-header/Cargo.toml index 7e1b4aa..88864f9 100644 --- a/poem/token-from-header/Cargo.toml +++ b/poem/token-from-header/Cargo.toml @@ -7,5 +7,5 @@ edition = "2021" async-graphql = { path = "../../.." } async-graphql-poem = { path = "../../../integrations/poem" } token = { path = "../../models/token" } -poem = { version = "1.0.19", features = ["websocket"] } +poem = { version = "1.0.30", features = ["websocket"] } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } diff --git a/poem/token-from-header/src/main.rs b/poem/token-from-header/src/main.rs index ed35e16..dada52d 100644 --- a/poem/token-from-header/src/main.rs +++ b/poem/token-from-header/src/main.rs @@ -66,7 +66,8 @@ async fn main() { .data(schema); println!("Playground: http://localhost:8000"); - - let listener = TcpListener::bind("0.0.0.0:8000"); - Server::new(listener).await.unwrap().run(app).await.unwrap(); + Server::new(TcpListener::bind("0.0.0.0:8000")) + .run(app) + .await + .unwrap(); } From a325a60308b2ad47ec949f40fa271867b0cee7db Mon Sep 17 00:00:00 2001 From: Sunli Date: Sat, 4 Dec 2021 14:58:51 +0800 Subject: [PATCH 005/102] Update examples --- tide/dataloader-postgres/src/main.rs | 5 ++++- tide/dataloader/src/main.rs | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/tide/dataloader-postgres/src/main.rs b/tide/dataloader-postgres/src/main.rs index c82ae26..0f5b6f9 100644 --- a/tide/dataloader-postgres/src/main.rs +++ b/tide/dataloader-postgres/src/main.rs @@ -95,7 +95,10 @@ async fn run() -> Result<()> { .await?; let schema = Schema::build(QueryRoot, EmptyMutation, EmptySubscription) - .data(DataLoader::new(BookLoader::new(postgres_pool))) + .data(DataLoader::new( + BookLoader::new(postgres_pool), + async_std::task::spawn, + )) .finish(); let mut app = tide::new(); diff --git a/tide/dataloader/src/main.rs b/tide/dataloader/src/main.rs index 57b2527..b8aa3fb 100644 --- a/tide/dataloader/src/main.rs +++ b/tide/dataloader/src/main.rs @@ -93,7 +93,10 @@ async fn run() -> Result<()> { .await?; let schema = Schema::build(QueryRoot, EmptyMutation, EmptySubscription) - .data(DataLoader::new(BookLoader::new(sqlite_pool))) + .data(DataLoader::new( + BookLoader::new(sqlite_pool), + async_std::task::spawn, + )) .finish(); let mut app = tide::new(); From ad5a253197dff977eadd7afb6626036776a162b7 Mon Sep 17 00:00:00 2001 From: Sunli Date: Wed, 8 Dec 2021 13:45:03 +0800 Subject: [PATCH 006/102] Bump axum from `0.3` to `0.4` --- axum/starwars/Cargo.toml | 2 +- axum/subscription/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/axum/starwars/Cargo.toml b/axum/starwars/Cargo.toml index b8e0427..f85a9a3 100644 --- a/axum/starwars/Cargo.toml +++ b/axum/starwars/Cargo.toml @@ -9,4 +9,4 @@ async-graphql-axum = { path = "../../../integrations/axum" } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } starwars = { path = "../../models/starwars" } hyper = "0.14" -axum = { version = "0.3", features = ["headers"] } +axum = { version = "0.4", features = ["headers"] } diff --git a/axum/subscription/Cargo.toml b/axum/subscription/Cargo.toml index a4f5005..80f2af1 100644 --- a/axum/subscription/Cargo.toml +++ b/axum/subscription/Cargo.toml @@ -9,4 +9,4 @@ async-graphql-axum = { path = "../../../integrations/axum" } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } books = { path = "../../models/books" } hyper = "0.14" -axum = { version = "0.3", features = ["ws", "headers"] } +axum = { version = "0.4", features = ["ws", "headers"] } From f9116e9029f6d57cea22c139c3e5fd952b774979 Mon Sep 17 00:00:00 2001 From: Sunli Date: Sun, 12 Dec 2021 10:09:41 +0800 Subject: [PATCH 007/102] Bump actix-web from `4.0.0-beta.11` to `4.0.0-beta.14` --- actix-web/error-extensions/Cargo.toml | 2 +- actix-web/starwars/Cargo.toml | 2 +- actix-web/subscription/Cargo.toml | 2 +- actix-web/token-from-header/Cargo.toml | 2 +- actix-web/token-from-header/src/main.rs | 2 +- actix-web/upload/Cargo.toml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/actix-web/error-extensions/Cargo.toml b/actix-web/error-extensions/Cargo.toml index 5ea3e8b..7ee1067 100644 --- a/actix-web/error-extensions/Cargo.toml +++ b/actix-web/error-extensions/Cargo.toml @@ -7,6 +7,6 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-actix-web = { path = "../../../integrations/actix-web" } -actix-web = { version = "4.0.0-beta.11", default-features = false } +actix-web = { version = "4.0.0-beta.14", default-features = false } thiserror = "1.0" serde_json = "1.0" diff --git a/actix-web/starwars/Cargo.toml b/actix-web/starwars/Cargo.toml index a8e48eb..55c578a 100644 --- a/actix-web/starwars/Cargo.toml +++ b/actix-web/starwars/Cargo.toml @@ -7,5 +7,5 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-actix-web = { path = "../../../integrations/actix-web" } -actix-web = { version = "4.0.0-beta.11", default-features = false } +actix-web = { version = "4.0.0-beta.14", default-features = false } starwars = { path = "../../models/starwars" } diff --git a/actix-web/subscription/Cargo.toml b/actix-web/subscription/Cargo.toml index 80f0c28..f518302 100644 --- a/actix-web/subscription/Cargo.toml +++ b/actix-web/subscription/Cargo.toml @@ -7,5 +7,5 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-actix-web = { path = "../../../integrations/actix-web" } -actix-web = { version = "4.0.0-beta.11", default-features = false } +actix-web = { version = "4.0.0-beta.14", default-features = false } books = { path = "../../models/books" } diff --git a/actix-web/token-from-header/Cargo.toml b/actix-web/token-from-header/Cargo.toml index 3492f95..fef770e 100644 --- a/actix-web/token-from-header/Cargo.toml +++ b/actix-web/token-from-header/Cargo.toml @@ -7,5 +7,5 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-actix-web = { path = "../../../integrations/actix-web" } -actix-web = { version = "4.0.0-beta.11", default-features = false } +actix-web = { version = "4.0.0-beta.14", default-features = false } token = { path = "../../models/token" } diff --git a/actix-web/token-from-header/src/main.rs b/actix-web/token-from-header/src/main.rs index 73feb5b..06c4d0f 100644 --- a/actix-web/token-from-header/src/main.rs +++ b/actix-web/token-from-header/src/main.rs @@ -1,4 +1,4 @@ -use actix_web::http::HeaderMap; +use actix_web::http::header::HeaderMap; use actix_web::{guard, web, App, HttpRequest, HttpResponse, HttpServer, Result}; use async_graphql::http::{playground_source, GraphQLPlaygroundConfig}; use async_graphql::{Data, EmptyMutation, Schema}; diff --git a/actix-web/upload/Cargo.toml b/actix-web/upload/Cargo.toml index 4e488be..da782b0 100644 --- a/actix-web/upload/Cargo.toml +++ b/actix-web/upload/Cargo.toml @@ -7,5 +7,5 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-actix-web = { path = "../../../integrations/actix-web" } -actix-web = { version = "4.0.0-beta.11", default-features = false } +actix-web = { version = "4.0.0-beta.14", default-features = false } files = { path = "../../models/files" } From 551868559b7b2c0db3d10315219be47ec1004c98 Mon Sep 17 00:00:00 2001 From: Sunli Date: Thu, 16 Dec 2021 12:55:48 +0800 Subject: [PATCH 008/102] Bump poem to `1.2.1` --- poem/starwars/Cargo.toml | 2 +- poem/subscription/Cargo.toml | 2 +- poem/token-from-header/Cargo.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/poem/starwars/Cargo.toml b/poem/starwars/Cargo.toml index af7a5b4..9b66440 100644 --- a/poem/starwars/Cargo.toml +++ b/poem/starwars/Cargo.toml @@ -8,4 +8,4 @@ async-graphql = { path = "../../.." } async-graphql-poem = { path = "../../../integrations/poem" } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } starwars = { path = "../../models/starwars" } -poem = "1.0.30" \ No newline at end of file +poem = "1.2.1" diff --git a/poem/subscription/Cargo.toml b/poem/subscription/Cargo.toml index d0b02f3..cf51352 100644 --- a/poem/subscription/Cargo.toml +++ b/poem/subscription/Cargo.toml @@ -8,4 +8,4 @@ async-graphql = { path = "../../.." } async-graphql-poem = { path = "../../../integrations/poem" } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } books = { path = "../../models/books" } -poem = { version = "1.0.30", features = ["websocket"] } +poem = { version = "1.2.1", features = ["websocket"] } diff --git a/poem/token-from-header/Cargo.toml b/poem/token-from-header/Cargo.toml index 88864f9..5a2bcfb 100644 --- a/poem/token-from-header/Cargo.toml +++ b/poem/token-from-header/Cargo.toml @@ -7,5 +7,5 @@ edition = "2021" async-graphql = { path = "../../.." } async-graphql-poem = { path = "../../../integrations/poem" } token = { path = "../../models/token" } -poem = { version = "1.0.30", features = ["websocket"] } +poem = { version = "1.2.1", features = ["websocket"] } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } From 6a16d2f5d5eeb56e0b2989ed8bc4b061ecd74ca3 Mon Sep 17 00:00:00 2001 From: Sunli Date: Fri, 17 Dec 2021 09:50:07 +0800 Subject: [PATCH 009/102] Update examples --- poem/starwars/Cargo.toml | 2 +- poem/subscription/Cargo.toml | 2 +- poem/token-from-header/Cargo.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/poem/starwars/Cargo.toml b/poem/starwars/Cargo.toml index 9b66440..fc345b0 100644 --- a/poem/starwars/Cargo.toml +++ b/poem/starwars/Cargo.toml @@ -8,4 +8,4 @@ async-graphql = { path = "../../.." } async-graphql-poem = { path = "../../../integrations/poem" } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } starwars = { path = "../../models/starwars" } -poem = "1.2.1" +poem = "1.2.2" diff --git a/poem/subscription/Cargo.toml b/poem/subscription/Cargo.toml index cf51352..4ebaa30 100644 --- a/poem/subscription/Cargo.toml +++ b/poem/subscription/Cargo.toml @@ -8,4 +8,4 @@ async-graphql = { path = "../../.." } async-graphql-poem = { path = "../../../integrations/poem" } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } books = { path = "../../models/books" } -poem = { version = "1.2.1", features = ["websocket"] } +poem = { version = "1.2.2", features = ["websocket"] } diff --git a/poem/token-from-header/Cargo.toml b/poem/token-from-header/Cargo.toml index 5a2bcfb..6e5e5ba 100644 --- a/poem/token-from-header/Cargo.toml +++ b/poem/token-from-header/Cargo.toml @@ -7,5 +7,5 @@ edition = "2021" async-graphql = { path = "../../.." } async-graphql-poem = { path = "../../../integrations/poem" } token = { path = "../../models/token" } -poem = { version = "1.2.1", features = ["websocket"] } +poem = { version = "1.2.2", features = ["websocket"] } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } From 0ce0a4387470bf9e61c21ae616cabf447ae3eee5 Mon Sep 17 00:00:00 2001 From: Sunli Date: Thu, 30 Dec 2021 10:04:12 +0800 Subject: [PATCH 010/102] Bump actix-web from `4.0.0-beta.14` to `4.0.0-beta.18` --- actix-web/error-extensions/Cargo.toml | 2 +- actix-web/starwars/Cargo.toml | 2 +- actix-web/subscription/Cargo.toml | 2 +- actix-web/token-from-header/Cargo.toml | 2 +- actix-web/upload/Cargo.toml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/actix-web/error-extensions/Cargo.toml b/actix-web/error-extensions/Cargo.toml index 7ee1067..3d3849a 100644 --- a/actix-web/error-extensions/Cargo.toml +++ b/actix-web/error-extensions/Cargo.toml @@ -7,6 +7,6 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-actix-web = { path = "../../../integrations/actix-web" } -actix-web = { version = "4.0.0-beta.14", default-features = false } +actix-web = { version = "4.0.0-beta.18", default-features = false } thiserror = "1.0" serde_json = "1.0" diff --git a/actix-web/starwars/Cargo.toml b/actix-web/starwars/Cargo.toml index 55c578a..561cf25 100644 --- a/actix-web/starwars/Cargo.toml +++ b/actix-web/starwars/Cargo.toml @@ -7,5 +7,5 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-actix-web = { path = "../../../integrations/actix-web" } -actix-web = { version = "4.0.0-beta.14", default-features = false } +actix-web = { version = "4.0.0-beta.18", default-features = false } starwars = { path = "../../models/starwars" } diff --git a/actix-web/subscription/Cargo.toml b/actix-web/subscription/Cargo.toml index f518302..f3124bf 100644 --- a/actix-web/subscription/Cargo.toml +++ b/actix-web/subscription/Cargo.toml @@ -7,5 +7,5 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-actix-web = { path = "../../../integrations/actix-web" } -actix-web = { version = "4.0.0-beta.14", default-features = false } +actix-web = { version = "4.0.0-beta.18", default-features = false } books = { path = "../../models/books" } diff --git a/actix-web/token-from-header/Cargo.toml b/actix-web/token-from-header/Cargo.toml index fef770e..de0558e 100644 --- a/actix-web/token-from-header/Cargo.toml +++ b/actix-web/token-from-header/Cargo.toml @@ -7,5 +7,5 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-actix-web = { path = "../../../integrations/actix-web" } -actix-web = { version = "4.0.0-beta.14", default-features = false } +actix-web = { version = "4.0.0-beta.18", default-features = false } token = { path = "../../models/token" } diff --git a/actix-web/upload/Cargo.toml b/actix-web/upload/Cargo.toml index da782b0..211817b 100644 --- a/actix-web/upload/Cargo.toml +++ b/actix-web/upload/Cargo.toml @@ -7,5 +7,5 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-actix-web = { path = "../../../integrations/actix-web" } -actix-web = { version = "4.0.0-beta.14", default-features = false } +actix-web = { version = "4.0.0-beta.18", default-features = false } files = { path = "../../models/files" } From 09ba4b9d2b6ca1c43b57bc7ca2c8a3f23b53e07b Mon Sep 17 00:00:00 2001 From: Sunli Date: Wed, 5 Jan 2022 10:15:05 +0800 Subject: [PATCH 011/102] Bump actix-web from `4.0.0-beta.18` to `4.0.0-beta.19` --- actix-web/error-extensions/Cargo.toml | 2 +- actix-web/starwars/Cargo.toml | 2 +- actix-web/subscription/Cargo.toml | 2 +- actix-web/token-from-header/Cargo.toml | 2 +- actix-web/upload/Cargo.toml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/actix-web/error-extensions/Cargo.toml b/actix-web/error-extensions/Cargo.toml index 3d3849a..88c0c17 100644 --- a/actix-web/error-extensions/Cargo.toml +++ b/actix-web/error-extensions/Cargo.toml @@ -7,6 +7,6 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-actix-web = { path = "../../../integrations/actix-web" } -actix-web = { version = "4.0.0-beta.18", default-features = false } +actix-web = { version = "4.0.0-beta.19", default-features = false } thiserror = "1.0" serde_json = "1.0" diff --git a/actix-web/starwars/Cargo.toml b/actix-web/starwars/Cargo.toml index 561cf25..834d71b 100644 --- a/actix-web/starwars/Cargo.toml +++ b/actix-web/starwars/Cargo.toml @@ -7,5 +7,5 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-actix-web = { path = "../../../integrations/actix-web" } -actix-web = { version = "4.0.0-beta.18", default-features = false } +actix-web = { version = "4.0.0-beta.19", default-features = false } starwars = { path = "../../models/starwars" } diff --git a/actix-web/subscription/Cargo.toml b/actix-web/subscription/Cargo.toml index f3124bf..8475d08 100644 --- a/actix-web/subscription/Cargo.toml +++ b/actix-web/subscription/Cargo.toml @@ -7,5 +7,5 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-actix-web = { path = "../../../integrations/actix-web" } -actix-web = { version = "4.0.0-beta.18", default-features = false } +actix-web = { version = "4.0.0-beta.19", default-features = false } books = { path = "../../models/books" } diff --git a/actix-web/token-from-header/Cargo.toml b/actix-web/token-from-header/Cargo.toml index de0558e..3b9f9b6 100644 --- a/actix-web/token-from-header/Cargo.toml +++ b/actix-web/token-from-header/Cargo.toml @@ -7,5 +7,5 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-actix-web = { path = "../../../integrations/actix-web" } -actix-web = { version = "4.0.0-beta.18", default-features = false } +actix-web = { version = "4.0.0-beta.19", default-features = false } token = { path = "../../models/token" } diff --git a/actix-web/upload/Cargo.toml b/actix-web/upload/Cargo.toml index 211817b..a4d437b 100644 --- a/actix-web/upload/Cargo.toml +++ b/actix-web/upload/Cargo.toml @@ -7,5 +7,5 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-actix-web = { path = "../../../integrations/actix-web" } -actix-web = { version = "4.0.0-beta.18", default-features = false } +actix-web = { version = "4.0.0-beta.19", default-features = false } files = { path = "../../models/files" } From c8219078a4b7aa6d84d22e9b79f033088897be4b Mon Sep 17 00:00:00 2001 From: Sunli Date: Thu, 6 Jan 2022 16:06:06 +0800 Subject: [PATCH 012/102] Add poem/subscription-redis example --- Cargo.toml | 1 + poem/starwars/Cargo.toml | 2 +- poem/subscription-redis/Cargo.toml | 12 +++++ poem/subscription-redis/src/main.rs | 72 +++++++++++++++++++++++++++++ poem/subscription/Cargo.toml | 2 +- poem/token-from-header/Cargo.toml | 2 +- 6 files changed, 88 insertions(+), 3 deletions(-) create mode 100644 poem/subscription-redis/Cargo.toml create mode 100644 poem/subscription-redis/src/main.rs diff --git a/Cargo.toml b/Cargo.toml index febc8c6..06f2110 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,6 +7,7 @@ members = [ "poem/starwars", "poem/subscription", + "poem/subscription-redis", "poem/token-from-header", "actix-web/token-from-header", diff --git a/poem/starwars/Cargo.toml b/poem/starwars/Cargo.toml index fc345b0..c522fa2 100644 --- a/poem/starwars/Cargo.toml +++ b/poem/starwars/Cargo.toml @@ -8,4 +8,4 @@ async-graphql = { path = "../../.." } async-graphql-poem = { path = "../../../integrations/poem" } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } starwars = { path = "../../models/starwars" } -poem = "1.2.2" +poem = "1.2.25" diff --git a/poem/subscription-redis/Cargo.toml b/poem/subscription-redis/Cargo.toml new file mode 100644 index 0000000..76ecdba --- /dev/null +++ b/poem/subscription-redis/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "subscription-redis" +version = "0.1.0" +edition = "2021" + +[dependencies] +async-graphql = { path = "../../.." } +async-graphql-poem = { path = "../../../integrations/poem" } +tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } +poem = { version = "1.2.25", features = ["websocket"] } +redis = { version = "0.21.4", features = ["aio", "tokio-comp"] } +futures-util = "0.3.19" diff --git a/poem/subscription-redis/src/main.rs b/poem/subscription-redis/src/main.rs new file mode 100644 index 0000000..a4ccff1 --- /dev/null +++ b/poem/subscription-redis/src/main.rs @@ -0,0 +1,72 @@ +use async_graphql::http::{playground_source, GraphQLPlaygroundConfig}; +use async_graphql::{Context, Object, Result, Schema, Subscription}; +use async_graphql_poem::{GraphQL, GraphQLSubscription}; +use futures_util::{Stream, StreamExt}; +use poem::listener::TcpListener; +use poem::web::Html; +use poem::{get, handler, IntoResponse, Route, Server}; +use redis::{AsyncCommands, Client}; + +struct QueryRoot; + +#[Object] +impl QueryRoot { + async fn version(&self) -> &'static str { + std::env!("CARGO_PKG_VERSION") + } +} + +struct MutationRoot; + +#[Object] +impl MutationRoot { + async fn publish(&self, ctx: &Context<'_>, value: String) -> Result { + let client = ctx.data_unchecked::(); + let mut conn = client.get_async_connection().await?; + conn.publish("values", value).await?; + Ok(true) + } +} + +struct SubscriptionRoot; + +#[Subscription] +impl SubscriptionRoot { + async fn values(&self, ctx: &Context<'_>) -> Result> { + let client = ctx.data_unchecked::(); + let mut conn = client.get_async_connection().await?.into_pubsub(); + conn.subscribe("values").await?; + Ok(conn + .into_on_message() + .filter_map(|msg| async move { msg.get_payload().ok() })) + } +} + +#[handler] +async fn graphql_playground() -> impl IntoResponse { + Html(playground_source( + GraphQLPlaygroundConfig::new("/").subscription_endpoint("/ws"), + )) +} + +#[tokio::main] +async fn main() { + let client = Client::open("redis://127.0.0.1/").unwrap(); + + let schema = Schema::build(QueryRoot, MutationRoot, SubscriptionRoot) + .data(client) + .finish(); + + let app = Route::new() + .at( + "/", + get(graphql_playground).post(GraphQL::new(schema.clone())), + ) + .at("/ws", get(GraphQLSubscription::new(schema))); + + println!("Playground: http://localhost:8000"); + Server::new(TcpListener::bind("0.0.0.0:8000")) + .run(app) + .await + .unwrap(); +} diff --git a/poem/subscription/Cargo.toml b/poem/subscription/Cargo.toml index 4ebaa30..fb3e0d7 100644 --- a/poem/subscription/Cargo.toml +++ b/poem/subscription/Cargo.toml @@ -8,4 +8,4 @@ async-graphql = { path = "../../.." } async-graphql-poem = { path = "../../../integrations/poem" } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } books = { path = "../../models/books" } -poem = { version = "1.2.2", features = ["websocket"] } +poem = { version = "1.2.25", features = ["websocket"] } diff --git a/poem/token-from-header/Cargo.toml b/poem/token-from-header/Cargo.toml index 6e5e5ba..d439a79 100644 --- a/poem/token-from-header/Cargo.toml +++ b/poem/token-from-header/Cargo.toml @@ -7,5 +7,5 @@ edition = "2021" async-graphql = { path = "../../.." } async-graphql-poem = { path = "../../../integrations/poem" } token = { path = "../../models/token" } -poem = { version = "1.2.2", features = ["websocket"] } +poem = { version = "1.2.25", features = ["websocket"] } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } From ee6e8581f096001820c0d4829fa88c0b85f2f8c1 Mon Sep 17 00:00:00 2001 From: Sunli Date: Tue, 1 Feb 2022 17:46:24 +0800 Subject: [PATCH 013/102] Update upload examples --- Cargo.toml | 2 ++ axum/upload/Cargo.toml | 14 ++++++++++++ axum/upload/src/main.rs | 41 ++++++++++++++++++++++++++++++++++++ models/files/src/lib.rs | 9 +++----- models/starwars/src/model.rs | 14 ++---------- poem/upload/Cargo.toml | 12 +++++++++++ poem/upload/src/main.rs | 35 ++++++++++++++++++++++++++++++ 7 files changed, 109 insertions(+), 18 deletions(-) create mode 100644 axum/upload/Cargo.toml create mode 100644 axum/upload/src/main.rs create mode 100644 poem/upload/Cargo.toml create mode 100644 poem/upload/src/main.rs diff --git a/Cargo.toml b/Cargo.toml index 06f2110..35ef7f4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,6 +9,7 @@ members = [ "poem/subscription", "poem/subscription-redis", "poem/token-from-header", + "poem/upload", "actix-web/token-from-header", "actix-web/subscription", @@ -29,6 +30,7 @@ members = [ "axum/starwars", "axum/subscription", + "axum/upload", "tide/starwars", "tide/dataloader", diff --git a/axum/upload/Cargo.toml b/axum/upload/Cargo.toml new file mode 100644 index 0000000..29113d6 --- /dev/null +++ b/axum/upload/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "axum-upload" +version = "0.1.1" +authors = ["sunli "] +edition = "2021" + +[dependencies] +async-graphql = { path = "../../.." } +async-graphql-axum = { path = "../../../integrations/axum" } +axum = "0.4" +files = { path = "../../models/files" } +tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } +hyper = "0.14" +tower-http = { version = "0.2.1", features = ["cors"] } diff --git a/axum/upload/src/main.rs b/axum/upload/src/main.rs new file mode 100644 index 0000000..6eaf2c8 --- /dev/null +++ b/axum/upload/src/main.rs @@ -0,0 +1,41 @@ +use async_graphql::http::{playground_source, GraphQLPlaygroundConfig}; +use async_graphql::{EmptySubscription, Schema}; +use async_graphql_axum::{GraphQLRequest, GraphQLResponse}; +use axum::extract::Extension; +use axum::response::{Html, IntoResponse}; +use axum::routing::get; +use axum::{AddExtensionLayer, Router}; +use files::{FilesSchema, MutationRoot, QueryRoot, Storage}; +use hyper::{Method, Server}; +use tower_http::cors::{CorsLayer, Origin}; + +async fn graphql_handler(schema: Extension, req: GraphQLRequest) -> GraphQLResponse { + schema.execute(req.0).await.into() +} + +async fn graphql_playground() -> impl IntoResponse { + Html(playground_source(GraphQLPlaygroundConfig::new("/"))) +} + +#[tokio::main] +async fn main() { + let schema = Schema::build(QueryRoot, MutationRoot, EmptySubscription) + .data(Storage::default()) + .finish(); + + println!("Playground: http://localhost:8000"); + + let app = Router::new() + .route("/", get(graphql_playground).post(graphql_handler)) + .layer(AddExtensionLayer::new(schema)) + .layer( + CorsLayer::new() + .allow_origin(Origin::predicate(|_, _| true)) + .allow_methods(vec![Method::GET, Method::POST]), + ); + + Server::bind(&"0.0.0.0:8000".parse().unwrap()) + .serve(app.into_make_service()) + .await + .unwrap(); +} diff --git a/models/files/src/lib.rs b/models/files/src/lib.rs index cc65ae0..da273ef 100644 --- a/models/files/src/lib.rs +++ b/models/files/src/lib.rs @@ -7,8 +7,7 @@ pub type FilesSchema = Schema; #[derive(Clone, SimpleObject)] pub struct FileInfo { id: ID, - filename: String, - mimetype: Option, + url: String, } pub type Storage = Mutex>; @@ -34,8 +33,7 @@ impl MutationRoot { let upload = file.value(ctx).unwrap(); let info = FileInfo { id: entry.key().into(), - filename: upload.filename.clone(), - mimetype: upload.content_type, + url: upload.filename, }; entry.insert(info.clone()); info @@ -49,8 +47,7 @@ impl MutationRoot { let upload = file.value(ctx).unwrap(); let info = FileInfo { id: entry.key().into(), - filename: upload.filename.clone(), - mimetype: upload.content_type.clone(), + url: upload.filename.clone(), }; entry.insert(info.clone()); infos.push(info) diff --git a/models/starwars/src/model.rs b/models/starwars/src/model.rs index b1cda6a..2de9b28 100644 --- a/models/starwars/src/model.rs +++ b/models/starwars/src/model.rs @@ -138,12 +138,7 @@ impl QueryRoot { first: Option, last: Option, ) -> Result, EmptyFields, EmptyFields>> { - let humans = ctx - .data_unchecked::() - .humans() - .iter() - .copied() - .collect::>(); + let humans = ctx.data_unchecked::().humans().to_vec(); query_characters(after, before, first, last, &humans) .await .map(|conn| conn.map_node(Human)) @@ -165,12 +160,7 @@ impl QueryRoot { first: Option, last: Option, ) -> Result, EmptyFields, EmptyFields>> { - let droids = ctx - .data_unchecked::() - .droids() - .iter() - .copied() - .collect::>(); + let droids = ctx.data_unchecked::().droids().to_vec(); query_characters(after, before, first, last, &droids) .await .map(|conn| conn.map_node(Droid)) diff --git a/poem/upload/Cargo.toml b/poem/upload/Cargo.toml new file mode 100644 index 0000000..912534b --- /dev/null +++ b/poem/upload/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "poem-upload" +version = "0.1.1" +authors = ["sunli "] +edition = "2021" + +[dependencies] +async-graphql = { path = "../../.." } +async-graphql-poem = { path = "../../../integrations/poem" } +poem = { version = "1.2.25", features = ["websocket"] } +files = { path = "../../models/files" } +tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } diff --git a/poem/upload/src/main.rs b/poem/upload/src/main.rs new file mode 100644 index 0000000..96342c6 --- /dev/null +++ b/poem/upload/src/main.rs @@ -0,0 +1,35 @@ +use async_graphql::http::{playground_source, GraphQLPlaygroundConfig}; +use async_graphql::{EmptySubscription, Schema}; +use async_graphql_poem::{GraphQLRequest, GraphQLResponse}; +use files::{FilesSchema, MutationRoot, QueryRoot, Storage}; +use poem::listener::TcpListener; +use poem::middleware::Cors; +use poem::web::{Data, Html}; +use poem::{get, handler, EndpointExt, IntoResponse, Route, Server}; + +#[handler] +async fn index(schema: Data<&FilesSchema>, req: GraphQLRequest) -> GraphQLResponse { + schema.execute(req.0).await.into() +} + +#[handler] +async fn gql_playground() -> impl IntoResponse { + Html(playground_source(GraphQLPlaygroundConfig::new("/"))) +} + +#[tokio::main] +async fn main() -> std::io::Result<()> { + let schema = Schema::build(QueryRoot, MutationRoot, EmptySubscription) + .data(Storage::default()) + .finish(); + + println!("Playground: http://localhost:8000"); + + let app = Route::new() + .at("/", get(gql_playground).post(index)) + .with(Cors::new()) + .data(schema); + Server::new(TcpListener::bind("0.0.0.0:8000")) + .run(app) + .await +} From 9cde888ee5f367d4f4d653a9fa9ec94722b855d1 Mon Sep 17 00:00:00 2001 From: Sunli Date: Sun, 6 Feb 2022 16:21:22 +0800 Subject: [PATCH 014/102] Bump actix-web from `4.0.0-beta.19` to `4.0.0-rc.2` --- actix-web/error-extensions/Cargo.toml | 2 +- actix-web/starwars/Cargo.toml | 2 +- actix-web/subscription/Cargo.toml | 2 +- actix-web/token-from-header/Cargo.toml | 2 +- actix-web/upload/Cargo.toml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/actix-web/error-extensions/Cargo.toml b/actix-web/error-extensions/Cargo.toml index 88c0c17..4c774c2 100644 --- a/actix-web/error-extensions/Cargo.toml +++ b/actix-web/error-extensions/Cargo.toml @@ -7,6 +7,6 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-actix-web = { path = "../../../integrations/actix-web" } -actix-web = { version = "4.0.0-beta.19", default-features = false } +actix-web = { version = "4.0.0-rc.2", default-features = false, features = ["macros"] } thiserror = "1.0" serde_json = "1.0" diff --git a/actix-web/starwars/Cargo.toml b/actix-web/starwars/Cargo.toml index 834d71b..960ae77 100644 --- a/actix-web/starwars/Cargo.toml +++ b/actix-web/starwars/Cargo.toml @@ -7,5 +7,5 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-actix-web = { path = "../../../integrations/actix-web" } -actix-web = { version = "4.0.0-beta.19", default-features = false } +actix-web = { version = "4.0.0-rc.2", default-features = false, features = ["macros"] } starwars = { path = "../../models/starwars" } diff --git a/actix-web/subscription/Cargo.toml b/actix-web/subscription/Cargo.toml index 8475d08..302245d 100644 --- a/actix-web/subscription/Cargo.toml +++ b/actix-web/subscription/Cargo.toml @@ -7,5 +7,5 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-actix-web = { path = "../../../integrations/actix-web" } -actix-web = { version = "4.0.0-beta.19", default-features = false } +actix-web = { version = "4.0.0-rc.2", default-features = false, features = ["macros"] } books = { path = "../../models/books" } diff --git a/actix-web/token-from-header/Cargo.toml b/actix-web/token-from-header/Cargo.toml index 3b9f9b6..d15b36f 100644 --- a/actix-web/token-from-header/Cargo.toml +++ b/actix-web/token-from-header/Cargo.toml @@ -7,5 +7,5 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-actix-web = { path = "../../../integrations/actix-web" } -actix-web = { version = "4.0.0-beta.19", default-features = false } +actix-web = { version = "4.0.0-rc.2", default-features = false, features = ["macros"] } token = { path = "../../models/token" } diff --git a/actix-web/upload/Cargo.toml b/actix-web/upload/Cargo.toml index a4d437b..5ff9be9 100644 --- a/actix-web/upload/Cargo.toml +++ b/actix-web/upload/Cargo.toml @@ -7,5 +7,5 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-actix-web = { path = "../../../integrations/actix-web" } -actix-web = { version = "4.0.0-beta.19", default-features = false } +actix-web = { version = "4.0.0-rc.2", default-features = false, features = ["macros"] } files = { path = "../../models/files" } From 840fd0aa36f6fa4633047ef3000bb51b35e26b7b Mon Sep 17 00:00:00 2001 From: Sunli Date: Thu, 17 Feb 2022 19:03:09 +0800 Subject: [PATCH 015/102] Bump actix-web from `4.0.0-rc.2` to `4.0.0-rc.3` --- actix-web/error-extensions/Cargo.toml | 2 +- actix-web/starwars/Cargo.toml | 2 +- actix-web/subscription/Cargo.toml | 2 +- actix-web/token-from-header/Cargo.toml | 2 +- actix-web/upload/Cargo.toml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/actix-web/error-extensions/Cargo.toml b/actix-web/error-extensions/Cargo.toml index 4c774c2..b695b4d 100644 --- a/actix-web/error-extensions/Cargo.toml +++ b/actix-web/error-extensions/Cargo.toml @@ -7,6 +7,6 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-actix-web = { path = "../../../integrations/actix-web" } -actix-web = { version = "4.0.0-rc.2", default-features = false, features = ["macros"] } +actix-web = { version = "4.0.0-rc.3", default-features = false, features = ["macros"] } thiserror = "1.0" serde_json = "1.0" diff --git a/actix-web/starwars/Cargo.toml b/actix-web/starwars/Cargo.toml index 960ae77..ffe6785 100644 --- a/actix-web/starwars/Cargo.toml +++ b/actix-web/starwars/Cargo.toml @@ -7,5 +7,5 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-actix-web = { path = "../../../integrations/actix-web" } -actix-web = { version = "4.0.0-rc.2", default-features = false, features = ["macros"] } +actix-web = { version = "4.0.0-rc.3", default-features = false, features = ["macros"] } starwars = { path = "../../models/starwars" } diff --git a/actix-web/subscription/Cargo.toml b/actix-web/subscription/Cargo.toml index 302245d..6e54c45 100644 --- a/actix-web/subscription/Cargo.toml +++ b/actix-web/subscription/Cargo.toml @@ -7,5 +7,5 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-actix-web = { path = "../../../integrations/actix-web" } -actix-web = { version = "4.0.0-rc.2", default-features = false, features = ["macros"] } +actix-web = { version = "4.0.0-rc.3", default-features = false, features = ["macros"] } books = { path = "../../models/books" } diff --git a/actix-web/token-from-header/Cargo.toml b/actix-web/token-from-header/Cargo.toml index d15b36f..802a85e 100644 --- a/actix-web/token-from-header/Cargo.toml +++ b/actix-web/token-from-header/Cargo.toml @@ -7,5 +7,5 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-actix-web = { path = "../../../integrations/actix-web" } -actix-web = { version = "4.0.0-rc.2", default-features = false, features = ["macros"] } +actix-web = { version = "4.0.0-rc.3", default-features = false, features = ["macros"] } token = { path = "../../models/token" } diff --git a/actix-web/upload/Cargo.toml b/actix-web/upload/Cargo.toml index 5ff9be9..3c82e7c 100644 --- a/actix-web/upload/Cargo.toml +++ b/actix-web/upload/Cargo.toml @@ -7,5 +7,5 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-actix-web = { path = "../../../integrations/actix-web" } -actix-web = { version = "4.0.0-rc.2", default-features = false, features = ["macros"] } +actix-web = { version = "4.0.0-rc.3", default-features = false, features = ["macros"] } files = { path = "../../models/files" } From 61384c8fa50e1395e50015b2be77b4bc6f5de4d2 Mon Sep 17 00:00:00 2001 From: Sunli Date: Mon, 28 Feb 2022 15:34:28 +0800 Subject: [PATCH 016/102] Update examples --- actix-web/error-extensions/Cargo.toml | 2 +- actix-web/starwars/Cargo.toml | 2 +- actix-web/subscription/Cargo.toml | 2 +- actix-web/token-from-header/Cargo.toml | 2 +- actix-web/upload/Cargo.toml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/actix-web/error-extensions/Cargo.toml b/actix-web/error-extensions/Cargo.toml index b695b4d..a8281e4 100644 --- a/actix-web/error-extensions/Cargo.toml +++ b/actix-web/error-extensions/Cargo.toml @@ -7,6 +7,6 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-actix-web = { path = "../../../integrations/actix-web" } -actix-web = { version = "4.0.0-rc.3", default-features = false, features = ["macros"] } +actix-web = { version = "4.0.1", default-features = false, features = ["macros"] } thiserror = "1.0" serde_json = "1.0" diff --git a/actix-web/starwars/Cargo.toml b/actix-web/starwars/Cargo.toml index ffe6785..f02f3cf 100644 --- a/actix-web/starwars/Cargo.toml +++ b/actix-web/starwars/Cargo.toml @@ -7,5 +7,5 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-actix-web = { path = "../../../integrations/actix-web" } -actix-web = { version = "4.0.0-rc.3", default-features = false, features = ["macros"] } +actix-web = { version = "4.0.1", default-features = false, features = ["macros"] } starwars = { path = "../../models/starwars" } diff --git a/actix-web/subscription/Cargo.toml b/actix-web/subscription/Cargo.toml index 6e54c45..ef6b143 100644 --- a/actix-web/subscription/Cargo.toml +++ b/actix-web/subscription/Cargo.toml @@ -7,5 +7,5 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-actix-web = { path = "../../../integrations/actix-web" } -actix-web = { version = "4.0.0-rc.3", default-features = false, features = ["macros"] } +actix-web = { version = "4.0.1", default-features = false, features = ["macros"] } books = { path = "../../models/books" } diff --git a/actix-web/token-from-header/Cargo.toml b/actix-web/token-from-header/Cargo.toml index 802a85e..e27dd08 100644 --- a/actix-web/token-from-header/Cargo.toml +++ b/actix-web/token-from-header/Cargo.toml @@ -7,5 +7,5 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-actix-web = { path = "../../../integrations/actix-web" } -actix-web = { version = "4.0.0-rc.3", default-features = false, features = ["macros"] } +actix-web = { version = "4.0.1", default-features = false, features = ["macros"] } token = { path = "../../models/token" } diff --git a/actix-web/upload/Cargo.toml b/actix-web/upload/Cargo.toml index 3c82e7c..8974300 100644 --- a/actix-web/upload/Cargo.toml +++ b/actix-web/upload/Cargo.toml @@ -7,5 +7,5 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-actix-web = { path = "../../../integrations/actix-web" } -actix-web = { version = "4.0.0-rc.3", default-features = false, features = ["macros"] } +actix-web = { version = "4.0.1", default-features = false, features = ["macros"] } files = { path = "../../models/files" } From 81abd077490b3a6666d755cdd6cc4088f1b17a63 Mon Sep 17 00:00:00 2001 From: Michiel Kalkman Date: Tue, 22 Mar 2022 14:05:29 +1100 Subject: [PATCH 017/102] chore: update deprecated axum struct Changes use of deprecated struct `axum::AddExtensionLayer` to `axum::extract::Extension` --- axum/starwars/src/main.rs | 4 ++-- axum/subscription/src/main.rs | 6 +++--- axum/upload/src/main.rs | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/axum/starwars/src/main.rs b/axum/starwars/src/main.rs index 8056819..137c60a 100644 --- a/axum/starwars/src/main.rs +++ b/axum/starwars/src/main.rs @@ -4,7 +4,7 @@ use async_graphql_axum::{GraphQLRequest, GraphQLResponse}; use axum::extract::Extension; use axum::response::{self, IntoResponse}; use axum::routing::get; -use axum::{AddExtensionLayer, Router, Server}; +use axum::{Router, Server}; use starwars::{QueryRoot, StarWars, StarWarsSchema}; async fn graphql_handler( @@ -26,7 +26,7 @@ async fn main() { let app = Router::new() .route("/", get(graphql_playground).post(graphql_handler)) - .layer(AddExtensionLayer::new(schema)); + .layer(Extension(schema)); println!("Playground: http://localhost:8000"); diff --git a/axum/subscription/src/main.rs b/axum/subscription/src/main.rs index 6ecfc6d..e3ccc8a 100644 --- a/axum/subscription/src/main.rs +++ b/axum/subscription/src/main.rs @@ -3,11 +3,11 @@ use async_graphql::Schema; use async_graphql_axum::{GraphQLRequest, GraphQLResponse, GraphQLSubscription}; use axum::response::{self, IntoResponse}; use axum::routing::get; -use axum::{extract, AddExtensionLayer, Router, Server}; +use axum::{extract::Extension, Router, Server}; use books::{BooksSchema, MutationRoot, QueryRoot, Storage, SubscriptionRoot}; async fn graphql_handler( - schema: extract::Extension, + schema: Extension, req: GraphQLRequest, ) -> GraphQLResponse { schema.execute(req.into_inner()).await.into() @@ -28,7 +28,7 @@ async fn main() { let app = Router::new() .route("/", get(graphql_playground).post(graphql_handler)) .route("/ws", GraphQLSubscription::new(schema.clone())) - .layer(AddExtensionLayer::new(schema)); + .layer(Extension(schema)); println!("Playground: http://localhost:8000"); diff --git a/axum/upload/src/main.rs b/axum/upload/src/main.rs index 6eaf2c8..b6644e1 100644 --- a/axum/upload/src/main.rs +++ b/axum/upload/src/main.rs @@ -4,7 +4,7 @@ use async_graphql_axum::{GraphQLRequest, GraphQLResponse}; use axum::extract::Extension; use axum::response::{Html, IntoResponse}; use axum::routing::get; -use axum::{AddExtensionLayer, Router}; +use axum::Router; use files::{FilesSchema, MutationRoot, QueryRoot, Storage}; use hyper::{Method, Server}; use tower_http::cors::{CorsLayer, Origin}; @@ -27,7 +27,7 @@ async fn main() { let app = Router::new() .route("/", get(graphql_playground).post(graphql_handler)) - .layer(AddExtensionLayer::new(schema)) + .layer(Extension(schema)) .layer( CorsLayer::new() .allow_origin(Origin::predicate(|_, _| true)) From 6a63808523f7e4995f9111a3497f06921cd3b11b Mon Sep 17 00:00:00 2001 From: Sunli Date: Tue, 22 Mar 2022 11:30:41 +0800 Subject: [PATCH 018/102] Rustfmt --- axum/subscription/src/main.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/axum/subscription/src/main.rs b/axum/subscription/src/main.rs index e3ccc8a..c418958 100644 --- a/axum/subscription/src/main.rs +++ b/axum/subscription/src/main.rs @@ -6,10 +6,7 @@ use axum::routing::get; use axum::{extract::Extension, Router, Server}; use books::{BooksSchema, MutationRoot, QueryRoot, Storage, SubscriptionRoot}; -async fn graphql_handler( - schema: Extension, - req: GraphQLRequest, -) -> GraphQLResponse { +async fn graphql_handler(schema: Extension, req: GraphQLRequest) -> GraphQLResponse { schema.execute(req.into_inner()).await.into() } From a24e7cb9120aeb3234a647577174096746d32da9 Mon Sep 17 00:00:00 2001 From: Jake Chvatal Date: Sun, 27 Mar 2022 18:23:25 -0400 Subject: [PATCH 019/102] Update star wars example to reflect documentation The episode name is described as optional but it's actually required; this makes it optional and returns the hero of the whole saga if the episode is omitted! --- models/starwars/src/model.rs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/models/starwars/src/model.rs b/models/starwars/src/model.rs index 2de9b28..db7770b 100644 --- a/models/starwars/src/model.rs +++ b/models/starwars/src/model.rs @@ -112,13 +112,20 @@ impl QueryRoot { #[graphql( desc = "If omitted, returns the hero of the whole saga. If provided, returns the hero of that particular episode." )] - episode: Episode, + episode: Option, ) -> Character<'a> { let star_wars = ctx.data_unchecked::(); - if episode == Episode::Empire { - Human(star_wars.chars.get(star_wars.luke).unwrap()).into() - } else { - Droid(star_wars.chars.get(star_wars.artoo).unwrap()).into() + match episode { + Some(episode_name) => { + if episode_name == Episode::Empire { + Human(star_wars.chars.get(star_wars.luke).unwrap()).into() + } else { + Droid(star_wars.chars.get(star_wars.artoo).unwrap()).into() + } + } + None => { + Human(star_wars.chars.get(star_wars.luke).unwrap()).into() + } } } From 84dc7d28cba1c73c230ab1e9028e581eb70034c2 Mon Sep 17 00:00:00 2001 From: Calin Gavriliuc <13826789+alisenai@users.noreply.github.com> Date: Wed, 6 Apr 2022 22:40:00 -0700 Subject: [PATCH 020/102] Update Axum integration to Axum 0.5.1 --- axum/starwars/Cargo.toml | 2 +- axum/subscription/Cargo.toml | 2 +- axum/upload/Cargo.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/axum/starwars/Cargo.toml b/axum/starwars/Cargo.toml index f85a9a3..123936f 100644 --- a/axum/starwars/Cargo.toml +++ b/axum/starwars/Cargo.toml @@ -9,4 +9,4 @@ async-graphql-axum = { path = "../../../integrations/axum" } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } starwars = { path = "../../models/starwars" } hyper = "0.14" -axum = { version = "0.4", features = ["headers"] } +axum = { version = "0.5.1", features = ["headers"] } diff --git a/axum/subscription/Cargo.toml b/axum/subscription/Cargo.toml index 80f2af1..f2dc3dc 100644 --- a/axum/subscription/Cargo.toml +++ b/axum/subscription/Cargo.toml @@ -9,4 +9,4 @@ async-graphql-axum = { path = "../../../integrations/axum" } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } books = { path = "../../models/books" } hyper = "0.14" -axum = { version = "0.4", features = ["ws", "headers"] } +axum = { version = "0.5.1", features = ["ws", "headers"] } diff --git a/axum/upload/Cargo.toml b/axum/upload/Cargo.toml index 29113d6..3f821e3 100644 --- a/axum/upload/Cargo.toml +++ b/axum/upload/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-axum = { path = "../../../integrations/axum" } -axum = "0.4" +axum = "0.5.1" files = { path = "../../models/files" } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } hyper = "0.14" From ffb8cb9518e0f23ce17f171c957d3f7948bb1e00 Mon Sep 17 00:00:00 2001 From: Sunli Date: Sat, 9 Apr 2022 08:19:39 +0800 Subject: [PATCH 021/102] Rustfmt --- models/starwars/src/model.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/models/starwars/src/model.rs b/models/starwars/src/model.rs index db7770b..570f63e 100644 --- a/models/starwars/src/model.rs +++ b/models/starwars/src/model.rs @@ -123,9 +123,7 @@ impl QueryRoot { Droid(star_wars.chars.get(star_wars.artoo).unwrap()).into() } } - None => { - Human(star_wars.chars.get(star_wars.luke).unwrap()).into() - } + None => Human(star_wars.chars.get(star_wars.luke).unwrap()).into(), } } From c98cc26fd862e942fe2a911a55aa5ce12941cf5e Mon Sep 17 00:00:00 2001 From: Sunli Date: Sun, 1 May 2022 10:02:39 +0800 Subject: [PATCH 022/102] Rustfmt --- .rustfmt.toml | 12 ++++++++++++ actix-web/error-extensions/src/main.rs | 9 ++++----- actix-web/starwars/src/main.rs | 9 +++++---- actix-web/subscription/src/main.rs | 9 +++++---- actix-web/token-from-header/src/main.rs | 11 +++++++---- actix-web/upload/src/main.rs | 9 +++++---- axum/starwars/src/main.rs | 16 ++++++++++------ axum/subscription/src/main.rs | 15 ++++++++++----- axum/upload/src/main.rs | 16 ++++++++++------ federation/federation-accounts/src/main.rs | 3 ++- federation/federation-products/src/main.rs | 3 ++- federation/federation-reviews/src/main.rs | 3 ++- models/books/src/lib.rs | 7 +++---- models/books/src/simple_broker.rs | 14 ++++++++------ models/starwars/src/lib.rs | 6 +++--- models/starwars/src/model.rs | 7 +++++-- poem/starwars/src/main.rs | 10 +++++----- poem/subscription-redis/src/main.rs | 10 +++++----- poem/subscription/src/main.rs | 10 +++++----- poem/token-from-header/src/main.rs | 17 +++++++++++------ poem/upload/src/main.rs | 17 +++++++++++------ tide/dataloader-postgres/src/main.rs | 16 +++++++++------- tide/dataloader/src/main.rs | 15 +++++++++------ tide/starwars/src/main.rs | 15 ++++++++++----- tide/subscription/src/main.rs | 9 +++++---- warp/starwars/src/main.rs | 9 ++++++--- warp/subscription/src/main.rs | 9 ++++++--- warp/token-from-header/src/main.rs | 9 +++++---- 28 files changed, 180 insertions(+), 115 deletions(-) create mode 100644 .rustfmt.toml diff --git a/.rustfmt.toml b/.rustfmt.toml new file mode 100644 index 0000000..066a39d --- /dev/null +++ b/.rustfmt.toml @@ -0,0 +1,12 @@ +edition = "2021" +newline_style = "Unix" +# comments +normalize_comments = true +wrap_comments = true +format_code_in_doc_comments = true +# imports +imports_granularity = "Crate" +group_imports = "StdExternalCrate" +# report +#report_fixme="Unnumbered" +#report_todo="Unnumbered" diff --git a/actix-web/error-extensions/src/main.rs b/actix-web/error-extensions/src/main.rs index d1596ff..d7cb8e8 100644 --- a/actix-web/error-extensions/src/main.rs +++ b/actix-web/error-extensions/src/main.rs @@ -1,10 +1,9 @@ #[macro_use] extern crate thiserror; -use actix_web::web::Data; -use actix_web::{guard, web, App, HttpResponse, HttpServer}; -use async_graphql::http::{playground_source, GraphQLPlaygroundConfig}; +use actix_web::{guard, web, web::Data, App, HttpResponse, HttpServer}; use async_graphql::{ + http::{playground_source, GraphQLPlaygroundConfig}, EmptyMutation, EmptySubscription, ErrorExtensions, FieldError, FieldResult, Object, ResultExt, Schema, }; @@ -49,8 +48,8 @@ impl QueryRoot { .map_err(|e: std::num::ParseIntError| e.extend_with(|_, e| e.set("code", 404)))?) } - // THIS does unfortunately NOT work because ErrorExtensions is implemented for &E and not E. - // Which is necessary for the overwrite by the user. + // THIS does unfortunately NOT work because ErrorExtensions is implemented for + // &E and not E. Which is necessary for the overwrite by the user. // async fn parse_with_extensions_result(&self) -> FieldResult { // Ok("234a".parse().extend_err(|_| json!({"code": 404}))?) diff --git a/actix-web/starwars/src/main.rs b/actix-web/starwars/src/main.rs index 4ef64f1..96bbe11 100644 --- a/actix-web/starwars/src/main.rs +++ b/actix-web/starwars/src/main.rs @@ -1,7 +1,8 @@ -use actix_web::web::Data; -use actix_web::{guard, web, App, HttpResponse, HttpServer, Result}; -use async_graphql::http::{playground_source, GraphQLPlaygroundConfig}; -use async_graphql::{EmptyMutation, EmptySubscription, Schema}; +use actix_web::{guard, web, web::Data, App, HttpResponse, HttpServer, Result}; +use async_graphql::{ + http::{playground_source, GraphQLPlaygroundConfig}, + EmptyMutation, EmptySubscription, Schema, +}; use async_graphql_actix_web::{GraphQLRequest, GraphQLResponse}; use starwars::{QueryRoot, StarWars, StarWarsSchema}; diff --git a/actix-web/subscription/src/main.rs b/actix-web/subscription/src/main.rs index e0f4447..3d17fcb 100644 --- a/actix-web/subscription/src/main.rs +++ b/actix-web/subscription/src/main.rs @@ -1,7 +1,8 @@ -use actix_web::web::Data; -use actix_web::{guard, web, App, HttpRequest, HttpResponse, HttpServer, Result}; -use async_graphql::http::{playground_source, GraphQLPlaygroundConfig}; -use async_graphql::Schema; +use actix_web::{guard, web, web::Data, App, HttpRequest, HttpResponse, HttpServer, Result}; +use async_graphql::{ + http::{playground_source, GraphQLPlaygroundConfig}, + Schema, +}; use async_graphql_actix_web::{GraphQLRequest, GraphQLResponse, GraphQLSubscription}; use books::{BooksSchema, MutationRoot, QueryRoot, Storage, SubscriptionRoot}; diff --git a/actix-web/token-from-header/src/main.rs b/actix-web/token-from-header/src/main.rs index 06c4d0f..ca71a30 100644 --- a/actix-web/token-from-header/src/main.rs +++ b/actix-web/token-from-header/src/main.rs @@ -1,7 +1,10 @@ -use actix_web::http::header::HeaderMap; -use actix_web::{guard, web, App, HttpRequest, HttpResponse, HttpServer, Result}; -use async_graphql::http::{playground_source, GraphQLPlaygroundConfig}; -use async_graphql::{Data, EmptyMutation, Schema}; +use actix_web::{ + guard, http::header::HeaderMap, web, App, HttpRequest, HttpResponse, HttpServer, Result, +}; +use async_graphql::{ + http::{playground_source, GraphQLPlaygroundConfig}, + Data, EmptyMutation, Schema, +}; use async_graphql_actix_web::{GraphQLRequest, GraphQLResponse, GraphQLSubscription}; use token::{on_connection_init, QueryRoot, SubscriptionRoot, Token, TokenSchema}; diff --git a/actix-web/upload/src/main.rs b/actix-web/upload/src/main.rs index 2567ccf..fc6f09d 100644 --- a/actix-web/upload/src/main.rs +++ b/actix-web/upload/src/main.rs @@ -1,7 +1,8 @@ -use actix_web::web::Data; -use actix_web::{guard, web, App, HttpResponse, HttpServer}; -use async_graphql::http::{playground_source, GraphQLPlaygroundConfig, MultipartOptions}; -use async_graphql::{EmptySubscription, Schema}; +use actix_web::{guard, web, web::Data, App, HttpResponse, HttpServer}; +use async_graphql::{ + http::{playground_source, GraphQLPlaygroundConfig, MultipartOptions}, + EmptySubscription, Schema, +}; use async_graphql_actix_web::{GraphQLRequest, GraphQLResponse}; use files::{FilesSchema, MutationRoot, QueryRoot, Storage}; diff --git a/axum/starwars/src/main.rs b/axum/starwars/src/main.rs index 137c60a..d97ba30 100644 --- a/axum/starwars/src/main.rs +++ b/axum/starwars/src/main.rs @@ -1,10 +1,14 @@ -use async_graphql::http::{playground_source, GraphQLPlaygroundConfig}; -use async_graphql::{EmptyMutation, EmptySubscription, Schema}; +use async_graphql::{ + http::{playground_source, GraphQLPlaygroundConfig}, + EmptyMutation, EmptySubscription, Schema, +}; use async_graphql_axum::{GraphQLRequest, GraphQLResponse}; -use axum::extract::Extension; -use axum::response::{self, IntoResponse}; -use axum::routing::get; -use axum::{Router, Server}; +use axum::{ + extract::Extension, + response::{self, IntoResponse}, + routing::get, + Router, Server, +}; use starwars::{QueryRoot, StarWars, StarWarsSchema}; async fn graphql_handler( diff --git a/axum/subscription/src/main.rs b/axum/subscription/src/main.rs index c418958..d3bbaed 100644 --- a/axum/subscription/src/main.rs +++ b/axum/subscription/src/main.rs @@ -1,9 +1,14 @@ -use async_graphql::http::{playground_source, GraphQLPlaygroundConfig}; -use async_graphql::Schema; +use async_graphql::{ + http::{playground_source, GraphQLPlaygroundConfig}, + Schema, +}; use async_graphql_axum::{GraphQLRequest, GraphQLResponse, GraphQLSubscription}; -use axum::response::{self, IntoResponse}; -use axum::routing::get; -use axum::{extract::Extension, Router, Server}; +use axum::{ + extract::Extension, + response::{self, IntoResponse}, + routing::get, + Router, Server, +}; use books::{BooksSchema, MutationRoot, QueryRoot, Storage, SubscriptionRoot}; async fn graphql_handler(schema: Extension, req: GraphQLRequest) -> GraphQLResponse { diff --git a/axum/upload/src/main.rs b/axum/upload/src/main.rs index b6644e1..f928fb5 100644 --- a/axum/upload/src/main.rs +++ b/axum/upload/src/main.rs @@ -1,10 +1,14 @@ -use async_graphql::http::{playground_source, GraphQLPlaygroundConfig}; -use async_graphql::{EmptySubscription, Schema}; +use async_graphql::{ + http::{playground_source, GraphQLPlaygroundConfig}, + EmptySubscription, Schema, +}; use async_graphql_axum::{GraphQLRequest, GraphQLResponse}; -use axum::extract::Extension; -use axum::response::{Html, IntoResponse}; -use axum::routing::get; -use axum::Router; +use axum::{ + extract::Extension, + response::{Html, IntoResponse}, + routing::get, + Router, +}; use files::{FilesSchema, MutationRoot, QueryRoot, Storage}; use hyper::{Method, Server}; use tower_http::cors::{CorsLayer, Origin}; diff --git a/federation/federation-accounts/src/main.rs b/federation/federation-accounts/src/main.rs index b902d54..0779bf1 100644 --- a/federation/federation-accounts/src/main.rs +++ b/federation/federation-accounts/src/main.rs @@ -1,6 +1,7 @@ +use std::convert::Infallible; + use async_graphql::{EmptyMutation, EmptySubscription, Object, Schema, SimpleObject, ID}; use async_graphql_warp::graphql; -use std::convert::Infallible; use warp::{Filter, Reply}; #[derive(SimpleObject)] diff --git a/federation/federation-products/src/main.rs b/federation/federation-products/src/main.rs index c452b96..54454f6 100644 --- a/federation/federation-products/src/main.rs +++ b/federation/federation-products/src/main.rs @@ -1,6 +1,7 @@ +use std::convert::Infallible; + use async_graphql::{Context, EmptyMutation, EmptySubscription, Object, Schema, SimpleObject}; use async_graphql_warp::graphql; -use std::convert::Infallible; use warp::{Filter, Reply}; #[derive(SimpleObject)] diff --git a/federation/federation-reviews/src/main.rs b/federation/federation-reviews/src/main.rs index f85a1ac..f6298da 100644 --- a/federation/federation-reviews/src/main.rs +++ b/federation/federation-reviews/src/main.rs @@ -1,6 +1,7 @@ +use std::convert::Infallible; + use async_graphql::{Context, EmptyMutation, EmptySubscription, Object, Schema, SimpleObject, ID}; use async_graphql_warp::graphql; -use std::convert::Infallible; use warp::{Filter, Reply}; struct User { diff --git a/models/books/src/lib.rs b/models/books/src/lib.rs index 0c57827..c364597 100644 --- a/models/books/src/lib.rs +++ b/models/books/src/lib.rs @@ -1,12 +1,11 @@ mod simple_broker; +use std::{sync::Arc, time::Duration}; + use async_graphql::{Context, Enum, Object, Result, Schema, Subscription, ID}; -use futures_util::lock::Mutex; -use futures_util::{Stream, StreamExt}; +use futures_util::{lock::Mutex, Stream, StreamExt}; use simple_broker::SimpleBroker; use slab::Slab; -use std::sync::Arc; -use std::time::Duration; pub type BooksSchema = Schema; diff --git a/models/books/src/simple_broker.rs b/models/books/src/simple_broker.rs index 4615137..6b23e70 100644 --- a/models/books/src/simple_broker.rs +++ b/models/books/src/simple_broker.rs @@ -1,9 +1,11 @@ -use std::any::{Any, TypeId}; -use std::collections::HashMap; -use std::marker::PhantomData; -use std::pin::Pin; -use std::sync::Mutex; -use std::task::{Context, Poll}; +use std::{ + any::{Any, TypeId}, + collections::HashMap, + marker::PhantomData, + pin::Pin, + sync::Mutex, + task::{Context, Poll}, +}; use futures_channel::mpsc::{self, UnboundedReceiver, UnboundedSender}; use futures_util::{Stream, StreamExt}; diff --git a/models/starwars/src/lib.rs b/models/starwars/src/lib.rs index ecd29ab..646f43f 100644 --- a/models/starwars/src/lib.rs +++ b/models/starwars/src/lib.rs @@ -1,11 +1,11 @@ mod model; -use async_graphql::{EmptyMutation, EmptySubscription, Schema}; -use model::Episode; -use slab::Slab; use std::collections::HashMap; +use async_graphql::{EmptyMutation, EmptySubscription, Schema}; +use model::Episode; pub use model::QueryRoot; +use slab::Slab; pub type StarWarsSchema = Schema; pub struct StarWarsChar { diff --git a/models/starwars/src/model.rs b/models/starwars/src/model.rs index 570f63e..800200a 100644 --- a/models/starwars/src/model.rs +++ b/models/starwars/src/model.rs @@ -1,9 +1,12 @@ #![allow(clippy::needless_lifetimes)] +use async_graphql::{ + connection::{query, Connection, Edge, EmptyFields}, + Context, Enum, Error, Interface, Object, Result, +}; + use super::StarWars; use crate::StarWarsChar; -use async_graphql::connection::{query, Connection, Edge, EmptyFields}; -use async_graphql::{Context, Enum, Error, Interface, Object, Result}; /// One of the films in the Star Wars Trilogy #[derive(Enum, Copy, Clone, Eq, PartialEq)] diff --git a/poem/starwars/src/main.rs b/poem/starwars/src/main.rs index 914911e..22585a5 100644 --- a/poem/starwars/src/main.rs +++ b/poem/starwars/src/main.rs @@ -1,9 +1,9 @@ -use async_graphql::http::{playground_source, GraphQLPlaygroundConfig}; -use async_graphql::{EmptyMutation, EmptySubscription, Schema}; +use async_graphql::{ + http::{playground_source, GraphQLPlaygroundConfig}, + EmptyMutation, EmptySubscription, Schema, +}; use async_graphql_poem::GraphQL; -use poem::listener::TcpListener; -use poem::web::Html; -use poem::{get, handler, IntoResponse, Route, Server}; +use poem::{get, handler, listener::TcpListener, web::Html, IntoResponse, Route, Server}; use starwars::{QueryRoot, StarWars}; #[handler] diff --git a/poem/subscription-redis/src/main.rs b/poem/subscription-redis/src/main.rs index a4ccff1..e788a18 100644 --- a/poem/subscription-redis/src/main.rs +++ b/poem/subscription-redis/src/main.rs @@ -1,10 +1,10 @@ -use async_graphql::http::{playground_source, GraphQLPlaygroundConfig}; -use async_graphql::{Context, Object, Result, Schema, Subscription}; +use async_graphql::{ + http::{playground_source, GraphQLPlaygroundConfig}, + Context, Object, Result, Schema, Subscription, +}; use async_graphql_poem::{GraphQL, GraphQLSubscription}; use futures_util::{Stream, StreamExt}; -use poem::listener::TcpListener; -use poem::web::Html; -use poem::{get, handler, IntoResponse, Route, Server}; +use poem::{get, handler, listener::TcpListener, web::Html, IntoResponse, Route, Server}; use redis::{AsyncCommands, Client}; struct QueryRoot; diff --git a/poem/subscription/src/main.rs b/poem/subscription/src/main.rs index b33557c..2f3a0ed 100644 --- a/poem/subscription/src/main.rs +++ b/poem/subscription/src/main.rs @@ -1,10 +1,10 @@ -use async_graphql::http::{playground_source, GraphQLPlaygroundConfig}; -use async_graphql::Schema; +use async_graphql::{ + http::{playground_source, GraphQLPlaygroundConfig}, + Schema, +}; use async_graphql_poem::{GraphQL, GraphQLSubscription}; use books::{MutationRoot, QueryRoot, Storage, SubscriptionRoot}; -use poem::listener::TcpListener; -use poem::web::Html; -use poem::{get, handler, IntoResponse, Route, Server}; +use poem::{get, handler, listener::TcpListener, web::Html, IntoResponse, Route, Server}; #[handler] async fn graphql_playground() -> impl IntoResponse { diff --git a/poem/token-from-header/src/main.rs b/poem/token-from-header/src/main.rs index dada52d..7bf83a7 100644 --- a/poem/token-from-header/src/main.rs +++ b/poem/token-from-header/src/main.rs @@ -1,10 +1,15 @@ -use async_graphql::http::{playground_source, GraphQLPlaygroundConfig, ALL_WEBSOCKET_PROTOCOLS}; -use async_graphql::{EmptyMutation, Schema}; +use async_graphql::{ + http::{playground_source, GraphQLPlaygroundConfig, ALL_WEBSOCKET_PROTOCOLS}, + EmptyMutation, Schema, +}; use async_graphql_poem::{GraphQLProtocol, GraphQLRequest, GraphQLResponse, GraphQLWebSocket}; -use poem::http::HeaderMap; -use poem::listener::TcpListener; -use poem::web::{websocket::WebSocket, Data, Html}; -use poem::{get, handler, EndpointExt, IntoResponse, Route, Server}; +use poem::{ + get, handler, + http::HeaderMap, + listener::TcpListener, + web::{websocket::WebSocket, Data, Html}, + EndpointExt, IntoResponse, Route, Server, +}; use token::{on_connection_init, QueryRoot, SubscriptionRoot, Token, TokenSchema}; fn get_token_from_headers(headers: &HeaderMap) -> Option { diff --git a/poem/upload/src/main.rs b/poem/upload/src/main.rs index 96342c6..ef43795 100644 --- a/poem/upload/src/main.rs +++ b/poem/upload/src/main.rs @@ -1,11 +1,16 @@ -use async_graphql::http::{playground_source, GraphQLPlaygroundConfig}; -use async_graphql::{EmptySubscription, Schema}; +use async_graphql::{ + http::{playground_source, GraphQLPlaygroundConfig}, + EmptySubscription, Schema, +}; use async_graphql_poem::{GraphQLRequest, GraphQLResponse}; use files::{FilesSchema, MutationRoot, QueryRoot, Storage}; -use poem::listener::TcpListener; -use poem::middleware::Cors; -use poem::web::{Data, Html}; -use poem::{get, handler, EndpointExt, IntoResponse, Route, Server}; +use poem::{ + get, handler, + listener::TcpListener, + middleware::Cors, + web::{Data, Html}, + EndpointExt, IntoResponse, Route, Server, +}; #[handler] async fn index(schema: Data<&FilesSchema>, req: GraphQLRequest) -> GraphQLResponse { diff --git a/tide/dataloader-postgres/src/main.rs b/tide/dataloader-postgres/src/main.rs index 0f5b6f9..feb801a 100644 --- a/tide/dataloader-postgres/src/main.rs +++ b/tide/dataloader-postgres/src/main.rs @@ -1,15 +1,15 @@ -use async_graphql::dataloader::{DataLoader, Loader}; -use async_graphql::futures_util::TryStreamExt; -use async_graphql::http::{playground_source, GraphQLPlaygroundConfig}; +use std::{collections::HashMap, env}; + use async_graphql::{ + dataloader::{DataLoader, Loader}, + futures_util::TryStreamExt, + http::{playground_source, GraphQLPlaygroundConfig}, Context, EmptyMutation, EmptySubscription, FieldError, Object, Result, Schema, SimpleObject, }; use async_std::task; use async_trait::async_trait; use itertools::Itertools; use sqlx::{Pool, Postgres}; -use std::collections::HashMap; -use std::env; use tide::{http::mime, Body, Response, StatusCode}; #[derive(sqlx::FromRow, Clone, SimpleObject)] @@ -121,10 +121,12 @@ async fn run() -> Result<()> { #[cfg(test)] mod tests { - use super::*; + use std::time::Duration; + use async_std::prelude::*; use serde_json::{json, Value}; - use std::time::Duration; + + use super::*; #[test] fn sample() -> Result<()> { diff --git a/tide/dataloader/src/main.rs b/tide/dataloader/src/main.rs index b8aa3fb..b9d58fb 100644 --- a/tide/dataloader/src/main.rs +++ b/tide/dataloader/src/main.rs @@ -1,14 +1,15 @@ -use async_graphql::dataloader::{DataLoader, Loader}; -use async_graphql::futures_util::TryStreamExt; -use async_graphql::http::{playground_source, GraphQLPlaygroundConfig}; +use std::collections::HashMap; + use async_graphql::{ + dataloader::{DataLoader, Loader}, + futures_util::TryStreamExt, + http::{playground_source, GraphQLPlaygroundConfig}, Context, EmptyMutation, EmptySubscription, FieldError, Object, Result, Schema, SimpleObject, }; use async_std::task; use async_trait::async_trait; use itertools::Itertools; use sqlx::{Pool, Sqlite}; -use std::collections::HashMap; use tide::{http::mime, Body, Response, StatusCode}; #[derive(sqlx::FromRow, Clone, SimpleObject)] @@ -119,10 +120,12 @@ async fn run() -> Result<()> { #[cfg(test)] mod tests { - use super::*; + use std::time::Duration; + use async_std::prelude::*; use serde_json::{json, Value}; - use std::time::Duration; + + use super::*; #[test] fn sample() -> Result<()> { diff --git a/tide/starwars/src/main.rs b/tide/starwars/src/main.rs index 6ba431b..44ad815 100644 --- a/tide/starwars/src/main.rs +++ b/tide/starwars/src/main.rs @@ -1,8 +1,11 @@ -use async_graphql::http::{playground_source, GraphQLPlaygroundConfig}; -use async_graphql::{EmptyMutation, EmptySubscription, Schema}; +use std::env; + +use async_graphql::{ + http::{playground_source, GraphQLPlaygroundConfig}, + EmptyMutation, EmptySubscription, Schema, +}; use async_std::task; use starwars::{QueryRoot, StarWars}; -use std::env; use tide::{http::mime, Body, Response, StatusCode}; type Result = std::result::Result>; @@ -40,10 +43,12 @@ async fn run() -> Result<()> { #[cfg(test)] mod tests { - use super::*; + use std::time::Duration; + use async_std::prelude::*; use serde_json::json; - use std::time::Duration; + + use super::*; #[test] fn sample() -> Result<()> { diff --git a/tide/subscription/src/main.rs b/tide/subscription/src/main.rs index 09f4812..8d6cc5a 100644 --- a/tide/subscription/src/main.rs +++ b/tide/subscription/src/main.rs @@ -1,11 +1,12 @@ use std::env; -use async_graphql::http::{playground_source, GraphQLPlaygroundConfig}; -use async_graphql::Schema; +use async_graphql::{ + http::{playground_source, GraphQLPlaygroundConfig}, + Schema, +}; use async_std::task; use books::{MutationRoot, QueryRoot, Storage, SubscriptionRoot}; -use tide::http::mime; -use tide::{Body, Response, StatusCode}; +use tide::{http::mime, Body, Response, StatusCode}; type Result = std::result::Result>; diff --git a/warp/starwars/src/main.rs b/warp/starwars/src/main.rs index 9a524d3..ba2e2d4 100644 --- a/warp/starwars/src/main.rs +++ b/warp/starwars/src/main.rs @@ -1,9 +1,12 @@ -use async_graphql::http::{playground_source, GraphQLPlaygroundConfig}; -use async_graphql::{EmptyMutation, EmptySubscription, Schema}; +use std::convert::Infallible; + +use async_graphql::{ + http::{playground_source, GraphQLPlaygroundConfig}, + EmptyMutation, EmptySubscription, Schema, +}; use async_graphql_warp::{GraphQLBadRequest, GraphQLResponse}; use http::StatusCode; use starwars::{QueryRoot, StarWars}; -use std::convert::Infallible; use warp::{http::Response as HttpResponse, Filter, Rejection}; #[tokio::main] diff --git a/warp/subscription/src/main.rs b/warp/subscription/src/main.rs index 1a8a5c0..2d8ab40 100644 --- a/warp/subscription/src/main.rs +++ b/warp/subscription/src/main.rs @@ -1,8 +1,11 @@ -use async_graphql::http::{playground_source, GraphQLPlaygroundConfig}; -use async_graphql::Schema; +use std::convert::Infallible; + +use async_graphql::{ + http::{playground_source, GraphQLPlaygroundConfig}, + Schema, +}; use async_graphql_warp::{graphql_subscription, GraphQLResponse}; use books::{MutationRoot, QueryRoot, Storage, SubscriptionRoot}; -use std::convert::Infallible; use warp::{http::Response as HttpResponse, Filter}; #[tokio::main] diff --git a/warp/token-from-header/src/main.rs b/warp/token-from-header/src/main.rs index f304863..25841ba 100644 --- a/warp/token-from-header/src/main.rs +++ b/warp/token-from-header/src/main.rs @@ -1,11 +1,12 @@ use std::convert::Infallible; -use async_graphql::http::{playground_source, GraphQLPlaygroundConfig}; -use async_graphql::{Data, EmptyMutation, Schema}; +use async_graphql::{ + http::{playground_source, GraphQLPlaygroundConfig}, + Data, EmptyMutation, Schema, +}; use async_graphql_warp::{graphql_protocol, GraphQLResponse, GraphQLWebSocket}; use token::{on_connection_init, QueryRoot, SubscriptionRoot, Token}; -use warp::ws::Ws; -use warp::{http::Response as HttpResponse, Filter}; +use warp::{http::Response as HttpResponse, ws::Ws, Filter}; #[tokio::main] async fn main() { From 22bc2e58689a2d5d76fbea687f008d134d45e660 Mon Sep 17 00:00:00 2001 From: Sunli Date: Sun, 1 May 2022 10:43:05 +0800 Subject: [PATCH 023/102] Update starwars example --- models/starwars/src/model.rs | 47 +++++++++++++++++++++++++----------- 1 file changed, 33 insertions(+), 14 deletions(-) diff --git a/models/starwars/src/model.rs b/models/starwars/src/model.rs index 800200a..056428f 100644 --- a/models/starwars/src/model.rs +++ b/models/starwars/src/model.rs @@ -1,8 +1,8 @@ #![allow(clippy::needless_lifetimes)] use async_graphql::{ - connection::{query, Connection, Edge, EmptyFields}, - Context, Enum, Error, Interface, Object, Result, + connection::{query, Connection, DefaultConnectionName, DefaultEdgeName, Edge, EmptyFields}, + Context, Enum, Error, Interface, Object, OutputType, Result, }; use super::StarWars; @@ -145,11 +145,18 @@ impl QueryRoot { before: Option, first: Option, last: Option, - ) -> Result, EmptyFields, EmptyFields>> { + ) -> Result< + Connection< + DefaultConnectionName, + DefaultEdgeName, + usize, + Human<'a>, + EmptyFields, + EmptyFields, + >, + > { let humans = ctx.data_unchecked::().humans().to_vec(); - query_characters(after, before, first, last, &humans) - .await - .map(|conn| conn.map_node(Human)) + query_characters(after, before, first, last, &humans, Human).await } async fn droid<'a>( @@ -167,11 +174,18 @@ impl QueryRoot { before: Option, first: Option, last: Option, - ) -> Result, EmptyFields, EmptyFields>> { + ) -> Result< + Connection< + DefaultConnectionName, + DefaultEdgeName, + usize, + Droid<'a>, + EmptyFields, + EmptyFields, + >, + > { let droids = ctx.data_unchecked::().droids().to_vec(); - query_characters(after, before, first, last, &droids) - .await - .map(|conn| conn.map_node(Droid)) + query_characters(after, before, first, last, &droids, Droid).await } } @@ -187,13 +201,18 @@ pub enum Character<'a> { Droid(Droid<'a>), } -async fn query_characters<'a>( +async fn query_characters<'a, F, T>( after: Option, before: Option, first: Option, last: Option, characters: &[&'a StarWarsChar], -) -> Result> { + map_to: F, +) -> Result> +where + F: Fn(&'a StarWarsChar) -> T, + T: OutputType, +{ query( after, before, @@ -228,11 +247,11 @@ async fn query_characters<'a>( } let mut connection = Connection::new(start > 0, end < characters.len()); - connection.append( + connection.edges.extend( slice .iter() .enumerate() - .map(|(idx, item)| Edge::new(start + idx, *item)), + .map(|(idx, item)| Edge::new(start + idx, (map_to)(*item))), ); Ok::<_, Error>(connection) }, From d359d0ea3116326daf753f08233219530b8ec10b Mon Sep 17 00:00:00 2001 From: Sunli Date: Mon, 2 May 2022 16:20:20 +0800 Subject: [PATCH 024/102] Update model.rs --- models/starwars/src/model.rs | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/models/starwars/src/model.rs b/models/starwars/src/model.rs index 056428f..160bd72 100644 --- a/models/starwars/src/model.rs +++ b/models/starwars/src/model.rs @@ -1,7 +1,7 @@ #![allow(clippy::needless_lifetimes)] use async_graphql::{ - connection::{query, Connection, DefaultConnectionName, DefaultEdgeName, Edge, EmptyFields}, + connection::{query, Connection, Edge}, Context, Enum, Error, Interface, Object, OutputType, Result, }; @@ -145,16 +145,7 @@ impl QueryRoot { before: Option, first: Option, last: Option, - ) -> Result< - Connection< - DefaultConnectionName, - DefaultEdgeName, - usize, - Human<'a>, - EmptyFields, - EmptyFields, - >, - > { + ) -> Result>> { let humans = ctx.data_unchecked::().humans().to_vec(); query_characters(after, before, first, last, &humans, Human).await } @@ -174,16 +165,7 @@ impl QueryRoot { before: Option, first: Option, last: Option, - ) -> Result< - Connection< - DefaultConnectionName, - DefaultEdgeName, - usize, - Droid<'a>, - EmptyFields, - EmptyFields, - >, - > { + ) -> Result>> { let droids = ctx.data_unchecked::().droids().to_vec(); query_characters(after, before, first, last, &droids, Droid).await } @@ -208,7 +190,7 @@ async fn query_characters<'a, F, T>( last: Option, characters: &[&'a StarWarsChar], map_to: F, -) -> Result> +) -> Result> where F: Fn(&'a StarWarsChar) -> T, T: OutputType, From fa8fc5dde0e1f70dee67719eceecfc9ade250d1f Mon Sep 17 00:00:00 2001 From: sunli829 Date: Sat, 14 May 2022 16:41:00 +0800 Subject: [PATCH 025/102] Clippy clean --- actix-web/error-extensions/src/main.rs | 4 ++-- rocket/starwars/src/main.rs | 4 ++-- rocket/upload/src/main.rs | 4 ++-- tide/dataloader-postgres/src/main.rs | 5 ++--- tide/dataloader/src/main.rs | 5 ++--- 5 files changed, 10 insertions(+), 12 deletions(-) diff --git a/actix-web/error-extensions/src/main.rs b/actix-web/error-extensions/src/main.rs index d7cb8e8..109e1ad 100644 --- a/actix-web/error-extensions/src/main.rs +++ b/actix-web/error-extensions/src/main.rs @@ -43,9 +43,9 @@ impl QueryRoot { // Foreign types can be extended async fn parse_with_extensions(&self) -> FieldResult { - Ok("234a" + "234a" .parse() - .map_err(|e: std::num::ParseIntError| e.extend_with(|_, e| e.set("code", 404)))?) + .map_err(|e: std::num::ParseIntError| e.extend_with(|_, e| e.set("code", 404))) } // THIS does unfortunately NOT work because ErrorExtensions is implemented for diff --git a/rocket/starwars/src/main.rs b/rocket/starwars/src/main.rs index bc12efc..62ea48b 100644 --- a/rocket/starwars/src/main.rs +++ b/rocket/starwars/src/main.rs @@ -9,8 +9,8 @@ use starwars::{QueryRoot, StarWars}; pub type StarWarsSchema = Schema; #[rocket::get("/")] -fn graphql_playground() -> content::Html { - content::Html(playground_source(GraphQLPlaygroundConfig::new("/graphql"))) +fn graphql_playground() -> content::RawHtml { + content::RawHtml(playground_source(GraphQLPlaygroundConfig::new("/graphql"))) } #[rocket::get("/graphql?")] diff --git a/rocket/upload/src/main.rs b/rocket/upload/src/main.rs index aec7515..7bff954 100644 --- a/rocket/upload/src/main.rs +++ b/rocket/upload/src/main.rs @@ -9,8 +9,8 @@ use rocket::{response::content, routes, State}; pub type StarWarsSchema = Schema; #[rocket::get("/")] -fn graphql_playground() -> content::Html { - content::Html(playground_source(GraphQLPlaygroundConfig::new("/graphql"))) +fn graphql_playground() -> content::RawHtml { + content::RawHtml(playground_source(GraphQLPlaygroundConfig::new("/graphql"))) } #[rocket::get("/graphql?")] diff --git a/tide/dataloader-postgres/src/main.rs b/tide/dataloader-postgres/src/main.rs index feb801a..062c756 100644 --- a/tide/dataloader-postgres/src/main.rs +++ b/tide/dataloader-postgres/src/main.rs @@ -57,10 +57,9 @@ struct QueryRoot; impl QueryRoot { async fn book(&self, ctx: &Context<'_>, id: i32) -> Result> { println!("pre load book by id {:?}", id); - Ok(ctx - .data_unchecked::>() + ctx.data_unchecked::>() .load_one(id) - .await?) + .await } } diff --git a/tide/dataloader/src/main.rs b/tide/dataloader/src/main.rs index b9d58fb..4fbe437 100644 --- a/tide/dataloader/src/main.rs +++ b/tide/dataloader/src/main.rs @@ -57,10 +57,9 @@ struct QueryRoot; impl QueryRoot { async fn book(&self, ctx: &Context<'_>, id: i32) -> Result> { println!("pre load book by id {:?}", id); - Ok(ctx - .data_unchecked::>() + ctx.data_unchecked::>() .load_one(id) - .await?) + .await } } From caad01bb612085c2674a81b6bd8c4d39b1cd2891 Mon Sep 17 00:00:00 2001 From: Dan Bruder Date: Tue, 28 Jun 2022 20:59:22 -0400 Subject: [PATCH 026/102] Rc2 --- rocket/starwars/Cargo.toml | 2 +- rocket/upload/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rocket/starwars/Cargo.toml b/rocket/starwars/Cargo.toml index f38d2cc..a8234f6 100644 --- a/rocket/starwars/Cargo.toml +++ b/rocket/starwars/Cargo.toml @@ -7,5 +7,5 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-rocket = { path = "../../../integrations/rocket" } -rocket = { version = "0.5.0-rc.1", default-features = false } +rocket = { version = "0.5.0-rc.2", default-features = false } starwars = { path = "../../models/starwars" } diff --git a/rocket/upload/Cargo.toml b/rocket/upload/Cargo.toml index 9585689..a5eca42 100644 --- a/rocket/upload/Cargo.toml +++ b/rocket/upload/Cargo.toml @@ -7,5 +7,5 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-rocket = { path = "../../../integrations/rocket" } -rocket = { version = "0.5.0-rc.1", default-features = false } +rocket = { version = "0.5.0-rc.2", default-features = false } files = { path = "../../models/files" } From 3573b9caacb02802f0eae73ba5a5b123a94e0de4 Mon Sep 17 00:00:00 2001 From: Bram van Neerven Date: Mon, 8 Aug 2022 02:47:27 +0200 Subject: [PATCH 027/102] added axum-token-from-header example --- Cargo.toml | 1 + axum/token-from-header/Cargo.toml | 12 +++++ axum/token-from-header/src/main.rs | 75 ++++++++++++++++++++++++++++++ 3 files changed, 88 insertions(+) create mode 100644 axum/token-from-header/Cargo.toml create mode 100644 axum/token-from-header/src/main.rs diff --git a/Cargo.toml b/Cargo.toml index 35ef7f4..f092164 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,6 +31,7 @@ members = [ "axum/starwars", "axum/subscription", "axum/upload", + "axum/token-from-header", "tide/starwars", "tide/dataloader", diff --git a/axum/token-from-header/Cargo.toml b/axum/token-from-header/Cargo.toml new file mode 100644 index 0000000..5f490a7 --- /dev/null +++ b/axum/token-from-header/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "axum-token-from-header" +version = "0.1.0" +edition = "2021" + +[dependencies] +async-graphql = { path = "../../.." } +async-graphql-axum = { path = "../../../integrations/axum" } +tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } +token = { path = "../../models/token" } +hyper = "0.14" +axum = { version = "0.5.1", features = ["ws", "headers"] } diff --git a/axum/token-from-header/src/main.rs b/axum/token-from-header/src/main.rs new file mode 100644 index 0000000..a3fa327 --- /dev/null +++ b/axum/token-from-header/src/main.rs @@ -0,0 +1,75 @@ +use async_graphql::{ + http::{playground_source, GraphQLPlaygroundConfig, ALL_WEBSOCKET_PROTOCOLS}, + Data, EmptyMutation, Schema, +}; +use async_graphql_axum::{GraphQLProtocol, GraphQLRequest, GraphQLResponse, GraphQLWebSocket}; +use axum::{ + extract::{ws::WebSocketUpgrade, Extension}, + http::header::HeaderMap, + response::{Html, IntoResponse, Response}, + routing::get, + Router, Server, +}; +use token::{on_connection_init, QueryRoot, SubscriptionRoot, Token, TokenSchema}; + +async fn graphql_playground() -> impl IntoResponse { + Html(playground_source( + GraphQLPlaygroundConfig::new("/").subscription_endpoint("/ws"), + )) +} + +fn get_token_from_headers(headers: &HeaderMap) -> Option { + headers + .get("Token") + .and_then(|value| value.to_str().map(|s| Token(s.to_string())).ok()) +} + +async fn graphql_handler( + req: GraphQLRequest, + Extension(schema): Extension, + headers: HeaderMap, +) -> GraphQLResponse { + let mut req = req.into_inner(); + if let Some(token) = get_token_from_headers(&headers) { + req = req.data(token); + } + schema.execute(req).await.into() +} + +async fn graphql_ws_handler( + Extension(schema): Extension, + protocol: GraphQLProtocol, + websocket: WebSocketUpgrade, + headers: HeaderMap, +) -> Response { + let mut data = Data::default(); + if let Some(token) = get_token_from_headers(&headers) { + data.insert(token); + } + + websocket + .protocols(ALL_WEBSOCKET_PROTOCOLS) + .on_upgrade(move |stream| { + GraphQLWebSocket::new(stream, schema.clone(), protocol) + .with_data(data) + .on_connection_init(on_connection_init) + .serve() + }) +} + +#[tokio::main] +async fn main() { + let schema = Schema::new(QueryRoot, EmptyMutation, SubscriptionRoot); + + let app = Router::new() + .route("/", get(graphql_playground).post(graphql_handler)) + .route("/ws", get(graphql_ws_handler)) + .layer(Extension(schema)); + + println!("Playground: http://localhost:8000"); + + Server::bind(&"0.0.0.0:8000".parse().unwrap()) + .serve(app.into_make_service()) + .await + .unwrap(); +} From 71a789882c15c3d2446c7df59925e078a0402176 Mon Sep 17 00:00:00 2001 From: Bram van Neerven Date: Sun, 28 Aug 2022 17:19:28 +0200 Subject: [PATCH 028/102] updated poem examples --- poem/starwars/src/main.rs | 11 ++++++----- poem/subscription-redis/src/main.rs | 14 +++++++------- poem/subscription/src/main.rs | 14 +++++++------- poem/token-from-header/src/main.rs | 11 +++++++---- poem/upload/src/main.rs | 11 ++++++----- 5 files changed, 33 insertions(+), 28 deletions(-) diff --git a/poem/starwars/src/main.rs b/poem/starwars/src/main.rs index 22585a5..cbbb41e 100644 --- a/poem/starwars/src/main.rs +++ b/poem/starwars/src/main.rs @@ -1,14 +1,15 @@ -use async_graphql::{ - http::{playground_source, GraphQLPlaygroundConfig}, - EmptyMutation, EmptySubscription, Schema, -}; +use async_graphql::{http::GraphiQLSource, EmptyMutation, EmptySubscription, Schema}; use async_graphql_poem::GraphQL; use poem::{get, handler, listener::TcpListener, web::Html, IntoResponse, Route, Server}; use starwars::{QueryRoot, StarWars}; #[handler] async fn graphql_playground() -> impl IntoResponse { - Html(playground_source(GraphQLPlaygroundConfig::new("/"))) + Html( + GraphiQLSource::build() + .endpoint("http://localhost:8000") + .finish(), + ) } #[tokio::main] diff --git a/poem/subscription-redis/src/main.rs b/poem/subscription-redis/src/main.rs index e788a18..46d1d71 100644 --- a/poem/subscription-redis/src/main.rs +++ b/poem/subscription-redis/src/main.rs @@ -1,7 +1,4 @@ -use async_graphql::{ - http::{playground_source, GraphQLPlaygroundConfig}, - Context, Object, Result, Schema, Subscription, -}; +use async_graphql::{http::GraphiQLSource, Context, Object, Result, Schema, Subscription}; use async_graphql_poem::{GraphQL, GraphQLSubscription}; use futures_util::{Stream, StreamExt}; use poem::{get, handler, listener::TcpListener, web::Html, IntoResponse, Route, Server}; @@ -44,9 +41,12 @@ impl SubscriptionRoot { #[handler] async fn graphql_playground() -> impl IntoResponse { - Html(playground_source( - GraphQLPlaygroundConfig::new("/").subscription_endpoint("/ws"), - )) + Html( + GraphiQLSource::build() + .endpoint("http://localhost:8000") + .subscription_endpoint("ws://localhost:8000/ws") + .finish(), + ) } #[tokio::main] diff --git a/poem/subscription/src/main.rs b/poem/subscription/src/main.rs index 2f3a0ed..f480619 100644 --- a/poem/subscription/src/main.rs +++ b/poem/subscription/src/main.rs @@ -1,16 +1,16 @@ -use async_graphql::{ - http::{playground_source, GraphQLPlaygroundConfig}, - Schema, -}; +use async_graphql::{http::GraphiQLSource, Schema}; use async_graphql_poem::{GraphQL, GraphQLSubscription}; use books::{MutationRoot, QueryRoot, Storage, SubscriptionRoot}; use poem::{get, handler, listener::TcpListener, web::Html, IntoResponse, Route, Server}; #[handler] async fn graphql_playground() -> impl IntoResponse { - Html(playground_source( - GraphQLPlaygroundConfig::new("/").subscription_endpoint("/ws"), - )) + Html( + GraphiQLSource::build() + .endpoint("http://localhost:8000") + .subscription_endpoint("ws://localhost:8000/ws") + .finish(), + ) } #[tokio::main] diff --git a/poem/token-from-header/src/main.rs b/poem/token-from-header/src/main.rs index 7bf83a7..acfb18e 100644 --- a/poem/token-from-header/src/main.rs +++ b/poem/token-from-header/src/main.rs @@ -1,5 +1,5 @@ use async_graphql::{ - http::{playground_source, GraphQLPlaygroundConfig, ALL_WEBSOCKET_PROTOCOLS}, + http::{GraphiQLSource, ALL_WEBSOCKET_PROTOCOLS}, EmptyMutation, Schema, }; use async_graphql_poem::{GraphQLProtocol, GraphQLRequest, GraphQLResponse, GraphQLWebSocket}; @@ -20,9 +20,12 @@ fn get_token_from_headers(headers: &HeaderMap) -> Option { #[handler] async fn graphql_playground() -> impl IntoResponse { - Html(playground_source( - GraphQLPlaygroundConfig::new("/").subscription_endpoint("/ws"), - )) + Html( + GraphiQLSource::build() + .endpoint("http://localhost:8000") + .subscription_endpoint("ws://localhost:8000/ws") + .finish(), + ) } #[handler] diff --git a/poem/upload/src/main.rs b/poem/upload/src/main.rs index ef43795..b98ee29 100644 --- a/poem/upload/src/main.rs +++ b/poem/upload/src/main.rs @@ -1,7 +1,4 @@ -use async_graphql::{ - http::{playground_source, GraphQLPlaygroundConfig}, - EmptySubscription, Schema, -}; +use async_graphql::{http::GraphiQLSource, EmptySubscription, Schema}; use async_graphql_poem::{GraphQLRequest, GraphQLResponse}; use files::{FilesSchema, MutationRoot, QueryRoot, Storage}; use poem::{ @@ -19,7 +16,11 @@ async fn index(schema: Data<&FilesSchema>, req: GraphQLRequest) -> GraphQLRespon #[handler] async fn gql_playground() -> impl IntoResponse { - Html(playground_source(GraphQLPlaygroundConfig::new("/"))) + Html( + GraphiQLSource::build() + .endpoint("http://localhost:8000") + .finish(), + ) } #[tokio::main] From 8f920ae9538346036f3024c0d3ab6580ca5eb65c Mon Sep 17 00:00:00 2001 From: Bram van Neerven Date: Sun, 28 Aug 2022 17:28:45 +0200 Subject: [PATCH 029/102] updated actix-web examples --- actix-web/error-extensions/src/main.rs | 11 +++++++---- actix-web/starwars/src/main.rs | 12 ++++++------ actix-web/subscription/src/main.rs | 14 +++++++------- actix-web/token-from-header/src/main.rs | 14 +++++++------- actix-web/upload/src/main.rs | 8 ++++++-- 5 files changed, 33 insertions(+), 26 deletions(-) diff --git a/actix-web/error-extensions/src/main.rs b/actix-web/error-extensions/src/main.rs index 109e1ad..6c166f6 100644 --- a/actix-web/error-extensions/src/main.rs +++ b/actix-web/error-extensions/src/main.rs @@ -3,9 +3,8 @@ extern crate thiserror; use actix_web::{guard, web, web::Data, App, HttpResponse, HttpServer}; use async_graphql::{ - http::{playground_source, GraphQLPlaygroundConfig}, - EmptyMutation, EmptySubscription, ErrorExtensions, FieldError, FieldResult, Object, ResultExt, - Schema, + http::GraphiQLSource, EmptyMutation, EmptySubscription, ErrorExtensions, FieldError, + FieldResult, Object, ResultExt, Schema, }; use async_graphql_actix_web::{GraphQLRequest, GraphQLResponse}; @@ -102,7 +101,11 @@ async fn index( async fn gql_playgound() -> HttpResponse { HttpResponse::Ok() .content_type("text/html; charset=utf-8") - .body(playground_source(GraphQLPlaygroundConfig::new("/"))) + .body( + GraphiQLSource::build() + .endpoint("http://localhost:8000") + .finish(), + ) } #[actix_web::main] diff --git a/actix-web/starwars/src/main.rs b/actix-web/starwars/src/main.rs index 96bbe11..5955fbd 100644 --- a/actix-web/starwars/src/main.rs +++ b/actix-web/starwars/src/main.rs @@ -1,8 +1,5 @@ use actix_web::{guard, web, web::Data, App, HttpResponse, HttpServer, Result}; -use async_graphql::{ - http::{playground_source, GraphQLPlaygroundConfig}, - EmptyMutation, EmptySubscription, Schema, -}; +use async_graphql::{http::GraphiQLSource, EmptyMutation, EmptySubscription, Schema}; use async_graphql_actix_web::{GraphQLRequest, GraphQLResponse}; use starwars::{QueryRoot, StarWars, StarWarsSchema}; @@ -11,10 +8,13 @@ async fn index(schema: web::Data, req: GraphQLRequest) -> GraphQ } async fn index_playground() -> Result { - let source = playground_source(GraphQLPlaygroundConfig::new("/").subscription_endpoint("/")); Ok(HttpResponse::Ok() .content_type("text/html; charset=utf-8") - .body(source)) + .body( + GraphiQLSource::build() + .endpoint("http://localhost:8000") + .finish(), + )) } #[actix_web::main] diff --git a/actix-web/subscription/src/main.rs b/actix-web/subscription/src/main.rs index 3d17fcb..a71cbe2 100644 --- a/actix-web/subscription/src/main.rs +++ b/actix-web/subscription/src/main.rs @@ -1,8 +1,5 @@ use actix_web::{guard, web, web::Data, App, HttpRequest, HttpResponse, HttpServer, Result}; -use async_graphql::{ - http::{playground_source, GraphQLPlaygroundConfig}, - Schema, -}; +use async_graphql::{http::GraphiQLSource, Schema}; use async_graphql_actix_web::{GraphQLRequest, GraphQLResponse, GraphQLSubscription}; use books::{BooksSchema, MutationRoot, QueryRoot, Storage, SubscriptionRoot}; @@ -13,9 +10,12 @@ async fn index(schema: web::Data, req: GraphQLRequest) -> GraphQLRe async fn index_playground() -> Result { Ok(HttpResponse::Ok() .content_type("text/html; charset=utf-8") - .body(playground_source( - GraphQLPlaygroundConfig::new("/").subscription_endpoint("/"), - ))) + .body( + GraphiQLSource::build() + .endpoint("http://localhost:8000") + .subscription_endpoint("ws://localhost:8000/ws") + .finish(), + )) } async fn index_ws( diff --git a/actix-web/token-from-header/src/main.rs b/actix-web/token-from-header/src/main.rs index ca71a30..b54fd23 100644 --- a/actix-web/token-from-header/src/main.rs +++ b/actix-web/token-from-header/src/main.rs @@ -1,19 +1,19 @@ use actix_web::{ guard, http::header::HeaderMap, web, App, HttpRequest, HttpResponse, HttpServer, Result, }; -use async_graphql::{ - http::{playground_source, GraphQLPlaygroundConfig}, - Data, EmptyMutation, Schema, -}; +use async_graphql::{http::GraphiQLSource, Data, EmptyMutation, Schema}; use async_graphql_actix_web::{GraphQLRequest, GraphQLResponse, GraphQLSubscription}; use token::{on_connection_init, QueryRoot, SubscriptionRoot, Token, TokenSchema}; async fn gql_playground() -> HttpResponse { HttpResponse::Ok() .content_type("text/html; charset=utf-8") - .body(playground_source( - GraphQLPlaygroundConfig::new("/").subscription_endpoint("/ws"), - )) + .body( + GraphiQLSource::build() + .endpoint("http://localhost:8000") + .subscription_endpoint("ws://localhost:8000/ws") + .finish(), + ) } fn get_token_from_headers(headers: &HeaderMap) -> Option { diff --git a/actix-web/upload/src/main.rs b/actix-web/upload/src/main.rs index fc6f09d..270f05b 100644 --- a/actix-web/upload/src/main.rs +++ b/actix-web/upload/src/main.rs @@ -1,6 +1,6 @@ use actix_web::{guard, web, web::Data, App, HttpResponse, HttpServer}; use async_graphql::{ - http::{playground_source, GraphQLPlaygroundConfig, MultipartOptions}, + http::{GraphiQLSource, MultipartOptions}, EmptySubscription, Schema, }; use async_graphql_actix_web::{GraphQLRequest, GraphQLResponse}; @@ -13,7 +13,11 @@ async fn index(schema: web::Data, req: GraphQLRequest) -> GraphQLRe async fn gql_playgound() -> HttpResponse { HttpResponse::Ok() .content_type("text/html; charset=utf-8") - .body(playground_source(GraphQLPlaygroundConfig::new("/"))) + .body( + GraphiQLSource::build() + .endpoint("http://localhost:8000") + .finish(), + ) } #[actix_web::main] From ccdd9cabb3fca8408c07004ced01ca26bf9b965c Mon Sep 17 00:00:00 2001 From: Bram van Neerven Date: Sun, 28 Aug 2022 17:35:48 +0200 Subject: [PATCH 030/102] fix url in actix-web websocket example --- actix-web/subscription/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actix-web/subscription/src/main.rs b/actix-web/subscription/src/main.rs index a71cbe2..b7bc141 100644 --- a/actix-web/subscription/src/main.rs +++ b/actix-web/subscription/src/main.rs @@ -13,7 +13,7 @@ async fn index_playground() -> Result { .body( GraphiQLSource::build() .endpoint("http://localhost:8000") - .subscription_endpoint("ws://localhost:8000/ws") + .subscription_endpoint("ws://localhost:8000") .finish(), )) } From 3a40d3f59917d540aa7c5b457da74c3ac24d7025 Mon Sep 17 00:00:00 2001 From: Bram van Neerven Date: Sun, 28 Aug 2022 17:41:33 +0200 Subject: [PATCH 031/102] updated warp examples --- warp/starwars/src/main.rs | 11 ++++++----- warp/subscription/src/main.rs | 14 +++++++------- warp/token-from-header/src/main.rs | 14 +++++++------- 3 files changed, 20 insertions(+), 19 deletions(-) diff --git a/warp/starwars/src/main.rs b/warp/starwars/src/main.rs index ba2e2d4..f6754a6 100644 --- a/warp/starwars/src/main.rs +++ b/warp/starwars/src/main.rs @@ -1,9 +1,6 @@ use std::convert::Infallible; -use async_graphql::{ - http::{playground_source, GraphQLPlaygroundConfig}, - EmptyMutation, EmptySubscription, Schema, -}; +use async_graphql::{http::GraphiQLSource, EmptyMutation, EmptySubscription, Schema}; use async_graphql_warp::{GraphQLBadRequest, GraphQLResponse}; use http::StatusCode; use starwars::{QueryRoot, StarWars}; @@ -29,7 +26,11 @@ async fn main() { let graphql_playground = warp::path::end().and(warp::get()).map(|| { HttpResponse::builder() .header("content-type", "text/html") - .body(playground_source(GraphQLPlaygroundConfig::new("/"))) + .body( + GraphiQLSource::build() + .endpoint("http://localhost:8000") + .finish(), + ) }); let routes = graphql_playground diff --git a/warp/subscription/src/main.rs b/warp/subscription/src/main.rs index 2d8ab40..d80b9c5 100644 --- a/warp/subscription/src/main.rs +++ b/warp/subscription/src/main.rs @@ -1,9 +1,6 @@ use std::convert::Infallible; -use async_graphql::{ - http::{playground_source, GraphQLPlaygroundConfig}, - Schema, -}; +use async_graphql::{http::GraphiQLSource, Schema}; use async_graphql_warp::{graphql_subscription, GraphQLResponse}; use books::{MutationRoot, QueryRoot, Storage, SubscriptionRoot}; use warp::{http::Response as HttpResponse, Filter}; @@ -28,9 +25,12 @@ async fn main() { let graphql_playground = warp::path::end().and(warp::get()).map(|| { HttpResponse::builder() .header("content-type", "text/html") - .body(playground_source( - GraphQLPlaygroundConfig::new("/").subscription_endpoint("/"), - )) + .body( + GraphiQLSource::build() + .endpoint("http://localhost:8000") + .subscription_endpoint("ws://localhost:8000") + .finish(), + ) }); let routes = graphql_subscription(schema) diff --git a/warp/token-from-header/src/main.rs b/warp/token-from-header/src/main.rs index 25841ba..759da4a 100644 --- a/warp/token-from-header/src/main.rs +++ b/warp/token-from-header/src/main.rs @@ -1,9 +1,6 @@ use std::convert::Infallible; -use async_graphql::{ - http::{playground_source, GraphQLPlaygroundConfig}, - Data, EmptyMutation, Schema, -}; +use async_graphql::{http::GraphiQLSource, Data, EmptyMutation, Schema}; use async_graphql_warp::{graphql_protocol, GraphQLResponse, GraphQLWebSocket}; use token::{on_connection_init, QueryRoot, SubscriptionRoot, Token}; use warp::{http::Response as HttpResponse, ws::Ws, Filter}; @@ -17,9 +14,12 @@ async fn main() { let graphql_playground = warp::path::end().and(warp::get()).map(|| { HttpResponse::builder() .header("content-type", "text/html") - .body(playground_source( - GraphQLPlaygroundConfig::new("/").subscription_endpoint("/ws"), - )) + .body( + GraphiQLSource::build() + .endpoint("http://localhost:8000") + .subscription_endpoint("ws://localhost:8000/ws") + .finish(), + ) }); let graphql_post = warp::header::optional::("token") From 6374ea1c2f7f0e69e2ac74c58537b8a0e2a5ced1 Mon Sep 17 00:00:00 2001 From: Bram van Neerven Date: Sun, 28 Aug 2022 17:47:11 +0200 Subject: [PATCH 032/102] updated rocket examples --- rocket/starwars/src/main.rs | 7 ++----- rocket/upload/src/main.rs | 7 ++----- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/rocket/starwars/src/main.rs b/rocket/starwars/src/main.rs index 62ea48b..8252b1a 100644 --- a/rocket/starwars/src/main.rs +++ b/rocket/starwars/src/main.rs @@ -1,7 +1,4 @@ -use async_graphql::{ - http::{playground_source, GraphQLPlaygroundConfig}, - EmptyMutation, EmptySubscription, Schema, -}; +use async_graphql::{http::GraphiQLSource, EmptyMutation, EmptySubscription, Schema}; use async_graphql_rocket::{GraphQLQuery, GraphQLRequest, GraphQLResponse}; use rocket::{response::content, routes, State}; use starwars::{QueryRoot, StarWars}; @@ -10,7 +7,7 @@ pub type StarWarsSchema = Schema; #[rocket::get("/")] fn graphql_playground() -> content::RawHtml { - content::RawHtml(playground_source(GraphQLPlaygroundConfig::new("/graphql"))) + content::RawHtml(GraphiQLSource::build().endpoint("/graphql").finish()) } #[rocket::get("/graphql?")] diff --git a/rocket/upload/src/main.rs b/rocket/upload/src/main.rs index 7bff954..7734540 100644 --- a/rocket/upload/src/main.rs +++ b/rocket/upload/src/main.rs @@ -1,7 +1,4 @@ -use async_graphql::{ - http::{playground_source, GraphQLPlaygroundConfig}, - EmptyMutation, EmptySubscription, Schema, -}; +use async_graphql::{http::GraphiQLSource, EmptyMutation, EmptySubscription, Schema}; use async_graphql_rocket::{GraphQLQuery, GraphQLRequest, GraphQLResponse}; use files::{FilesSchema, MutationRoot, QueryRoot, Storage}; use rocket::{response::content, routes, State}; @@ -10,7 +7,7 @@ pub type StarWarsSchema = Schema; #[rocket::get("/")] fn graphql_playground() -> content::RawHtml { - content::RawHtml(playground_source(GraphQLPlaygroundConfig::new("/graphql"))) + content::RawHtml(GraphiQLSource::build().endpoint("/graphql").finish()) } #[rocket::get("/graphql?")] From 4fef469b02521f91be4facf494428678514a4695 Mon Sep 17 00:00:00 2001 From: Bram van Neerven Date: Sun, 28 Aug 2022 17:55:04 +0200 Subject: [PATCH 033/102] updated axum examples --- axum/starwars/src/main.rs | 11 ++++++----- axum/subscription/src/main.rs | 14 +++++++------- axum/upload/src/main.rs | 11 ++++++----- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/axum/starwars/src/main.rs b/axum/starwars/src/main.rs index d97ba30..76c1bd1 100644 --- a/axum/starwars/src/main.rs +++ b/axum/starwars/src/main.rs @@ -1,7 +1,4 @@ -use async_graphql::{ - http::{playground_source, GraphQLPlaygroundConfig}, - EmptyMutation, EmptySubscription, Schema, -}; +use async_graphql::{http::GraphiQLSource, EmptyMutation, EmptySubscription, Schema}; use async_graphql_axum::{GraphQLRequest, GraphQLResponse}; use axum::{ extract::Extension, @@ -19,7 +16,11 @@ async fn graphql_handler( } async fn graphql_playground() -> impl IntoResponse { - response::Html(playground_source(GraphQLPlaygroundConfig::new("/"))) + response::Html( + GraphiQLSource::build() + .endpoint("http://localhost:8000") + .finish(), + ) } #[tokio::main] diff --git a/axum/subscription/src/main.rs b/axum/subscription/src/main.rs index d3bbaed..ffa149f 100644 --- a/axum/subscription/src/main.rs +++ b/axum/subscription/src/main.rs @@ -1,7 +1,4 @@ -use async_graphql::{ - http::{playground_source, GraphQLPlaygroundConfig}, - Schema, -}; +use async_graphql::{http::GraphiQLSource, Schema}; use async_graphql_axum::{GraphQLRequest, GraphQLResponse, GraphQLSubscription}; use axum::{ extract::Extension, @@ -16,9 +13,12 @@ async fn graphql_handler(schema: Extension, req: GraphQLRequest) -> } async fn graphql_playground() -> impl IntoResponse { - response::Html(playground_source( - GraphQLPlaygroundConfig::new("/").subscription_endpoint("/ws"), - )) + response::Html( + GraphiQLSource::build() + .endpoint("http://localhost:8000") + .subscription_endpoint("ws://localhost:8000/ws") + .finish(), + ) } #[tokio::main] diff --git a/axum/upload/src/main.rs b/axum/upload/src/main.rs index f928fb5..fa63f04 100644 --- a/axum/upload/src/main.rs +++ b/axum/upload/src/main.rs @@ -1,7 +1,4 @@ -use async_graphql::{ - http::{playground_source, GraphQLPlaygroundConfig}, - EmptySubscription, Schema, -}; +use async_graphql::{http::GraphiQLSource, EmptySubscription, Schema}; use async_graphql_axum::{GraphQLRequest, GraphQLResponse}; use axum::{ extract::Extension, @@ -18,7 +15,11 @@ async fn graphql_handler(schema: Extension, req: GraphQLRequest) -> } async fn graphql_playground() -> impl IntoResponse { - Html(playground_source(GraphQLPlaygroundConfig::new("/"))) + Html( + GraphiQLSource::build() + .endpoint("http://localhost:8000") + .finish(), + ) } #[tokio::main] From 1add2c22dc9cd1b92f87c0f3c424be99d0df0df5 Mon Sep 17 00:00:00 2001 From: Bram van Neerven Date: Sun, 28 Aug 2022 18:13:37 +0200 Subject: [PATCH 034/102] updated tide examples --- tide/dataloader-postgres/src/main.rs | 10 ++++++---- tide/dataloader/src/main.rs | 10 ++++++---- tide/starwars/src/main.rs | 11 ++++------- tide/subscription/src/main.rs | 22 +++++++++------------- 4 files changed, 25 insertions(+), 28 deletions(-) diff --git a/tide/dataloader-postgres/src/main.rs b/tide/dataloader-postgres/src/main.rs index 062c756..bb98c5b 100644 --- a/tide/dataloader-postgres/src/main.rs +++ b/tide/dataloader-postgres/src/main.rs @@ -3,7 +3,7 @@ use std::{collections::HashMap, env}; use async_graphql::{ dataloader::{DataLoader, Loader}, futures_util::TryStreamExt, - http::{playground_source, GraphQLPlaygroundConfig}, + http::GraphiQLSource, Context, EmptyMutation, EmptySubscription, FieldError, Object, Result, Schema, SimpleObject, }; use async_std::task; @@ -105,9 +105,11 @@ async fn run() -> Result<()> { app.at("/graphql").post(async_graphql_tide::graphql(schema)); app.at("/").get(|_| async move { let mut resp = Response::new(StatusCode::Ok); - resp.set_body(Body::from_string(playground_source( - GraphQLPlaygroundConfig::new("/graphql"), - ))); + resp.set_body(Body::from_string( + GraphiQLSource::build() + .endpoint("http://localhost:8000/graphql") + .finish(), + )); resp.set_content_type(mime::HTML); Ok(resp) }); diff --git a/tide/dataloader/src/main.rs b/tide/dataloader/src/main.rs index 4fbe437..dc8a911 100644 --- a/tide/dataloader/src/main.rs +++ b/tide/dataloader/src/main.rs @@ -3,7 +3,7 @@ use std::collections::HashMap; use async_graphql::{ dataloader::{DataLoader, Loader}, futures_util::TryStreamExt, - http::{playground_source, GraphQLPlaygroundConfig}, + http::GraphiQLSource, Context, EmptyMutation, EmptySubscription, FieldError, Object, Result, Schema, SimpleObject, }; use async_std::task; @@ -104,9 +104,11 @@ async fn run() -> Result<()> { app.at("/graphql").post(async_graphql_tide::graphql(schema)); app.at("/").get(|_| async move { let mut resp = Response::new(StatusCode::Ok); - resp.set_body(Body::from_string(playground_source( - GraphQLPlaygroundConfig::new("/graphql"), - ))); + resp.set_body(Body::from_string( + GraphiQLSource::build() + .endpoint("http://localhost:8000/graphql") + .finish(), + )); resp.set_content_type(mime::HTML); Ok(resp) }); diff --git a/tide/starwars/src/main.rs b/tide/starwars/src/main.rs index 44ad815..87448ac 100644 --- a/tide/starwars/src/main.rs +++ b/tide/starwars/src/main.rs @@ -1,9 +1,6 @@ use std::env; -use async_graphql::{ - http::{playground_source, GraphQLPlaygroundConfig}, - EmptyMutation, EmptySubscription, Schema, -}; +use async_graphql::{http::GraphiQLSource, EmptyMutation, EmptySubscription, Schema}; use async_std::task; use starwars::{QueryRoot, StarWars}; use tide::{http::mime, Body, Response, StatusCode}; @@ -29,9 +26,9 @@ async fn run() -> Result<()> { app.at("/").get(|_| async move { let mut resp = Response::new(StatusCode::Ok); - resp.set_body(Body::from_string(playground_source( - GraphQLPlaygroundConfig::new("/graphql"), - ))); + resp.set_body(Body::from_string( + GraphiQLSource::build().endpoint("/graphql").finish(), + )); resp.set_content_type(mime::HTML); Ok(resp) }); diff --git a/tide/subscription/src/main.rs b/tide/subscription/src/main.rs index 8d6cc5a..b76d098 100644 --- a/tide/subscription/src/main.rs +++ b/tide/subscription/src/main.rs @@ -1,9 +1,4 @@ -use std::env; - -use async_graphql::{ - http::{playground_source, GraphQLPlaygroundConfig}, - Schema, -}; +use async_graphql::{http::GraphiQLSource, Schema}; use async_std::task; use books::{MutationRoot, QueryRoot, Storage, SubscriptionRoot}; use tide::{http::mime, Body, Response, StatusCode}; @@ -15,13 +10,11 @@ fn main() -> Result<()> { } async fn run() -> Result<()> { - let listen_addr = env::var("LISTEN_ADDR").unwrap_or_else(|_| "localhost:8000".to_owned()); - let schema = Schema::build(QueryRoot, MutationRoot, SubscriptionRoot) .data(Storage::default()) .finish(); - println!("Playground: http://{}", listen_addr); + println!("Playground: http://localhost:8000"); let mut app = tide::new(); @@ -31,14 +24,17 @@ async fn run() -> Result<()> { app.at("/").get(|_| async move { let mut resp = Response::new(StatusCode::Ok); - resp.set_body(Body::from_string(playground_source( - GraphQLPlaygroundConfig::new("/graphql").subscription_endpoint("/graphql"), - ))); + resp.set_body(Body::from_string( + GraphiQLSource::build() + .endpoint("http://localhost:8000/graphql") + .subscription_endpoint("ws://localhost:8000/graphql") + .finish(), + )); resp.set_content_type(mime::HTML); Ok(resp) }); - app.listen(listen_addr).await?; + app.listen("127.0.0.1:8000").await?; Ok(()) } From b41f8f97818915e88dc08d5433f66366ff6ea694 Mon Sep 17 00:00:00 2001 From: Bram van Neerven Date: Sun, 28 Aug 2022 20:14:40 +0200 Subject: [PATCH 035/102] renamed variables / print statements --- actix-web/error-extensions/src/main.rs | 2 +- actix-web/starwars/src/main.rs | 6 +++--- actix-web/subscription/src/main.rs | 6 +++--- actix-web/token-from-header/src/main.rs | 6 +++--- actix-web/upload/src/main.rs | 2 +- axum/starwars/src/main.rs | 6 +++--- axum/subscription/src/main.rs | 6 +++--- axum/upload/src/main.rs | 6 +++--- poem/starwars/src/main.rs | 6 +++--- poem/subscription-redis/src/main.rs | 9 +++------ poem/subscription/src/main.rs | 9 +++------ poem/token-from-header/src/main.rs | 6 +++--- poem/upload/src/main.rs | 6 +++--- rocket/starwars/src/main.rs | 9 ++++----- rocket/upload/src/main.rs | 4 ++-- tide/dataloader-postgres/src/main.rs | 2 +- tide/dataloader/src/main.rs | 2 +- tide/starwars/src/main.rs | 2 +- tide/subscription/src/main.rs | 2 +- warp/starwars/src/main.rs | 6 +++--- warp/subscription/src/main.rs | 8 +++----- warp/token-from-header/src/main.rs | 6 +++--- 22 files changed, 54 insertions(+), 63 deletions(-) diff --git a/actix-web/error-extensions/src/main.rs b/actix-web/error-extensions/src/main.rs index 6c166f6..703041c 100644 --- a/actix-web/error-extensions/src/main.rs +++ b/actix-web/error-extensions/src/main.rs @@ -110,7 +110,7 @@ async fn gql_playgound() -> HttpResponse { #[actix_web::main] async fn main() -> std::io::Result<()> { - println!("Playground: http://localhost:8000"); + println!("GraphiQL IDE: http://localhost:8000"); HttpServer::new(move || { App::new() diff --git a/actix-web/starwars/src/main.rs b/actix-web/starwars/src/main.rs index 5955fbd..a9d7e79 100644 --- a/actix-web/starwars/src/main.rs +++ b/actix-web/starwars/src/main.rs @@ -7,7 +7,7 @@ async fn index(schema: web::Data, req: GraphQLRequest) -> GraphQ schema.execute(req.into_inner()).await.into() } -async fn index_playground() -> Result { +async fn index_graphiql() -> Result { Ok(HttpResponse::Ok() .content_type("text/html; charset=utf-8") .body( @@ -23,13 +23,13 @@ async fn main() -> std::io::Result<()> { .data(StarWars::new()) .finish(); - println!("Playground: http://localhost:8000"); + println!("GraphiQL IDE: http://localhost:8000"); HttpServer::new(move || { App::new() .app_data(Data::new(schema.clone())) .service(web::resource("/").guard(guard::Post()).to(index)) - .service(web::resource("/").guard(guard::Get()).to(index_playground)) + .service(web::resource("/").guard(guard::Get()).to(index_graphiql)) }) .bind("127.0.0.1:8000")? .run() diff --git a/actix-web/subscription/src/main.rs b/actix-web/subscription/src/main.rs index b7bc141..e561b57 100644 --- a/actix-web/subscription/src/main.rs +++ b/actix-web/subscription/src/main.rs @@ -7,7 +7,7 @@ async fn index(schema: web::Data, req: GraphQLRequest) -> GraphQLRe schema.execute(req.into_inner()).await.into() } -async fn index_playground() -> Result { +async fn index_graphiql() -> Result { Ok(HttpResponse::Ok() .content_type("text/html; charset=utf-8") .body( @@ -32,7 +32,7 @@ async fn main() -> std::io::Result<()> { .data(Storage::default()) .finish(); - println!("Playground: http://localhost:8000"); + println!("GraphiQL IDE: http://localhost:8000"); HttpServer::new(move || { App::new() @@ -44,7 +44,7 @@ async fn main() -> std::io::Result<()> { .guard(guard::Header("upgrade", "websocket")) .to(index_ws), ) - .service(web::resource("/").guard(guard::Get()).to(index_playground)) + .service(web::resource("/").guard(guard::Get()).to(index_graphiql)) }) .bind("127.0.0.1:8000")? .run() diff --git a/actix-web/token-from-header/src/main.rs b/actix-web/token-from-header/src/main.rs index b54fd23..c3c1544 100644 --- a/actix-web/token-from-header/src/main.rs +++ b/actix-web/token-from-header/src/main.rs @@ -5,7 +5,7 @@ use async_graphql::{http::GraphiQLSource, Data, EmptyMutation, Schema}; use async_graphql_actix_web::{GraphQLRequest, GraphQLResponse, GraphQLSubscription}; use token::{on_connection_init, QueryRoot, SubscriptionRoot, Token, TokenSchema}; -async fn gql_playground() -> HttpResponse { +async fn graphiql() -> HttpResponse { HttpResponse::Ok() .content_type("text/html; charset=utf-8") .body( @@ -54,12 +54,12 @@ async fn index_ws( async fn main() -> std::io::Result<()> { let schema = Schema::new(QueryRoot, EmptyMutation, SubscriptionRoot); - println!("Playground: http://localhost:8000"); + println!("GraphiQL IDE: http://localhost:8000"); HttpServer::new(move || { App::new() .app_data(web::Data::new(schema.clone())) - .service(web::resource("/").guard(guard::Get()).to(gql_playground)) + .service(web::resource("/").guard(guard::Get()).to(graphiql)) .service(web::resource("/").guard(guard::Post()).to(index)) .service(web::resource("/ws").to(index_ws)) }) diff --git a/actix-web/upload/src/main.rs b/actix-web/upload/src/main.rs index 270f05b..50d9b47 100644 --- a/actix-web/upload/src/main.rs +++ b/actix-web/upload/src/main.rs @@ -26,7 +26,7 @@ async fn main() -> std::io::Result<()> { .data(Storage::default()) .finish(); - println!("Playground: http://localhost:8000"); + println!("GraphiQL IDE: http://localhost:8000"); HttpServer::new(move || { App::new() diff --git a/axum/starwars/src/main.rs b/axum/starwars/src/main.rs index 76c1bd1..262ec91 100644 --- a/axum/starwars/src/main.rs +++ b/axum/starwars/src/main.rs @@ -15,7 +15,7 @@ async fn graphql_handler( schema.execute(req.into_inner()).await.into() } -async fn graphql_playground() -> impl IntoResponse { +async fn graphiql() -> impl IntoResponse { response::Html( GraphiQLSource::build() .endpoint("http://localhost:8000") @@ -30,10 +30,10 @@ async fn main() { .finish(); let app = Router::new() - .route("/", get(graphql_playground).post(graphql_handler)) + .route("/", get(graphiql).post(graphql_handler)) .layer(Extension(schema)); - println!("Playground: http://localhost:8000"); + println!("GraphiQL IDE: http://localhost:8000"); Server::bind(&"0.0.0.0:8000".parse().unwrap()) .serve(app.into_make_service()) diff --git a/axum/subscription/src/main.rs b/axum/subscription/src/main.rs index ffa149f..175dfda 100644 --- a/axum/subscription/src/main.rs +++ b/axum/subscription/src/main.rs @@ -12,7 +12,7 @@ async fn graphql_handler(schema: Extension, req: GraphQLRequest) -> schema.execute(req.into_inner()).await.into() } -async fn graphql_playground() -> impl IntoResponse { +async fn graphiql() -> impl IntoResponse { response::Html( GraphiQLSource::build() .endpoint("http://localhost:8000") @@ -28,11 +28,11 @@ async fn main() { .finish(); let app = Router::new() - .route("/", get(graphql_playground).post(graphql_handler)) + .route("/", get(graphiql).post(graphql_handler)) .route("/ws", GraphQLSubscription::new(schema.clone())) .layer(Extension(schema)); - println!("Playground: http://localhost:8000"); + println!("GraphiQL IDE: http://localhost:8000"); Server::bind(&"0.0.0.0:8000".parse().unwrap()) .serve(app.into_make_service()) diff --git a/axum/upload/src/main.rs b/axum/upload/src/main.rs index fa63f04..791a0e8 100644 --- a/axum/upload/src/main.rs +++ b/axum/upload/src/main.rs @@ -14,7 +14,7 @@ async fn graphql_handler(schema: Extension, req: GraphQLRequest) -> schema.execute(req.0).await.into() } -async fn graphql_playground() -> impl IntoResponse { +async fn graphiql() -> impl IntoResponse { Html( GraphiQLSource::build() .endpoint("http://localhost:8000") @@ -28,10 +28,10 @@ async fn main() { .data(Storage::default()) .finish(); - println!("Playground: http://localhost:8000"); + println!("GraphiQL IDE: http://localhost:8000"); let app = Router::new() - .route("/", get(graphql_playground).post(graphql_handler)) + .route("/", get(graphiql).post(graphql_handler)) .layer(Extension(schema)) .layer( CorsLayer::new() diff --git a/poem/starwars/src/main.rs b/poem/starwars/src/main.rs index cbbb41e..936e278 100644 --- a/poem/starwars/src/main.rs +++ b/poem/starwars/src/main.rs @@ -4,7 +4,7 @@ use poem::{get, handler, listener::TcpListener, web::Html, IntoResponse, Route, use starwars::{QueryRoot, StarWars}; #[handler] -async fn graphql_playground() -> impl IntoResponse { +async fn graphiql() -> impl IntoResponse { Html( GraphiQLSource::build() .endpoint("http://localhost:8000") @@ -18,9 +18,9 @@ async fn main() { .data(StarWars::new()) .finish(); - let app = Route::new().at("/", get(graphql_playground).post(GraphQL::new(schema))); + let app = Route::new().at("/", get(graphiql).post(GraphQL::new(schema))); - println!("Playground: http://localhost:8000"); + println!("GraphiQL IDE: http://localhost:8000"); Server::new(TcpListener::bind("0.0.0.0:8000")) .run(app) .await diff --git a/poem/subscription-redis/src/main.rs b/poem/subscription-redis/src/main.rs index 46d1d71..fbdd130 100644 --- a/poem/subscription-redis/src/main.rs +++ b/poem/subscription-redis/src/main.rs @@ -40,7 +40,7 @@ impl SubscriptionRoot { } #[handler] -async fn graphql_playground() -> impl IntoResponse { +async fn graphiql() -> impl IntoResponse { Html( GraphiQLSource::build() .endpoint("http://localhost:8000") @@ -58,13 +58,10 @@ async fn main() { .finish(); let app = Route::new() - .at( - "/", - get(graphql_playground).post(GraphQL::new(schema.clone())), - ) + .at("/", get(graphiql).post(GraphQL::new(schema.clone()))) .at("/ws", get(GraphQLSubscription::new(schema))); - println!("Playground: http://localhost:8000"); + println!("GraphiQL IDE: http://localhost:8000"); Server::new(TcpListener::bind("0.0.0.0:8000")) .run(app) .await diff --git a/poem/subscription/src/main.rs b/poem/subscription/src/main.rs index f480619..91d00b9 100644 --- a/poem/subscription/src/main.rs +++ b/poem/subscription/src/main.rs @@ -4,7 +4,7 @@ use books::{MutationRoot, QueryRoot, Storage, SubscriptionRoot}; use poem::{get, handler, listener::TcpListener, web::Html, IntoResponse, Route, Server}; #[handler] -async fn graphql_playground() -> impl IntoResponse { +async fn graphiql() -> impl IntoResponse { Html( GraphiQLSource::build() .endpoint("http://localhost:8000") @@ -20,13 +20,10 @@ async fn main() { .finish(); let app = Route::new() - .at( - "/", - get(graphql_playground).post(GraphQL::new(schema.clone())), - ) + .at("/", get(graphiql).post(GraphQL::new(schema.clone()))) .at("/ws", get(GraphQLSubscription::new(schema))); - println!("Playground: http://localhost:8000"); + println!("GraphiQL IDE: http://localhost:8000"); Server::new(TcpListener::bind("0.0.0.0:8000")) .run(app) .await diff --git a/poem/token-from-header/src/main.rs b/poem/token-from-header/src/main.rs index acfb18e..8d8cab0 100644 --- a/poem/token-from-header/src/main.rs +++ b/poem/token-from-header/src/main.rs @@ -19,7 +19,7 @@ fn get_token_from_headers(headers: &HeaderMap) -> Option { } #[handler] -async fn graphql_playground() -> impl IntoResponse { +async fn graphiql() -> impl IntoResponse { Html( GraphiQLSource::build() .endpoint("http://localhost:8000") @@ -69,11 +69,11 @@ async fn main() { let schema = Schema::new(QueryRoot, EmptyMutation, SubscriptionRoot); let app = Route::new() - .at("/", get(graphql_playground).post(index)) + .at("/", get(graphiql).post(index)) .at("/ws", get(ws)) .data(schema); - println!("Playground: http://localhost:8000"); + println!("GraphiQL IDE: http://localhost:8000"); Server::new(TcpListener::bind("0.0.0.0:8000")) .run(app) .await diff --git a/poem/upload/src/main.rs b/poem/upload/src/main.rs index b98ee29..c596df6 100644 --- a/poem/upload/src/main.rs +++ b/poem/upload/src/main.rs @@ -15,7 +15,7 @@ async fn index(schema: Data<&FilesSchema>, req: GraphQLRequest) -> GraphQLRespon } #[handler] -async fn gql_playground() -> impl IntoResponse { +async fn graphiql() -> impl IntoResponse { Html( GraphiQLSource::build() .endpoint("http://localhost:8000") @@ -29,10 +29,10 @@ async fn main() -> std::io::Result<()> { .data(Storage::default()) .finish(); - println!("Playground: http://localhost:8000"); + println!("GraphiQL IDE: http://localhost:8000"); let app = Route::new() - .at("/", get(gql_playground).post(index)) + .at("/", get(graphiql).post(index)) .with(Cors::new()) .data(schema); Server::new(TcpListener::bind("0.0.0.0:8000")) diff --git a/rocket/starwars/src/main.rs b/rocket/starwars/src/main.rs index 8252b1a..e401363 100644 --- a/rocket/starwars/src/main.rs +++ b/rocket/starwars/src/main.rs @@ -6,7 +6,7 @@ use starwars::{QueryRoot, StarWars}; pub type StarWarsSchema = Schema; #[rocket::get("/")] -fn graphql_playground() -> content::RawHtml { +fn graphiql() -> content::RawHtml { content::RawHtml(GraphiQLSource::build().endpoint("/graphql").finish()) } @@ -29,8 +29,7 @@ fn rocket() -> _ { .data(StarWars::new()) .finish(); - rocket::build().manage(schema).mount( - "/", - routes![graphql_query, graphql_request, graphql_playground], - ) + rocket::build() + .manage(schema) + .mount("/", routes![graphql_query, graphql_request, graphiql]) } diff --git a/rocket/upload/src/main.rs b/rocket/upload/src/main.rs index 7734540..5e4aab7 100644 --- a/rocket/upload/src/main.rs +++ b/rocket/upload/src/main.rs @@ -6,7 +6,7 @@ use rocket::{response::content, routes, State}; pub type StarWarsSchema = Schema; #[rocket::get("/")] -fn graphql_playground() -> content::RawHtml { +fn graphiql() -> content::RawHtml { content::RawHtml(GraphiQLSource::build().endpoint("/graphql").finish()) } @@ -45,7 +45,7 @@ fn rocket() -> _ { graphql_query, graphql_request, graphql_request_multipart, - graphql_playground + graphiql ], ) } diff --git a/tide/dataloader-postgres/src/main.rs b/tide/dataloader-postgres/src/main.rs index bb98c5b..c3f9f15 100644 --- a/tide/dataloader-postgres/src/main.rs +++ b/tide/dataloader-postgres/src/main.rs @@ -114,7 +114,7 @@ async fn run() -> Result<()> { Ok(resp) }); - println!("Playground: http://127.0.0.1:8000"); + println!("GraphiQL IDE: http://127.0.0.1:8000"); app.listen("127.0.0.1:8000").await?; Ok(()) diff --git a/tide/dataloader/src/main.rs b/tide/dataloader/src/main.rs index dc8a911..7c0c862 100644 --- a/tide/dataloader/src/main.rs +++ b/tide/dataloader/src/main.rs @@ -113,7 +113,7 @@ async fn run() -> Result<()> { Ok(resp) }); - println!("Playground: http://127.0.0.1:8000"); + println!("GraphiQL IDE: http://127.0.0.1:8000"); app.listen("127.0.0.1:8000").await?; Ok(()) diff --git a/tide/starwars/src/main.rs b/tide/starwars/src/main.rs index 87448ac..838996b 100644 --- a/tide/starwars/src/main.rs +++ b/tide/starwars/src/main.rs @@ -18,7 +18,7 @@ async fn run() -> Result<()> { .data(StarWars::new()) .finish(); - println!("Playground: http://{}", listen_addr); + println!("GraphiQL IDE: http://{}", listen_addr); let mut app = tide::new(); diff --git a/tide/subscription/src/main.rs b/tide/subscription/src/main.rs index b76d098..84a8410 100644 --- a/tide/subscription/src/main.rs +++ b/tide/subscription/src/main.rs @@ -14,7 +14,7 @@ async fn run() -> Result<()> { .data(Storage::default()) .finish(); - println!("Playground: http://localhost:8000"); + println!("GraphiQL IDE: http://localhost:8000"); let mut app = tide::new(); diff --git a/warp/starwars/src/main.rs b/warp/starwars/src/main.rs index f6754a6..e2910e6 100644 --- a/warp/starwars/src/main.rs +++ b/warp/starwars/src/main.rs @@ -12,7 +12,7 @@ async fn main() { .data(StarWars::new()) .finish(); - println!("Playground: http://localhost:8000"); + println!("GraphiQL IDE: http://localhost:8000"); let graphql_post = async_graphql_warp::graphql(schema).and_then( |(schema, request): ( @@ -23,7 +23,7 @@ async fn main() { }, ); - let graphql_playground = warp::path::end().and(warp::get()).map(|| { + let graphiql = warp::path::end().and(warp::get()).map(|| { HttpResponse::builder() .header("content-type", "text/html") .body( @@ -33,7 +33,7 @@ async fn main() { ) }); - let routes = graphql_playground + let routes = graphiql .or(graphql_post) .recover(|err: Rejection| async move { if let Some(GraphQLBadRequest(err)) = err.find() { diff --git a/warp/subscription/src/main.rs b/warp/subscription/src/main.rs index d80b9c5..b74985f 100644 --- a/warp/subscription/src/main.rs +++ b/warp/subscription/src/main.rs @@ -11,7 +11,7 @@ async fn main() { .data(Storage::default()) .finish(); - println!("Playground: http://localhost:8000"); + println!("GraphiQL IDE: http://localhost:8000"); let graphql_post = async_graphql_warp::graphql(schema.clone()).and_then( |(schema, request): ( @@ -22,7 +22,7 @@ async fn main() { }, ); - let graphql_playground = warp::path::end().and(warp::get()).map(|| { + let graphiql = warp::path::end().and(warp::get()).map(|| { HttpResponse::builder() .header("content-type", "text/html") .body( @@ -33,8 +33,6 @@ async fn main() { ) }); - let routes = graphql_subscription(schema) - .or(graphql_playground) - .or(graphql_post); + let routes = graphql_subscription(schema).or(graphiql).or(graphql_post); warp::serve(routes).run(([0, 0, 0, 0], 8000)).await; } diff --git a/warp/token-from-header/src/main.rs b/warp/token-from-header/src/main.rs index 759da4a..c568833 100644 --- a/warp/token-from-header/src/main.rs +++ b/warp/token-from-header/src/main.rs @@ -9,9 +9,9 @@ use warp::{http::Response as HttpResponse, ws::Ws, Filter}; async fn main() { let schema = Schema::build(QueryRoot, EmptyMutation, SubscriptionRoot).finish(); - println!("Playground: http://localhost:8000"); + println!("GraphiQL IDE: http://localhost:8000"); - let graphql_playground = warp::path::end().and(warp::get()).map(|| { + let graphiql = warp::path::end().and(warp::get()).map(|| { HttpResponse::builder() .header("content-type", "text/html") .body( @@ -68,6 +68,6 @@ async fn main() { }, ); - let routes = subscription.or(graphql_playground).or(graphql_post); + let routes = subscription.or(graphiql).or(graphql_post); warp::serve(routes).run(([0, 0, 0, 0], 8000)).await; } From e186980fdf982dbab8a8327cec57e36dbc0a3177 Mon Sep 17 00:00:00 2001 From: Jeffrey Rooks Date: Fri, 16 Sep 2022 10:18:20 -0400 Subject: [PATCH 036/102] add basic stdout telemetry example --- Cargo.toml | 1 + opentelemetry-basic/Cargo.toml | 13 +++++++++ opentelemetry-basic/src/main.rs | 31 ++++++++++++++++++++ poem/opentelemetry-basic/Cargo.toml | 13 +++++++++ poem/opentelemetry-basic/src/main.rs | 42 ++++++++++++++++++++++++++++ 5 files changed, 100 insertions(+) create mode 100644 opentelemetry-basic/Cargo.toml create mode 100644 opentelemetry-basic/src/main.rs create mode 100644 poem/opentelemetry-basic/Cargo.toml create mode 100644 poem/opentelemetry-basic/src/main.rs diff --git a/Cargo.toml b/Cargo.toml index f092164..dc0ed93 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,6 +5,7 @@ members = [ "models/files", "models/token", + "poem/opentelemetry-basic", "poem/starwars", "poem/subscription", "poem/subscription-redis", diff --git a/opentelemetry-basic/Cargo.toml b/opentelemetry-basic/Cargo.toml new file mode 100644 index 0000000..a7f8146 --- /dev/null +++ b/opentelemetry-basic/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "poem-opentelemetry-basic" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +async-graphql = { path = "../../..", features = ["opentelemetry"] } +async-graphql-poem = { path = "../../../integrations/poem" } +tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } +poem = { version = "1.3.42" } +opentelemetry = { version = "0.17.0", features = ["rt-tokio"] } \ No newline at end of file diff --git a/opentelemetry-basic/src/main.rs b/opentelemetry-basic/src/main.rs new file mode 100644 index 0000000..5f1e6a6 --- /dev/null +++ b/opentelemetry-basic/src/main.rs @@ -0,0 +1,31 @@ +use async_graphql::{extensions::OpenTelemetry, EmptyMutation, EmptySubscription, Schema}; +use async_graphql_poem::{GraphQLProtocol, GraphQLRequest, GraphQLResponse}; +use opentelemetry::sdk::export::trace::stdout; +use poem::{ + handler, http::HeaderMap, listener::TcpListener, web::Data, EndpointExt, IntoResponse, Route, + Server, +}; + +#[handler] +async fn index( + schema: Data<&TokenSchema>, + headers: &HeaderMap, + req: GraphQLRequest, +) -> GraphQLResponse { + schema.execute(req).await.into() +} + +#[tokio::main] +async fn main() { + let tracer = stdout::new_pipeline().install_simple(); + let opentelemetry_extension = OpenTelemetry::new(tracer); + + let schema = Schema::new(QueryRoot, EmptyMutation, EmptySubscription); + + let app = Route::new().at("/", post(index)).data(schema); + + Server::new(TcpListener::bind("0.0.0.0:8000")) + .run(app) + .await + .unwrap(); +} diff --git a/poem/opentelemetry-basic/Cargo.toml b/poem/opentelemetry-basic/Cargo.toml new file mode 100644 index 0000000..1e7b98d --- /dev/null +++ b/poem/opentelemetry-basic/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "poem-opentelemetry-basic" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +async-graphql = { path = "../../..", features = ["opentelemetry"] } +async-graphql-poem = { path = "../../../integrations/poem" } +tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } +poem = "1.3.42" +opentelemetry = { version = "0.17.0", features = ["rt-tokio"] } \ No newline at end of file diff --git a/poem/opentelemetry-basic/src/main.rs b/poem/opentelemetry-basic/src/main.rs new file mode 100644 index 0000000..625e12b --- /dev/null +++ b/poem/opentelemetry-basic/src/main.rs @@ -0,0 +1,42 @@ +use async_graphql::{ + extensions::OpenTelemetry, EmptyMutation, EmptySubscription, Object, Result, Schema, +}; +use async_graphql_poem::GraphQL; +use opentelemetry::sdk::export::trace::stdout; +use poem::{listener::TcpListener, post, EndpointExt, Route, Server}; + +struct QueryRoot; + +#[Object] +impl QueryRoot { + async fn hello(&self) -> Result { + Ok("World".to_string()) + } +} + +#[tokio::main] +async fn main() { + let tracer = stdout::new_pipeline().install_simple(); + let opentelemetry_extension = OpenTelemetry::new(tracer); + + let schema = Schema::build(QueryRoot, EmptyMutation, EmptySubscription) + .extension(opentelemetry_extension) + .finish(); + + let app = Route::new() + .at("/", post(GraphQL::new(schema.clone()))) + .data(schema); + + let example_curl = "\ + curl '0.0.0.0:8000' \ + -X POST \ + -H 'content-type: application/json' \ + --data '{ \"query\": \"{ hello }\" }'"; + + println!("Run this curl command from another terminal window to see opentelemetry output in this terminal.\n\n{example_curl}\n\n"); + + Server::new(TcpListener::bind("0.0.0.0:8000")) + .run(app) + .await + .unwrap(); +} From 2123636515a12049c661745debde76e261a244a3 Mon Sep 17 00:00:00 2001 From: Jeffrey Rooks Date: Fri, 16 Sep 2022 10:20:01 -0400 Subject: [PATCH 037/102] remove folder --- opentelemetry-basic/Cargo.toml | 13 ------------- opentelemetry-basic/src/main.rs | 31 ------------------------------- 2 files changed, 44 deletions(-) delete mode 100644 opentelemetry-basic/Cargo.toml delete mode 100644 opentelemetry-basic/src/main.rs diff --git a/opentelemetry-basic/Cargo.toml b/opentelemetry-basic/Cargo.toml deleted file mode 100644 index a7f8146..0000000 --- a/opentelemetry-basic/Cargo.toml +++ /dev/null @@ -1,13 +0,0 @@ -[package] -name = "poem-opentelemetry-basic" -version = "0.1.0" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -async-graphql = { path = "../../..", features = ["opentelemetry"] } -async-graphql-poem = { path = "../../../integrations/poem" } -tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } -poem = { version = "1.3.42" } -opentelemetry = { version = "0.17.0", features = ["rt-tokio"] } \ No newline at end of file diff --git a/opentelemetry-basic/src/main.rs b/opentelemetry-basic/src/main.rs deleted file mode 100644 index 5f1e6a6..0000000 --- a/opentelemetry-basic/src/main.rs +++ /dev/null @@ -1,31 +0,0 @@ -use async_graphql::{extensions::OpenTelemetry, EmptyMutation, EmptySubscription, Schema}; -use async_graphql_poem::{GraphQLProtocol, GraphQLRequest, GraphQLResponse}; -use opentelemetry::sdk::export::trace::stdout; -use poem::{ - handler, http::HeaderMap, listener::TcpListener, web::Data, EndpointExt, IntoResponse, Route, - Server, -}; - -#[handler] -async fn index( - schema: Data<&TokenSchema>, - headers: &HeaderMap, - req: GraphQLRequest, -) -> GraphQLResponse { - schema.execute(req).await.into() -} - -#[tokio::main] -async fn main() { - let tracer = stdout::new_pipeline().install_simple(); - let opentelemetry_extension = OpenTelemetry::new(tracer); - - let schema = Schema::new(QueryRoot, EmptyMutation, EmptySubscription); - - let app = Route::new().at("/", post(index)).data(schema); - - Server::new(TcpListener::bind("0.0.0.0:8000")) - .run(app) - .await - .unwrap(); -} From 3e7f9efbe3b32c1493d84f5255df2dd26e3cf3a6 Mon Sep 17 00:00:00 2001 From: Dylan Anthony Date: Thu, 22 Sep 2022 17:53:06 -0600 Subject: [PATCH 038/102] feat: Add examples of every federation directive --- README.md | 2 +- federation/README.md | 18 +- federation/federation-accounts/Cargo.toml | 2 +- federation/federation-accounts/src/main.rs | 52 +- federation/federation-products/Cargo.toml | 2 +- federation/federation-products/src/main.rs | 3 +- federation/federation-reviews/Cargo.toml | 2 +- federation/federation-reviews/src/main.rs | 161 +- federation/gateway/index.js | 19 - federation/gateway/jest.config.js | 10 - federation/gateway/package.json | 17 - federation/gateway/yarn.lock | 4854 -------------------- federation/{gateway => }/start.sh | 13 +- 13 files changed, 203 insertions(+), 4952 deletions(-) delete mode 100644 federation/gateway/index.js delete mode 100644 federation/gateway/jest.config.js delete mode 100644 federation/gateway/package.json delete mode 100644 federation/gateway/yarn.lock rename federation/{gateway => }/start.sh (57%) diff --git a/README.md b/README.md index dd71a2b..21aa3f8 100644 --- a/README.md +++ b/README.md @@ -8,4 +8,4 @@ - [tide] Examples for `tide` - [rocket] Examples for `rocket` - [axum] Examples for `axum` -- [federation] Examples for `Federation` +- [federation] Examples for [Apollo Federation](https://www.apollographql.com/docs/federation/) diff --git a/federation/README.md b/federation/README.md index cfcf2dc..4098873 100644 --- a/federation/README.md +++ b/federation/README.md @@ -1,5 +1,15 @@ -# How to run +# Federation Example -```shell script -cd gateway && yarn install && ./start.sh -``` \ No newline at end of file +An example of using [Apollo Federation](https://www.apollographql.com/docs/federation/) to compose GraphQL services into a single data graph. + +## The schema + +You can view the full schema in [Apollo Studio]() without needing to run the example (you will need to run the example in order to query it). + +## How to run + +1. Install [Rover](https://www.apollographql.com/docs/rover/) +2. Run `/start.sh` which will: + 1. Start each subgraph with `cargo run --bin {subgraph_name}` + 2. Add each subgraph to `rover dev` with `rover dev --url http://localhost:{port} --name {subgraph_name}` +3. Visit `http://localhost:3000` in a browser. diff --git a/federation/federation-accounts/Cargo.toml b/federation/federation-accounts/Cargo.toml index 074760c..3cf5671 100644 --- a/federation/federation-accounts/Cargo.toml +++ b/federation/federation-accounts/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "federation-accounts" -version = "0.1.1" +version = "0.2.0" authors = ["sunli "] edition = "2021" diff --git a/federation/federation-accounts/src/main.rs b/federation/federation-accounts/src/main.rs index 0779bf1..d703a04 100644 --- a/federation/federation-accounts/src/main.rs +++ b/federation/federation-accounts/src/main.rs @@ -8,27 +8,59 @@ use warp::{Filter, Reply}; struct User { id: ID, username: String, + profile_picture: Option, + /// This used to be part of this subgraph, but is now being overridden from + /// `reviews` + review_count: u32, + joined_timestamp: u64, } -struct Query; - -#[Object(extends)] -impl Query { - async fn me(&self) -> User { +impl User { + fn me() -> User { User { id: "1234".into(), username: "Me".to_string(), + profile_picture: Some(Picture { + url: "http://localhost:8080/me.jpg".to_string(), + width: 256, + height: 256, + }), + review_count: 0, + joined_timestamp: 1, } } +} + +#[derive(SimpleObject)] +#[graphql(shareable)] +struct Picture { + url: String, + width: u32, + height: u32, +} + +struct Query; + +#[Object] +impl Query { + async fn me(&self) -> User { + User::me() + } #[graphql(entity)] async fn find_user_by_id(&self, id: ID) -> User { - let username = if id == "1234" { - "Me".to_string() + if id == "1234" { + User::me() } else { - format!("User {:?}", id) - }; - User { id, username } + let username = format!("User {}", id.as_str()); + User { + id, + username, + profile_picture: None, + review_count: 0, + joined_timestamp: 1500, + } + } } } diff --git a/federation/federation-products/Cargo.toml b/federation/federation-products/Cargo.toml index ef96457..bc321e0 100644 --- a/federation/federation-products/Cargo.toml +++ b/federation/federation-products/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "federation-products" -version = "0.1.1" +version = "0.2.0" authors = ["sunli "] edition = "2021" diff --git a/federation/federation-products/src/main.rs b/federation/federation-products/src/main.rs index 54454f6..d034fd3 100644 --- a/federation/federation-products/src/main.rs +++ b/federation/federation-products/src/main.rs @@ -8,12 +8,13 @@ use warp::{Filter, Reply}; struct Product { upc: String, name: String, + #[graphql(shareable)] price: i32, } struct Query; -#[Object(extends)] +#[Object] impl Query { async fn top_products<'a>(&self, ctx: &'a Context<'_>) -> &'a Vec { ctx.data_unchecked::>() diff --git a/federation/federation-reviews/Cargo.toml b/federation/federation-reviews/Cargo.toml index 0c1a932..201a9bc 100644 --- a/federation/federation-reviews/Cargo.toml +++ b/federation/federation-reviews/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "federation-reviews" -version = "0.1.1" +version = "0.2.0" authors = ["sunli "] edition = "2021" diff --git a/federation/federation-reviews/src/main.rs b/federation/federation-reviews/src/main.rs index f6298da..a462cf9 100644 --- a/federation/federation-reviews/src/main.rs +++ b/federation/federation-reviews/src/main.rs @@ -1,54 +1,129 @@ use std::convert::Infallible; -use async_graphql::{Context, EmptyMutation, EmptySubscription, Object, Schema, SimpleObject, ID}; +use async_graphql::{ + ComplexObject, Context, EmptyMutation, EmptySubscription, Enum, Object, Schema, SimpleObject, + ID, +}; use async_graphql_warp::graphql; use warp::{Filter, Reply}; +#[derive(SimpleObject)] +#[graphql(complex)] struct User { id: ID, + #[graphql(override_from = "accounts")] + review_count: u32, + #[graphql(external)] + joined_timestamp: u64, } -#[Object(extends)] -impl User { - #[graphql(external)] - async fn id(&self) -> &ID { - &self.id - } +#[derive(Enum, Eq, PartialEq, Copy, Clone)] +enum Trustworthiness { + ReallyTrusted, + KindaTrusted, + NotTrusted, +} +#[ComplexObject] +impl User { async fn reviews<'a>(&self, ctx: &'a Context<'_>) -> Vec<&'a Review> { let reviews = ctx.data_unchecked::>(); reviews .iter() - .filter(|review| review.author.id == self.id) + .filter(|review| review.get_author().id == self.id) .collect() } + + #[graphql(requires = "joinedTimestamp")] + async fn trustworthiness(&self) -> Trustworthiness { + if self.joined_timestamp < 1_000 && self.review_count > 1 { + Trustworthiness::ReallyTrusted + } else if self.joined_timestamp < 2_000 { + Trustworthiness::KindaTrusted + } else { + Trustworthiness::NotTrusted + } + } } +#[derive(SimpleObject)] +#[graphql(complex)] struct Product { upc: String, + #[graphql(external)] + price: u32, } -#[Object(extends)] +#[ComplexObject] impl Product { - #[graphql(external)] - async fn upc(&self) -> &String { - &self.upc - } - async fn reviews<'a>(&self, ctx: &'a Context<'_>) -> Vec<&'a Review> { let reviews = ctx.data_unchecked::>(); reviews .iter() - .filter(|review| review.product.upc == self.upc) + .filter(|review| review.get_product().upc == self.upc) .collect() } } #[derive(SimpleObject)] +#[graphql(complex)] struct Review { + id: ID, body: String, - author: User, - product: Product, + pictures: Vec, +} + +#[ComplexObject] +impl Review { + #[graphql(provides = "price")] + async fn product<'a>(&self) -> Product { + self.get_product() + } + + async fn author(&self) -> User { + self.get_author() + } +} + +impl Review { + fn get_product(&self) -> Product { + match self.id.as_str() { + "review-1" => Product { + upc: "top-1".to_string(), + price: 10, + }, + "review-2" => Product { + upc: "top-2".to_string(), + price: 20, + }, + "review-3" => Product { + upc: "top-3".to_string(), + price: 30, + }, + _ => panic!("Unknown review id"), + } + } + + fn get_author(&self) -> User { + let user_id: ID = match self.id.as_str() { + "review-1" => "1234", + "review-2" => "1234", + "review-3" => "7777", + _ => panic!("Unknown review id"), + } + .into(); + user_by_id(user_id, None) + } +} + +#[derive(SimpleObject)] +#[graphql(shareable)] +struct Picture { + url: String, + width: u32, + height: u32, + #[graphql(inaccessible)] // Field not added to Accounts yet + alt_text: String, } struct Query; @@ -56,13 +131,28 @@ struct Query; #[Object] impl Query { #[graphql(entity)] - async fn find_user_by_id(&self, id: ID) -> User { - User { id } + async fn find_user_by_id(&self, #[graphql(key)] id: ID, joined_timestamp: Option) -> User { + user_by_id(id, joined_timestamp) } #[graphql(entity)] async fn find_product_by_upc(&self, upc: String) -> Product { - Product { upc } + Product { upc, price: 0 } + } +} + +fn user_by_id(id: ID, joined_timestamp: Option) -> User { + let review_count = match id.as_str() { + "1234" => 2, + "7777" => 1, + _ => 0, + }; + // This will be set if the user requested the fields that require it. + let joined_timestamp = joined_timestamp.unwrap_or(9001); + User { + id, + review_count, + joined_timestamp, } } @@ -70,25 +160,32 @@ impl Query { async fn main() { let reviews = vec![ Review { + id: "review-1".into(), body: "A highly effective form of birth control.".into(), - author: User { id: "1234".into() }, - product: Product { - upc: "top-1".to_string(), - }, + pictures: vec![ + Picture { + url: "http://localhost:8080/ugly_hat.jpg".to_string(), + width: 100, + height: 100, + alt_text: "A Trilby".to_string(), + }, + Picture { + url: "http://localhost:8080/troll_face.jpg".to_string(), + width: 42, + height: 42, + alt_text: "The troll face meme".to_string(), + }, + ], }, Review { + id: "review-2".into(), body: "Fedoras are one of the most fashionable hats around and can look great with a variety of outfits.".into(), - author: User { id: "1234".into() }, - product: Product { - upc: "top-1".to_string(), - }, + pictures: vec![], }, Review { + id: "review-3".into(), body: "This is the last straw. Hat you will wear. 11/10".into(), - author: User { id: "7777".into() }, - product: Product { - upc: "top-1".to_string(), - }, + pictures: vec![], }, ]; diff --git a/federation/gateway/index.js b/federation/gateway/index.js deleted file mode 100644 index 103fd19..0000000 --- a/federation/gateway/index.js +++ /dev/null @@ -1,19 +0,0 @@ -const { ApolloServer } = require('apollo-server'); -const { ApolloGateway } = require("@apollo/gateway"); - -const gateway = new ApolloGateway({ - serviceList: [ - { name: 'accounts', url: 'http://localhost:4001' }, - { name: 'products', url: 'http://localhost:4002' }, - { name: 'reviews', url: 'http://localhost:4003' } - ], -}); - -const server = new ApolloServer({ - gateway, - subscriptions: false, -}); - -server.listen().then(({ url }) => { - console.log(`🚀 Server ready at ${url}`); -}); diff --git a/federation/gateway/jest.config.js b/federation/gateway/jest.config.js deleted file mode 100644 index d7e4e6e..0000000 --- a/federation/gateway/jest.config.js +++ /dev/null @@ -1,10 +0,0 @@ -module.exports = { - testEnvironment: "node", - testMatch: ["/**/*-test.js"], - testPathIgnorePatterns: ["/node_modules/"], - moduleFileExtensions: ["js"], - modulePaths: ["/node_modules"], - // transform: { - // '^.+\\.jsx?$': 'babel-jest', - // }, -}; diff --git a/federation/gateway/package.json b/federation/gateway/package.json deleted file mode 100644 index f2c1a9a..0000000 --- a/federation/gateway/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "gateway", - "version": "1.0.0", - "main": "index.js", - "dependencies": { - "@apollo/gateway": "^0.11.7", - "apollo-server": "^2.14.2", - "graphql": "^14.6.0" - }, - "devDependencies": { - "apollo-cache-inmemory": "^1.6.5", - "apollo-client": "^2.6.8", - "apollo-link-http": "^1.5.16", - "jest": "^25.1.0", - "node-fetch": "^2.6.0" - } -} diff --git a/federation/gateway/yarn.lock b/federation/gateway/yarn.lock deleted file mode 100644 index d1595f3..0000000 --- a/federation/gateway/yarn.lock +++ /dev/null @@ -1,4854 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -"@apollo/federation@^0.11.3": - version "0.11.3" - resolved "https://registry.npm.taobao.org/@apollo/federation/download/@apollo/federation-0.11.3.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40apollo%2Ffederation%2Fdownload%2F%40apollo%2Ffederation-0.11.3.tgz#82252205c7f90fc69034f2a0073efa71aad52d0e" - integrity sha1-giUiBcf5D8aQNPKgBz76carVLQ4= - dependencies: - apollo-graphql "^0.3.7" - apollo-server-env "^2.4.3" - core-js "^3.4.0" - lodash.xorby "^4.7.0" - -"@apollo/gateway@^0.11.7": - version "0.11.7" - resolved "https://registry.npm.taobao.org/@apollo/gateway/download/@apollo/gateway-0.11.7.tgz#d04b94ef15828209ccd01aa1706e88e56d54ea99" - integrity sha1-0EuU7xWCggnM0BqhcG6I5W1U6pk= - dependencies: - "@apollo/federation" "^0.11.3" - "@types/node-fetch" "2.5.4" - apollo-engine-reporting-protobuf "^0.4.4" - apollo-env "^0.6.1" - apollo-graphql "^0.3.7" - apollo-server-caching "^0.5.1" - apollo-server-core "^2.9.16" - apollo-server-env "^2.4.3" - apollo-server-types "^0.2.10" - graphql-extensions "^0.10.10" - loglevel "^1.6.1" - loglevel-debug "^0.0.1" - pretty-format "^24.7.0" - -"@apollo/protobufjs@^1.0.3": - version "1.0.4" - resolved "https://registry.npm.taobao.org/@apollo/protobufjs/download/@apollo/protobufjs-1.0.4.tgz#cf01747a55359066341f31b5ce8db17df44244e0" - integrity sha1-zwF0elU1kGY0HzG1zo2xffRCROA= - dependencies: - "@protobufjs/aspromise" "^1.1.2" - "@protobufjs/base64" "^1.1.2" - "@protobufjs/codegen" "^2.0.4" - "@protobufjs/eventemitter" "^1.1.0" - "@protobufjs/fetch" "^1.1.0" - "@protobufjs/float" "^1.0.2" - "@protobufjs/inquire" "^1.1.0" - "@protobufjs/path" "^1.1.2" - "@protobufjs/pool" "^1.1.0" - "@protobufjs/utf8" "^1.1.0" - "@types/long" "^4.0.0" - "@types/node" "^10.1.0" - long "^4.0.0" - -"@apollographql/apollo-tools@^0.4.3": - version "0.4.8" - resolved "https://registry.npm.taobao.org/@apollographql/apollo-tools/download/@apollographql/apollo-tools-0.4.8.tgz?cache=0&sync_timestamp=1588778207226&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40apollographql%2Fapollo-tools%2Fdownload%2F%40apollographql%2Fapollo-tools-0.4.8.tgz#d81da89ee880c2345eb86bddb92b35291f6135ed" - integrity sha1-2B2onuiAwjReuGvduSs1KR9hNe0= - dependencies: - apollo-env "^0.6.5" - -"@apollographql/graphql-playground-html@1.6.24": - version "1.6.24" - resolved "https://registry.npm.taobao.org/@apollographql/graphql-playground-html/download/@apollographql/graphql-playground-html-1.6.24.tgz#3ce939cb127fb8aaa3ffc1e90dff9b8af9f2e3dc" - integrity sha1-POk5yxJ/uKqj/8HpDf+bivny49w= - -"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.10.1": - version "7.10.1" - resolved "https://registry.npm.taobao.org/@babel/code-frame/download/@babel/code-frame-7.10.1.tgz?cache=0&sync_timestamp=1590617474297&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Fcode-frame%2Fdownload%2F%40babel%2Fcode-frame-7.10.1.tgz#d5481c5095daa1c57e16e54c6f9198443afb49ff" - integrity sha1-1UgcUJXaocV+FuVMb5GYRDr7Sf8= - dependencies: - "@babel/highlight" "^7.10.1" - -"@babel/core@^7.1.0", "@babel/core@^7.7.5": - version "7.10.2" - resolved "https://registry.npm.taobao.org/@babel/core/download/@babel/core-7.10.2.tgz#bd6786046668a925ac2bd2fd95b579b92a23b36a" - integrity sha1-vWeGBGZoqSWsK9L9lbV5uSojs2o= - dependencies: - "@babel/code-frame" "^7.10.1" - "@babel/generator" "^7.10.2" - "@babel/helper-module-transforms" "^7.10.1" - "@babel/helpers" "^7.10.1" - "@babel/parser" "^7.10.2" - "@babel/template" "^7.10.1" - "@babel/traverse" "^7.10.1" - "@babel/types" "^7.10.2" - convert-source-map "^1.7.0" - debug "^4.1.0" - gensync "^1.0.0-beta.1" - json5 "^2.1.2" - lodash "^4.17.13" - resolve "^1.3.2" - semver "^5.4.1" - source-map "^0.5.0" - -"@babel/generator@^7.10.1", "@babel/generator@^7.10.2": - version "7.10.2" - resolved "https://registry.npm.taobao.org/@babel/generator/download/@babel/generator-7.10.2.tgz#0fa5b5b2389db8bfdfcc3492b551ee20f5dd69a9" - integrity sha1-D6W1sjiduL/fzDSStVHuIPXdaak= - dependencies: - "@babel/types" "^7.10.2" - jsesc "^2.5.1" - lodash "^4.17.13" - source-map "^0.5.0" - -"@babel/helper-function-name@^7.10.1": - version "7.10.1" - resolved "https://registry.npm.taobao.org/@babel/helper-function-name/download/@babel/helper-function-name-7.10.1.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Fhelper-function-name%2Fdownload%2F%40babel%2Fhelper-function-name-7.10.1.tgz#92bd63829bfc9215aca9d9defa85f56b539454f4" - integrity sha1-kr1jgpv8khWsqdne+oX1a1OUVPQ= - dependencies: - "@babel/helper-get-function-arity" "^7.10.1" - "@babel/template" "^7.10.1" - "@babel/types" "^7.10.1" - -"@babel/helper-get-function-arity@^7.10.1": - version "7.10.1" - resolved "https://registry.npm.taobao.org/@babel/helper-get-function-arity/download/@babel/helper-get-function-arity-7.10.1.tgz?cache=0&sync_timestamp=1590617479154&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Fhelper-get-function-arity%2Fdownload%2F%40babel%2Fhelper-get-function-arity-7.10.1.tgz#7303390a81ba7cb59613895a192b93850e373f7d" - integrity sha1-cwM5CoG6fLWWE4laGSuThQ43P30= - dependencies: - "@babel/types" "^7.10.1" - -"@babel/helper-member-expression-to-functions@^7.10.1": - version "7.10.1" - resolved "https://registry.npm.taobao.org/@babel/helper-member-expression-to-functions/download/@babel/helper-member-expression-to-functions-7.10.1.tgz?cache=0&sync_timestamp=1590617479632&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Fhelper-member-expression-to-functions%2Fdownload%2F%40babel%2Fhelper-member-expression-to-functions-7.10.1.tgz#432967fd7e12a4afef66c4687d4ca22bc0456f15" - integrity sha1-Qyln/X4SpK/vZsRofUyiK8BFbxU= - dependencies: - "@babel/types" "^7.10.1" - -"@babel/helper-module-imports@^7.10.1": - version "7.10.1" - resolved "https://registry.npm.taobao.org/@babel/helper-module-imports/download/@babel/helper-module-imports-7.10.1.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Fhelper-module-imports%2Fdownload%2F%40babel%2Fhelper-module-imports-7.10.1.tgz#dd331bd45bccc566ce77004e9d05fe17add13876" - integrity sha1-3TMb1FvMxWbOdwBOnQX+F63ROHY= - dependencies: - "@babel/types" "^7.10.1" - -"@babel/helper-module-transforms@^7.10.1": - version "7.10.1" - resolved "https://registry.npm.taobao.org/@babel/helper-module-transforms/download/@babel/helper-module-transforms-7.10.1.tgz#24e2f08ee6832c60b157bb0936c86bef7210c622" - integrity sha1-JOLwjuaDLGCxV7sJNshr73IQxiI= - dependencies: - "@babel/helper-module-imports" "^7.10.1" - "@babel/helper-replace-supers" "^7.10.1" - "@babel/helper-simple-access" "^7.10.1" - "@babel/helper-split-export-declaration" "^7.10.1" - "@babel/template" "^7.10.1" - "@babel/types" "^7.10.1" - lodash "^4.17.13" - -"@babel/helper-optimise-call-expression@^7.10.1": - version "7.10.1" - resolved "https://registry.npm.taobao.org/@babel/helper-optimise-call-expression/download/@babel/helper-optimise-call-expression-7.10.1.tgz?cache=0&sync_timestamp=1590617480443&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Fhelper-optimise-call-expression%2Fdownload%2F%40babel%2Fhelper-optimise-call-expression-7.10.1.tgz#b4a1f2561870ce1247ceddb02a3860fa96d72543" - integrity sha1-tKHyVhhwzhJHzt2wKjhg+pbXJUM= - dependencies: - "@babel/types" "^7.10.1" - -"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.1", "@babel/helper-plugin-utils@^7.8.0": - version "7.10.1" - resolved "https://registry.npm.taobao.org/@babel/helper-plugin-utils/download/@babel/helper-plugin-utils-7.10.1.tgz#ec5a5cf0eec925b66c60580328b122c01230a127" - integrity sha1-7Fpc8O7JJbZsYFgDKLEiwBIwoSc= - -"@babel/helper-replace-supers@^7.10.1": - version "7.10.1" - resolved "https://registry.npm.taobao.org/@babel/helper-replace-supers/download/@babel/helper-replace-supers-7.10.1.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Fhelper-replace-supers%2Fdownload%2F%40babel%2Fhelper-replace-supers-7.10.1.tgz#ec6859d20c5d8087f6a2dc4e014db7228975f13d" - integrity sha1-7GhZ0gxdgIf2otxOAU23Iol18T0= - dependencies: - "@babel/helper-member-expression-to-functions" "^7.10.1" - "@babel/helper-optimise-call-expression" "^7.10.1" - "@babel/traverse" "^7.10.1" - "@babel/types" "^7.10.1" - -"@babel/helper-simple-access@^7.10.1": - version "7.10.1" - resolved "https://registry.npm.taobao.org/@babel/helper-simple-access/download/@babel/helper-simple-access-7.10.1.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Fhelper-simple-access%2Fdownload%2F%40babel%2Fhelper-simple-access-7.10.1.tgz#08fb7e22ace9eb8326f7e3920a1c2052f13d851e" - integrity sha1-CPt+Iqzp64Mm9+OSChwgUvE9hR4= - dependencies: - "@babel/template" "^7.10.1" - "@babel/types" "^7.10.1" - -"@babel/helper-split-export-declaration@^7.10.1": - version "7.10.1" - resolved "https://registry.npm.taobao.org/@babel/helper-split-export-declaration/download/@babel/helper-split-export-declaration-7.10.1.tgz#c6f4be1cbc15e3a868e4c64a17d5d31d754da35f" - integrity sha1-xvS+HLwV46ho5MZKF9XTHXVNo18= - dependencies: - "@babel/types" "^7.10.1" - -"@babel/helper-validator-identifier@^7.10.1": - version "7.10.1" - resolved "https://registry.npm.taobao.org/@babel/helper-validator-identifier/download/@babel/helper-validator-identifier-7.10.1.tgz?cache=0&sync_timestamp=1590617283450&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Fhelper-validator-identifier%2Fdownload%2F%40babel%2Fhelper-validator-identifier-7.10.1.tgz#5770b0c1a826c4f53f5ede5e153163e0318e94b5" - integrity sha1-V3CwwagmxPU/Xt5eFTFj4DGOlLU= - -"@babel/helpers@^7.10.1": - version "7.10.1" - resolved "https://registry.npm.taobao.org/@babel/helpers/download/@babel/helpers-7.10.1.tgz#a6827b7cb975c9d9cef5fd61d919f60d8844a973" - integrity sha1-poJ7fLl1ydnO9f1h2Rn2DYhEqXM= - dependencies: - "@babel/template" "^7.10.1" - "@babel/traverse" "^7.10.1" - "@babel/types" "^7.10.1" - -"@babel/highlight@^7.10.1": - version "7.10.1" - resolved "https://registry.npm.taobao.org/@babel/highlight/download/@babel/highlight-7.10.1.tgz?cache=0&sync_timestamp=1590617273104&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Fhighlight%2Fdownload%2F%40babel%2Fhighlight-7.10.1.tgz#841d098ba613ba1a427a2b383d79e35552c38ae0" - integrity sha1-hB0Ji6YTuhpCeis4PXnjVVLDiuA= - dependencies: - "@babel/helper-validator-identifier" "^7.10.1" - chalk "^2.0.0" - js-tokens "^4.0.0" - -"@babel/parser@^7.1.0", "@babel/parser@^7.10.1", "@babel/parser@^7.10.2": - version "7.10.2" - resolved "https://registry.npm.taobao.org/@babel/parser/download/@babel/parser-7.10.2.tgz#871807f10442b92ff97e4783b9b54f6a0ca812d0" - integrity sha1-hxgH8QRCuS/5fkeDubVPagyoEtA= - -"@babel/plugin-syntax-async-generators@^7.8.4": - version "7.8.4" - resolved "https://registry.npm.taobao.org/@babel/plugin-syntax-async-generators/download/@babel/plugin-syntax-async-generators-7.8.4.tgz#a983fb1aeb2ec3f6ed042a210f640e90e786fe0d" - integrity sha1-qYP7Gusuw/btBCohD2QOkOeG/g0= - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - -"@babel/plugin-syntax-bigint@^7.8.3": - version "7.8.3" - resolved "https://registry.npm.taobao.org/@babel/plugin-syntax-bigint/download/@babel/plugin-syntax-bigint-7.8.3.tgz#4c9a6f669f5d0cdf1b90a1671e9a146be5300cea" - integrity sha1-TJpvZp9dDN8bkKFnHpoUa+UwDOo= - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - -"@babel/plugin-syntax-class-properties@^7.8.3": - version "7.10.1" - resolved "https://registry.npm.taobao.org/@babel/plugin-syntax-class-properties/download/@babel/plugin-syntax-class-properties-7.10.1.tgz#d5bc0645913df5b17ad7eda0fa2308330bde34c5" - integrity sha1-1bwGRZE99bF61+2g+iMIMwveNMU= - dependencies: - "@babel/helper-plugin-utils" "^7.10.1" - -"@babel/plugin-syntax-json-strings@^7.8.3": - version "7.8.3" - resolved "https://registry.npm.taobao.org/@babel/plugin-syntax-json-strings/download/@babel/plugin-syntax-json-strings-7.8.3.tgz#01ca21b668cd8218c9e640cb6dd88c5412b2c96a" - integrity sha1-AcohtmjNghjJ5kDLbdiMVBKyyWo= - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - -"@babel/plugin-syntax-logical-assignment-operators@^7.8.3": - version "7.10.1" - resolved "https://registry.npm.taobao.org/@babel/plugin-syntax-logical-assignment-operators/download/@babel/plugin-syntax-logical-assignment-operators-7.10.1.tgz#fffee77b4934ce77f3b427649ecdddbec1958550" - integrity sha1-//7ne0k0znfztCdkns3dvsGVhVA= - dependencies: - "@babel/helper-plugin-utils" "^7.10.1" - -"@babel/plugin-syntax-nullish-coalescing-operator@^7.8.3": - version "7.8.3" - resolved "https://registry.npm.taobao.org/@babel/plugin-syntax-nullish-coalescing-operator/download/@babel/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz#167ed70368886081f74b5c36c65a88c03b66d1a9" - integrity sha1-Fn7XA2iIYIH3S1w2xlqIwDtm0ak= - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - -"@babel/plugin-syntax-numeric-separator@^7.8.3": - version "7.10.1" - resolved "https://registry.npm.taobao.org/@babel/plugin-syntax-numeric-separator/download/@babel/plugin-syntax-numeric-separator-7.10.1.tgz?cache=0&sync_timestamp=1590617252576&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Fplugin-syntax-numeric-separator%2Fdownload%2F%40babel%2Fplugin-syntax-numeric-separator-7.10.1.tgz#25761ee7410bc8cf97327ba741ee94e4a61b7d99" - integrity sha1-JXYe50ELyM+XMnunQe6U5KYbfZk= - dependencies: - "@babel/helper-plugin-utils" "^7.10.1" - -"@babel/plugin-syntax-object-rest-spread@^7.8.3": - version "7.8.3" - resolved "https://registry.npm.taobao.org/@babel/plugin-syntax-object-rest-spread/download/@babel/plugin-syntax-object-rest-spread-7.8.3.tgz?cache=0&sync_timestamp=1578950070697&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Fplugin-syntax-object-rest-spread%2Fdownload%2F%40babel%2Fplugin-syntax-object-rest-spread-7.8.3.tgz#60e225edcbd98a640332a2e72dd3e66f1af55871" - integrity sha1-YOIl7cvZimQDMqLnLdPmbxr1WHE= - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - -"@babel/plugin-syntax-optional-catch-binding@^7.8.3": - version "7.8.3" - resolved "https://registry.npm.taobao.org/@babel/plugin-syntax-optional-catch-binding/download/@babel/plugin-syntax-optional-catch-binding-7.8.3.tgz#6111a265bcfb020eb9efd0fdfd7d26402b9ed6c1" - integrity sha1-YRGiZbz7Ag6579D9/X0mQCue1sE= - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - -"@babel/plugin-syntax-optional-chaining@^7.8.3": - version "7.8.3" - resolved "https://registry.npm.taobao.org/@babel/plugin-syntax-optional-chaining/download/@babel/plugin-syntax-optional-chaining-7.8.3.tgz?cache=0&sync_timestamp=1578952519472&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Fplugin-syntax-optional-chaining%2Fdownload%2F%40babel%2Fplugin-syntax-optional-chaining-7.8.3.tgz#4f69c2ab95167e0180cd5336613f8c5788f7d48a" - integrity sha1-T2nCq5UWfgGAzVM2YT+MV4j31Io= - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - -"@babel/template@^7.10.1", "@babel/template@^7.3.3": - version "7.10.1" - resolved "https://registry.npm.taobao.org/@babel/template/download/@babel/template-7.10.1.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Ftemplate%2Fdownload%2F%40babel%2Ftemplate-7.10.1.tgz#e167154a94cb5f14b28dc58f5356d2162f539811" - integrity sha1-4WcVSpTLXxSyjcWPU1bSFi9TmBE= - dependencies: - "@babel/code-frame" "^7.10.1" - "@babel/parser" "^7.10.1" - "@babel/types" "^7.10.1" - -"@babel/traverse@^7.1.0", "@babel/traverse@^7.10.1": - version "7.10.1" - resolved "https://registry.npm.taobao.org/@babel/traverse/download/@babel/traverse-7.10.1.tgz#bbcef3031e4152a6c0b50147f4958df54ca0dd27" - integrity sha1-u87zAx5BUqbAtQFH9JWN9Uyg3Sc= - dependencies: - "@babel/code-frame" "^7.10.1" - "@babel/generator" "^7.10.1" - "@babel/helper-function-name" "^7.10.1" - "@babel/helper-split-export-declaration" "^7.10.1" - "@babel/parser" "^7.10.1" - "@babel/types" "^7.10.1" - debug "^4.1.0" - globals "^11.1.0" - lodash "^4.17.13" - -"@babel/types@^7.0.0", "@babel/types@^7.10.1", "@babel/types@^7.10.2", "@babel/types@^7.3.0", "@babel/types@^7.3.3": - version "7.10.2" - resolved "https://registry.npm.taobao.org/@babel/types/download/@babel/types-7.10.2.tgz#30283be31cad0dbf6fb00bd40641ca0ea675172d" - integrity sha1-MCg74xytDb9vsAvUBkHKDqZ1Fy0= - dependencies: - "@babel/helper-validator-identifier" "^7.10.1" - lodash "^4.17.13" - to-fast-properties "^2.0.0" - -"@bcoe/v8-coverage@^0.2.3": - version "0.2.3" - resolved "https://registry.npm.taobao.org/@bcoe/v8-coverage/download/@bcoe/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" - integrity sha1-daLotRy3WKdVPWgEpZMteqznXDk= - -"@cnakazawa/watch@^1.0.3": - version "1.0.4" - resolved "https://registry.npm.taobao.org/@cnakazawa/watch/download/@cnakazawa/watch-1.0.4.tgz?cache=0&sync_timestamp=1581464245811&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40cnakazawa%2Fwatch%2Fdownload%2F%40cnakazawa%2Fwatch-1.0.4.tgz#f864ae85004d0fcab6f50be9141c4da368d1656a" - integrity sha1-+GSuhQBND8q29QvpFBxNo2jRZWo= - dependencies: - exec-sh "^0.3.2" - minimist "^1.2.0" - -"@istanbuljs/load-nyc-config@^1.0.0": - version "1.1.0" - resolved "https://registry.npm.taobao.org/@istanbuljs/load-nyc-config/download/@istanbuljs/load-nyc-config-1.1.0.tgz#fd3db1d59ecf7cf121e80650bb86712f9b55eced" - integrity sha1-/T2x1Z7PfPEh6AZQu4ZxL5tV7O0= - dependencies: - camelcase "^5.3.1" - find-up "^4.1.0" - get-package-type "^0.1.0" - js-yaml "^3.13.1" - resolve-from "^5.0.0" - -"@istanbuljs/schema@^0.1.2": - version "0.1.2" - resolved "https://registry.npm.taobao.org/@istanbuljs/schema/download/@istanbuljs/schema-0.1.2.tgz#26520bf09abe4a5644cd5414e37125a8954241dd" - integrity sha1-JlIL8Jq+SlZEzVQU43ElqJVCQd0= - -"@jest/console@^25.5.0": - version "25.5.0" - resolved "https://registry.npm.taobao.org/@jest/console/download/@jest/console-25.5.0.tgz?cache=0&sync_timestamp=1588675319681&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40jest%2Fconsole%2Fdownload%2F%40jest%2Fconsole-25.5.0.tgz#770800799d510f37329c508a9edd0b7b447d9abb" - integrity sha1-dwgAeZ1RDzcynFCKnt0Le0R9mrs= - dependencies: - "@jest/types" "^25.5.0" - chalk "^3.0.0" - jest-message-util "^25.5.0" - jest-util "^25.5.0" - slash "^3.0.0" - -"@jest/core@^25.5.4": - version "25.5.4" - resolved "https://registry.npm.taobao.org/@jest/core/download/@jest/core-25.5.4.tgz?cache=0&sync_timestamp=1588675318326&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40jest%2Fcore%2Fdownload%2F%40jest%2Fcore-25.5.4.tgz#3ef7412f7339210f003cdf36646bbca786efe7b4" - integrity sha1-PvdBL3M5IQ8APN82ZGu8p4bv57Q= - dependencies: - "@jest/console" "^25.5.0" - "@jest/reporters" "^25.5.1" - "@jest/test-result" "^25.5.0" - "@jest/transform" "^25.5.1" - "@jest/types" "^25.5.0" - ansi-escapes "^4.2.1" - chalk "^3.0.0" - exit "^0.1.2" - graceful-fs "^4.2.4" - jest-changed-files "^25.5.0" - jest-config "^25.5.4" - jest-haste-map "^25.5.1" - jest-message-util "^25.5.0" - jest-regex-util "^25.2.6" - jest-resolve "^25.5.1" - jest-resolve-dependencies "^25.5.4" - jest-runner "^25.5.4" - jest-runtime "^25.5.4" - jest-snapshot "^25.5.1" - jest-util "^25.5.0" - jest-validate "^25.5.0" - jest-watcher "^25.5.0" - micromatch "^4.0.2" - p-each-series "^2.1.0" - realpath-native "^2.0.0" - rimraf "^3.0.0" - slash "^3.0.0" - strip-ansi "^6.0.0" - -"@jest/environment@^25.5.0": - version "25.5.0" - resolved "https://registry.npm.taobao.org/@jest/environment/download/@jest/environment-25.5.0.tgz?cache=0&sync_timestamp=1588675332085&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40jest%2Fenvironment%2Fdownload%2F%40jest%2Fenvironment-25.5.0.tgz#aa33b0c21a716c65686638e7ef816c0e3a0c7b37" - integrity sha1-qjOwwhpxbGVoZjjn74FsDjoMezc= - dependencies: - "@jest/fake-timers" "^25.5.0" - "@jest/types" "^25.5.0" - jest-mock "^25.5.0" - -"@jest/fake-timers@^25.5.0": - version "25.5.0" - resolved "https://registry.npm.taobao.org/@jest/fake-timers/download/@jest/fake-timers-25.5.0.tgz?cache=0&sync_timestamp=1588675324067&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40jest%2Ffake-timers%2Fdownload%2F%40jest%2Ffake-timers-25.5.0.tgz#46352e00533c024c90c2bc2ad9f2959f7f114185" - integrity sha1-RjUuAFM8AkyQwrwq2fKVn38RQYU= - dependencies: - "@jest/types" "^25.5.0" - jest-message-util "^25.5.0" - jest-mock "^25.5.0" - jest-util "^25.5.0" - lolex "^5.0.0" - -"@jest/globals@^25.5.2": - version "25.5.2" - resolved "https://registry.npm.taobao.org/@jest/globals/download/@jest/globals-25.5.2.tgz?cache=0&sync_timestamp=1588675303209&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40jest%2Fglobals%2Fdownload%2F%40jest%2Fglobals-25.5.2.tgz#5e45e9de8d228716af3257eeb3991cc2e162ca88" - integrity sha1-XkXp3o0ihxavMlfus5kcwuFiyog= - dependencies: - "@jest/environment" "^25.5.0" - "@jest/types" "^25.5.0" - expect "^25.5.0" - -"@jest/reporters@^25.5.1": - version "25.5.1" - resolved "https://registry.npm.taobao.org/@jest/reporters/download/@jest/reporters-25.5.1.tgz#cb686bcc680f664c2dbaf7ed873e93aa6811538b" - integrity sha1-y2hrzGgPZkwtuvfthz6TqmgRU4s= - dependencies: - "@bcoe/v8-coverage" "^0.2.3" - "@jest/console" "^25.5.0" - "@jest/test-result" "^25.5.0" - "@jest/transform" "^25.5.1" - "@jest/types" "^25.5.0" - chalk "^3.0.0" - collect-v8-coverage "^1.0.0" - exit "^0.1.2" - glob "^7.1.2" - graceful-fs "^4.2.4" - istanbul-lib-coverage "^3.0.0" - istanbul-lib-instrument "^4.0.0" - istanbul-lib-report "^3.0.0" - istanbul-lib-source-maps "^4.0.0" - istanbul-reports "^3.0.2" - jest-haste-map "^25.5.1" - jest-resolve "^25.5.1" - jest-util "^25.5.0" - jest-worker "^25.5.0" - slash "^3.0.0" - source-map "^0.6.0" - string-length "^3.1.0" - terminal-link "^2.0.0" - v8-to-istanbul "^4.1.3" - optionalDependencies: - node-notifier "^6.0.0" - -"@jest/source-map@^25.5.0": - version "25.5.0" - resolved "https://registry.npm.taobao.org/@jest/source-map/download/@jest/source-map-25.5.0.tgz#df5c20d6050aa292c2c6d3f0d2c7606af315bd1b" - integrity sha1-31wg1gUKopLCxtPw0sdgavMVvRs= - dependencies: - callsites "^3.0.0" - graceful-fs "^4.2.4" - source-map "^0.6.0" - -"@jest/test-result@^25.5.0": - version "25.5.0" - resolved "https://registry.npm.taobao.org/@jest/test-result/download/@jest/test-result-25.5.0.tgz#139a043230cdeffe9ba2d8341b27f2efc77ce87c" - integrity sha1-E5oEMjDN7/6botg0Gyfy78d86Hw= - dependencies: - "@jest/console" "^25.5.0" - "@jest/types" "^25.5.0" - "@types/istanbul-lib-coverage" "^2.0.0" - collect-v8-coverage "^1.0.0" - -"@jest/test-sequencer@^25.5.4": - version "25.5.4" - resolved "https://registry.npm.taobao.org/@jest/test-sequencer/download/@jest/test-sequencer-25.5.4.tgz?cache=0&sync_timestamp=1588675313073&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40jest%2Ftest-sequencer%2Fdownload%2F%40jest%2Ftest-sequencer-25.5.4.tgz#9b4e685b36954c38d0f052e596d28161bdc8b737" - integrity sha1-m05oWzaVTDjQ8FLlltKBYb3Itzc= - dependencies: - "@jest/test-result" "^25.5.0" - graceful-fs "^4.2.4" - jest-haste-map "^25.5.1" - jest-runner "^25.5.4" - jest-runtime "^25.5.4" - -"@jest/transform@^25.5.1": - version "25.5.1" - resolved "https://registry.npm.taobao.org/@jest/transform/download/@jest/transform-25.5.1.tgz#0469ddc17699dd2bf985db55fa0fb9309f5c2db3" - integrity sha1-BGndwXaZ3Sv5hdtV+g+5MJ9cLbM= - dependencies: - "@babel/core" "^7.1.0" - "@jest/types" "^25.5.0" - babel-plugin-istanbul "^6.0.0" - chalk "^3.0.0" - convert-source-map "^1.4.0" - fast-json-stable-stringify "^2.0.0" - graceful-fs "^4.2.4" - jest-haste-map "^25.5.1" - jest-regex-util "^25.2.6" - jest-util "^25.5.0" - micromatch "^4.0.2" - pirates "^4.0.1" - realpath-native "^2.0.0" - slash "^3.0.0" - source-map "^0.6.1" - write-file-atomic "^3.0.0" - -"@jest/types@^24.9.0": - version "24.9.0" - resolved "https://registry.npm.taobao.org/@jest/types/download/@jest/types-24.9.0.tgz?cache=0&sync_timestamp=1588675411534&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40jest%2Ftypes%2Fdownload%2F%40jest%2Ftypes-24.9.0.tgz#63cb26cb7500d069e5a389441a7c6ab5e909fc59" - integrity sha1-Y8smy3UA0Gnlo4lEGnxqtekJ/Fk= - dependencies: - "@types/istanbul-lib-coverage" "^2.0.0" - "@types/istanbul-reports" "^1.1.1" - "@types/yargs" "^13.0.0" - -"@jest/types@^25.5.0": - version "25.5.0" - resolved "https://registry.npm.taobao.org/@jest/types/download/@jest/types-25.5.0.tgz?cache=0&sync_timestamp=1588675411534&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40jest%2Ftypes%2Fdownload%2F%40jest%2Ftypes-25.5.0.tgz#4d6a4793f7b9599fc3680877b856a97dbccf2a9d" - integrity sha1-TWpHk/e5WZ/DaAh3uFapfbzPKp0= - dependencies: - "@types/istanbul-lib-coverage" "^2.0.0" - "@types/istanbul-reports" "^1.1.1" - "@types/yargs" "^15.0.0" - chalk "^3.0.0" - -"@protobufjs/aspromise@^1.1.1", "@protobufjs/aspromise@^1.1.2": - version "1.1.2" - resolved "https://registry.npm.taobao.org/@protobufjs/aspromise/download/@protobufjs/aspromise-1.1.2.tgz#9b8b0cc663d669a7d8f6f5d0893a14d348f30fbf" - integrity sha1-m4sMxmPWaafY9vXQiToU00jzD78= - -"@protobufjs/base64@^1.1.2": - version "1.1.2" - resolved "https://registry.npm.taobao.org/@protobufjs/base64/download/@protobufjs/base64-1.1.2.tgz#4c85730e59b9a1f1f349047dbf24296034bb2735" - integrity sha1-TIVzDlm5ofHzSQR9vyQpYDS7JzU= - -"@protobufjs/codegen@^2.0.4": - version "2.0.4" - resolved "https://registry.npm.taobao.org/@protobufjs/codegen/download/@protobufjs/codegen-2.0.4.tgz#7ef37f0d010fb028ad1ad59722e506d9262815cb" - integrity sha1-fvN/DQEPsCitGtWXIuUG2SYoFcs= - -"@protobufjs/eventemitter@^1.1.0": - version "1.1.0" - resolved "https://registry.npm.taobao.org/@protobufjs/eventemitter/download/@protobufjs/eventemitter-1.1.0.tgz#355cbc98bafad5978f9ed095f397621f1d066b70" - integrity sha1-NVy8mLr61ZePntCV85diHx0Ga3A= - -"@protobufjs/fetch@^1.1.0": - version "1.1.0" - resolved "https://registry.npm.taobao.org/@protobufjs/fetch/download/@protobufjs/fetch-1.1.0.tgz#ba99fb598614af65700c1619ff06d454b0d84c45" - integrity sha1-upn7WYYUr2VwDBYZ/wbUVLDYTEU= - dependencies: - "@protobufjs/aspromise" "^1.1.1" - "@protobufjs/inquire" "^1.1.0" - -"@protobufjs/float@^1.0.2": - version "1.0.2" - resolved "https://registry.npm.taobao.org/@protobufjs/float/download/@protobufjs/float-1.0.2.tgz#5e9e1abdcb73fc0a7cb8b291df78c8cbd97b87d1" - integrity sha1-Xp4avctz/Ap8uLKR33jIy9l7h9E= - -"@protobufjs/inquire@^1.1.0": - version "1.1.0" - resolved "https://registry.npm.taobao.org/@protobufjs/inquire/download/@protobufjs/inquire-1.1.0.tgz#ff200e3e7cf2429e2dcafc1140828e8cc638f089" - integrity sha1-/yAOPnzyQp4tyvwRQIKOjMY48Ik= - -"@protobufjs/path@^1.1.2": - version "1.1.2" - resolved "https://registry.npm.taobao.org/@protobufjs/path/download/@protobufjs/path-1.1.2.tgz#6cc2b20c5c9ad6ad0dccfd21ca7673d8d7fbf68d" - integrity sha1-bMKyDFya1q0NzP0hynZz2Nf79o0= - -"@protobufjs/pool@^1.1.0": - version "1.1.0" - resolved "https://registry.npm.taobao.org/@protobufjs/pool/download/@protobufjs/pool-1.1.0.tgz#09fd15f2d6d3abfa9b65bc366506d6ad7846ff54" - integrity sha1-Cf0V8tbTq/qbZbw2ZQbWrXhG/1Q= - -"@protobufjs/utf8@^1.1.0": - version "1.1.0" - resolved "https://registry.npm.taobao.org/@protobufjs/utf8/download/@protobufjs/utf8-1.1.0.tgz#a777360b5b39a1a2e5106f8e858f2fd2d060c570" - integrity sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA= - -"@sinonjs/commons@^1.7.0": - version "1.8.0" - resolved "https://registry.npm.taobao.org/@sinonjs/commons/download/@sinonjs/commons-1.8.0.tgz?cache=0&sync_timestamp=1589985122148&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40sinonjs%2Fcommons%2Fdownload%2F%40sinonjs%2Fcommons-1.8.0.tgz#c8d68821a854c555bba172f3b06959a0039b236d" - integrity sha1-yNaIIahUxVW7oXLzsGlZoAObI20= - dependencies: - type-detect "4.0.8" - -"@types/accepts@*", "@types/accepts@^1.3.5": - version "1.3.5" - resolved "https://registry.npm.taobao.org/@types/accepts/download/@types/accepts-1.3.5.tgz#c34bec115cfc746e04fe5a059df4ce7e7b391575" - integrity sha1-w0vsEVz8dG4E/loFnfTOfns5FXU= - dependencies: - "@types/node" "*" - -"@types/babel__core@^7.1.7": - version "7.1.8" - resolved "https://registry.npm.taobao.org/@types/babel__core/download/@types/babel__core-7.1.8.tgz#057f725aca3641f49fc11c7a87a9de5ec588a5d7" - integrity sha1-BX9yWso2QfSfwRx6h6neXsWIpdc= - dependencies: - "@babel/parser" "^7.1.0" - "@babel/types" "^7.0.0" - "@types/babel__generator" "*" - "@types/babel__template" "*" - "@types/babel__traverse" "*" - -"@types/babel__generator@*": - version "7.6.1" - resolved "https://registry.npm.taobao.org/@types/babel__generator/download/@types/babel__generator-7.6.1.tgz#4901767b397e8711aeb99df8d396d7ba7b7f0e04" - integrity sha1-SQF2ezl+hxGuuZ3405bXunt/DgQ= - dependencies: - "@babel/types" "^7.0.0" - -"@types/babel__template@*": - version "7.0.2" - resolved "https://registry.npm.taobao.org/@types/babel__template/download/@types/babel__template-7.0.2.tgz#4ff63d6b52eddac1de7b975a5223ed32ecea9307" - integrity sha1-T/Y9a1Lt2sHee5daUiPtMuzqkwc= - dependencies: - "@babel/parser" "^7.1.0" - "@babel/types" "^7.0.0" - -"@types/babel__traverse@*", "@types/babel__traverse@^7.0.6": - version "7.0.12" - resolved "https://registry.npm.taobao.org/@types/babel__traverse/download/@types/babel__traverse-7.0.12.tgz?cache=0&sync_timestamp=1591055744630&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40types%2Fbabel__traverse%2Fdownload%2F%40types%2Fbabel__traverse-7.0.12.tgz#22f49a028e69465390f87bb103ebd61bd086b8f5" - integrity sha1-IvSaAo5pRlOQ+HuxA+vWG9CGuPU= - dependencies: - "@babel/types" "^7.3.0" - -"@types/body-parser@*", "@types/body-parser@1.19.0": - version "1.19.0" - resolved "https://registry.npm.taobao.org/@types/body-parser/download/@types/body-parser-1.19.0.tgz#0685b3c47eb3006ffed117cdd55164b61f80538f" - integrity sha1-BoWzxH6zAG/+0RfN1VFkth+AU48= - dependencies: - "@types/connect" "*" - "@types/node" "*" - -"@types/color-name@^1.1.1": - version "1.1.1" - resolved "https://registry.npm.taobao.org/@types/color-name/download/@types/color-name-1.1.1.tgz?cache=0&sync_timestamp=1588199741420&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40types%2Fcolor-name%2Fdownload%2F%40types%2Fcolor-name-1.1.1.tgz#1c1261bbeaa10a8055bbc5d8ab84b7b2afc846a0" - integrity sha1-HBJhu+qhCoBVu8XYq4S3sq/IRqA= - -"@types/connect@*": - version "3.4.33" - resolved "https://registry.npm.taobao.org/@types/connect/download/@types/connect-3.4.33.tgz#31610c901eca573b8713c3330abc6e6b9f588546" - integrity sha1-MWEMkB7KVzuHE8MzCrxua59YhUY= - dependencies: - "@types/node" "*" - -"@types/content-disposition@*": - version "0.5.3" - resolved "https://registry.npm.taobao.org/@types/content-disposition/download/@types/content-disposition-0.5.3.tgz#0aa116701955c2faa0717fc69cd1596095e49d96" - integrity sha1-CqEWcBlVwvqgcX/GnNFZYJXknZY= - -"@types/cookies@*": - version "0.7.4" - resolved "https://registry.npm.taobao.org/@types/cookies/download/@types/cookies-0.7.4.tgz#26dedf791701abc0e36b5b79a5722f40e455f87b" - integrity sha1-Jt7feRcBq8Dja1t5pXIvQORV+Hs= - dependencies: - "@types/connect" "*" - "@types/express" "*" - "@types/keygrip" "*" - "@types/node" "*" - -"@types/cors@^2.8.4": - version "2.8.6" - resolved "https://registry.npm.taobao.org/@types/cors/download/@types/cors-2.8.6.tgz#cfaab33c49c15b1ded32f235111ce9123009bd02" - integrity sha1-z6qzPEnBWx3tMvI1ERzpEjAJvQI= - dependencies: - "@types/express" "*" - -"@types/express-serve-static-core@*": - version "4.17.7" - resolved "https://registry.npm.taobao.org/@types/express-serve-static-core/download/@types/express-serve-static-core-4.17.7.tgz#dfe61f870eb549dc6d7e12050901847c7d7e915b" - integrity sha1-3+Yfhw61SdxtfhIFCQGEfH1+kVs= - dependencies: - "@types/node" "*" - "@types/qs" "*" - "@types/range-parser" "*" - -"@types/express@*": - version "4.17.6" - resolved "https://registry.npm.taobao.org/@types/express/download/@types/express-4.17.6.tgz#6bce49e49570507b86ea1b07b806f04697fac45e" - integrity sha1-a85J5JVwUHuG6hsHuAbwRpf6xF4= - dependencies: - "@types/body-parser" "*" - "@types/express-serve-static-core" "*" - "@types/qs" "*" - "@types/serve-static" "*" - -"@types/express@4.17.4": - version "4.17.4" - resolved "https://registry.npm.taobao.org/@types/express/download/@types/express-4.17.4.tgz#e78bf09f3f530889575f4da8a94cd45384520aac" - integrity sha1-54vwnz9TCIlXX02oqUzUU4RSCqw= - dependencies: - "@types/body-parser" "*" - "@types/express-serve-static-core" "*" - "@types/qs" "*" - "@types/serve-static" "*" - -"@types/fs-capacitor@*": - version "2.0.0" - resolved "https://registry.npm.taobao.org/@types/fs-capacitor/download/@types/fs-capacitor-2.0.0.tgz#17113e25817f584f58100fb7a08eed288b81956e" - integrity sha1-FxE+JYF/WE9YEA+3oI7tKIuBlW4= - dependencies: - "@types/node" "*" - -"@types/graceful-fs@^4.1.2": - version "4.1.3" - resolved "https://registry.npm.taobao.org/@types/graceful-fs/download/@types/graceful-fs-4.1.3.tgz#039af35fe26bec35003e8d86d2ee9c586354348f" - integrity sha1-A5rzX+Jr7DUAPo2G0u6cWGNUNI8= - dependencies: - "@types/node" "*" - -"@types/graphql-upload@^8.0.0": - version "8.0.3" - resolved "https://registry.npm.taobao.org/@types/graphql-upload/download/@types/graphql-upload-8.0.3.tgz#b371edb5f305a2a1f7b7843a890a2a7adc55c3ec" - integrity sha1-s3HttfMFoqH3t4Q6iQoqetxVw+w= - dependencies: - "@types/express" "*" - "@types/fs-capacitor" "*" - "@types/koa" "*" - graphql "^14.5.3" - -"@types/http-assert@*": - version "1.5.1" - resolved "https://registry.npm.taobao.org/@types/http-assert/download/@types/http-assert-1.5.1.tgz#d775e93630c2469c2f980fc27e3143240335db3b" - integrity sha1-13XpNjDCRpwvmA/CfjFDJAM12zs= - -"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0", "@types/istanbul-lib-coverage@^2.0.1": - version "2.0.2" - resolved "https://registry.npm.taobao.org/@types/istanbul-lib-coverage/download/@types/istanbul-lib-coverage-2.0.2.tgz#79d7a78bad4219f4c03d6557a1c72d9ca6ba62d5" - integrity sha1-edeni61CGfTAPWVXocctnKa6YtU= - -"@types/istanbul-lib-report@*": - version "3.0.0" - resolved "https://registry.npm.taobao.org/@types/istanbul-lib-report/download/@types/istanbul-lib-report-3.0.0.tgz#c14c24f18ea8190c118ee7562b7ff99a36552686" - integrity sha1-wUwk8Y6oGQwRjudWK3/5mjZVJoY= - dependencies: - "@types/istanbul-lib-coverage" "*" - -"@types/istanbul-reports@^1.1.1": - version "1.1.2" - resolved "https://registry.npm.taobao.org/@types/istanbul-reports/download/@types/istanbul-reports-1.1.2.tgz#e875cc689e47bce549ec81f3df5e6f6f11cfaeb2" - integrity sha1-6HXMaJ5HvOVJ7IHz315vbxHPrrI= - dependencies: - "@types/istanbul-lib-coverage" "*" - "@types/istanbul-lib-report" "*" - -"@types/keygrip@*": - version "1.0.2" - resolved "https://registry.npm.taobao.org/@types/keygrip/download/@types/keygrip-1.0.2.tgz#513abfd256d7ad0bf1ee1873606317b33b1b2a72" - integrity sha1-UTq/0lbXrQvx7hhzYGMXszsbKnI= - -"@types/koa-compose@*": - version "3.2.5" - resolved "https://registry.npm.taobao.org/@types/koa-compose/download/@types/koa-compose-3.2.5.tgz#85eb2e80ac50be95f37ccf8c407c09bbe3468e9d" - integrity sha1-hesugKxQvpXzfM+MQHwJu+NGjp0= - dependencies: - "@types/koa" "*" - -"@types/koa@*": - version "2.11.3" - resolved "https://registry.npm.taobao.org/@types/koa/download/@types/koa-2.11.3.tgz#540ece376581b12beadf9a417dd1731bc31c16ce" - integrity sha1-VA7ON2WBsSvq35pBfdFzG8McFs4= - dependencies: - "@types/accepts" "*" - "@types/content-disposition" "*" - "@types/cookies" "*" - "@types/http-assert" "*" - "@types/keygrip" "*" - "@types/koa-compose" "*" - "@types/node" "*" - -"@types/long@^4.0.0": - version "4.0.1" - resolved "https://registry.npm.taobao.org/@types/long/download/@types/long-4.0.1.tgz#459c65fa1867dafe6a8f322c4c51695663cc55e9" - integrity sha1-RZxl+hhn2v5qjzIsTFFpVmPMVek= - -"@types/mime@*": - version "2.0.2" - resolved "https://registry.npm.taobao.org/@types/mime/download/@types/mime-2.0.2.tgz#857a118d8634c84bba7ae14088e4508490cd5da5" - integrity sha1-hXoRjYY0yEu6euFAiORQhJDNXaU= - -"@types/node-fetch@2.5.4": - version "2.5.4" - resolved "https://registry.npm.taobao.org/@types/node-fetch/download/@types/node-fetch-2.5.4.tgz#5245b6d8841fc3a6208b82291119bc11c4e0ce44" - integrity sha1-UkW22IQfw6Ygi4IpERm8EcTgzkQ= - dependencies: - "@types/node" "*" - -"@types/node-fetch@2.5.7": - version "2.5.7" - resolved "https://registry.npm.taobao.org/@types/node-fetch/download/@types/node-fetch-2.5.7.tgz#20a2afffa882ab04d44ca786449a276f9f6bbf3c" - integrity sha1-IKKv/6iCqwTUTKeGRJonb59rvzw= - dependencies: - "@types/node" "*" - form-data "^3.0.0" - -"@types/node@*", "@types/node@>=6": - version "14.0.11" - resolved "https://registry.npm.taobao.org/@types/node/download/@types/node-14.0.11.tgz?cache=0&sync_timestamp=1591304655802&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40types%2Fnode%2Fdownload%2F%40types%2Fnode-14.0.11.tgz#61d4886e2424da73b7b25547f59fdcb534c165a3" - integrity sha1-YdSIbiQk2nO3slVH9Z/ctTTBZaM= - -"@types/node@^10.1.0": - version "10.17.24" - resolved "https://registry.npm.taobao.org/@types/node/download/@types/node-10.17.24.tgz?cache=0&sync_timestamp=1591304655802&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40types%2Fnode%2Fdownload%2F%40types%2Fnode-10.17.24.tgz#c57511e3a19c4b5e9692bb2995c40a3a52167944" - integrity sha1-xXUR46GcS16WkrsplcQKOlIWeUQ= - -"@types/normalize-package-data@^2.4.0": - version "2.4.0" - resolved "https://registry.npm.taobao.org/@types/normalize-package-data/download/@types/normalize-package-data-2.4.0.tgz#e486d0d97396d79beedd0a6e33f4534ff6b4973e" - integrity sha1-5IbQ2XOW15vu3QpuM/RTT/a0lz4= - -"@types/prettier@^1.19.0": - version "1.19.1" - resolved "https://registry.npm.taobao.org/@types/prettier/download/@types/prettier-1.19.1.tgz#33509849f8e679e4add158959fdb086440e9553f" - integrity sha1-M1CYSfjmeeSt0ViVn9sIZEDpVT8= - -"@types/qs@*": - version "6.9.3" - resolved "https://registry.npm.taobao.org/@types/qs/download/@types/qs-6.9.3.tgz?cache=0&sync_timestamp=1589910937867&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40types%2Fqs%2Fdownload%2F%40types%2Fqs-6.9.3.tgz#b755a0934564a200d3efdf88546ec93c369abd03" - integrity sha1-t1Wgk0VkogDT79+IVG7JPDaavQM= - -"@types/range-parser@*": - version "1.2.3" - resolved "https://registry.npm.taobao.org/@types/range-parser/download/@types/range-parser-1.2.3.tgz#7ee330ba7caafb98090bece86a5ee44115904c2c" - integrity sha1-fuMwunyq+5gJC+zoal7kQRWQTCw= - -"@types/serve-static@*": - version "1.13.4" - resolved "https://registry.npm.taobao.org/@types/serve-static/download/@types/serve-static-1.13.4.tgz#6662a93583e5a6cabca1b23592eb91e12fa80e7c" - integrity sha1-ZmKpNYPlpsq8obI1kuuR4S+oDnw= - dependencies: - "@types/express-serve-static-core" "*" - "@types/mime" "*" - -"@types/stack-utils@^1.0.1": - version "1.0.1" - resolved "https://registry.npm.taobao.org/@types/stack-utils/download/@types/stack-utils-1.0.1.tgz#0a851d3bd96498fa25c33ab7278ed3bd65f06c3e" - integrity sha1-CoUdO9lkmPolwzq3J47TvWXwbD4= - -"@types/ws@^7.0.0": - version "7.2.5" - resolved "https://registry.npm.taobao.org/@types/ws/download/@types/ws-7.2.5.tgz?cache=0&sync_timestamp=1591233034358&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40types%2Fws%2Fdownload%2F%40types%2Fws-7.2.5.tgz#513f28b04a1ea1aa9dc2cad3f26e8e37c88aae49" - integrity sha1-UT8osEoeoaqdwsrT8m6ON8iKrkk= - dependencies: - "@types/node" "*" - -"@types/yargs-parser@*": - version "15.0.0" - resolved "https://registry.npm.taobao.org/@types/yargs-parser/download/@types/yargs-parser-15.0.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40types%2Fyargs-parser%2Fdownload%2F%40types%2Fyargs-parser-15.0.0.tgz#cb3f9f741869e20cce330ffbeb9271590483882d" - integrity sha1-yz+fdBhp4gzOMw/765JxWQSDiC0= - -"@types/yargs@^13.0.0": - version "13.0.9" - resolved "https://registry.npm.taobao.org/@types/yargs/download/@types/yargs-13.0.9.tgz?cache=0&sync_timestamp=1589409763382&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40types%2Fyargs%2Fdownload%2F%40types%2Fyargs-13.0.9.tgz#44028e974343c7afcf3960f1a2b1099c39a7b5e1" - integrity sha1-RAKOl0NDx6/POWDxorEJnDmnteE= - dependencies: - "@types/yargs-parser" "*" - -"@types/yargs@^15.0.0": - version "15.0.5" - resolved "https://registry.npm.taobao.org/@types/yargs/download/@types/yargs-15.0.5.tgz?cache=0&sync_timestamp=1589409763382&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40types%2Fyargs%2Fdownload%2F%40types%2Fyargs-15.0.5.tgz#947e9a6561483bdee9adffc983e91a6902af8b79" - integrity sha1-lH6aZWFIO97prf/Jg+kaaQKvi3k= - dependencies: - "@types/yargs-parser" "*" - -"@types/zen-observable@^0.8.0": - version "0.8.0" - resolved "https://registry.npm.taobao.org/@types/zen-observable/download/@types/zen-observable-0.8.0.tgz#8b63ab7f1aa5321248aad5ac890a485656dcea4d" - integrity sha1-i2OrfxqlMhJIqtWsiQpIVlbc6k0= - -"@wry/context@^0.4.0": - version "0.4.4" - resolved "https://registry.npm.taobao.org/@wry/context/download/@wry/context-0.4.4.tgz#e50f5fa1d6cfaabf2977d1fda5ae91717f8815f8" - integrity sha1-5Q9fodbPqr8pd9H9pa6RcX+IFfg= - dependencies: - "@types/node" ">=6" - tslib "^1.9.3" - -"@wry/equality@^0.1.2": - version "0.1.11" - resolved "https://registry.npm.taobao.org/@wry/equality/download/@wry/equality-0.1.11.tgz#35cb156e4a96695aa81a9ecc4d03787bc17f1790" - integrity sha1-NcsVbkqWaVqoGp7MTQN4e8F/F5A= - dependencies: - tslib "^1.9.3" - -abab@^2.0.0: - version "2.0.3" - resolved "https://registry.npm.taobao.org/abab/download/abab-2.0.3.tgz#623e2075e02eb2d3f2475e49f99c91846467907a" - integrity sha1-Yj4gdeAustPyR15J+ZyRhGRnkHo= - -accepts@^1.3.5, accepts@~1.3.7: - version "1.3.7" - resolved "https://registry.npm.taobao.org/accepts/download/accepts-1.3.7.tgz#531bc726517a3b2b41f850021c6cc15eaab507cd" - integrity sha1-UxvHJlF6OytB+FACHGzBXqq1B80= - dependencies: - mime-types "~2.1.24" - negotiator "0.6.2" - -acorn-globals@^4.3.2: - version "4.3.4" - resolved "https://registry.npm.taobao.org/acorn-globals/download/acorn-globals-4.3.4.tgz#9fa1926addc11c97308c4e66d7add0d40c3272e7" - integrity sha1-n6GSat3BHJcwjE5m163Q1Awycuc= - dependencies: - acorn "^6.0.1" - acorn-walk "^6.0.1" - -acorn-walk@^6.0.1: - version "6.2.0" - resolved "https://registry.npm.taobao.org/acorn-walk/download/acorn-walk-6.2.0.tgz?cache=0&sync_timestamp=1581612804260&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Facorn-walk%2Fdownload%2Facorn-walk-6.2.0.tgz#123cb8f3b84c2171f1f7fb252615b1c78a6b1a8c" - integrity sha1-Ejy487hMIXHx9/slJhWxx4prGow= - -acorn@^6.0.1: - version "6.4.1" - resolved "https://registry.npm.taobao.org/acorn/download/acorn-6.4.1.tgz#531e58ba3f51b9dacb9a6646ca4debf5b14ca474" - integrity sha1-Ux5Yuj9RudrLmmZGyk3r9bFMpHQ= - -acorn@^7.1.0: - version "7.2.0" - resolved "https://registry.npm.taobao.org/acorn/download/acorn-7.2.0.tgz#17ea7e40d7c8640ff54a694c889c26f31704effe" - integrity sha1-F+p+QNfIZA/1SmlMiJwm8xcE7/4= - -ajv@^6.5.5: - version "6.12.2" - resolved "https://registry.npm.taobao.org/ajv/download/ajv-6.12.2.tgz#c629c5eced17baf314437918d2da88c99d5958cd" - integrity sha1-xinF7O0XuvMUQ3kY0tqIyZ1ZWM0= - dependencies: - fast-deep-equal "^3.1.1" - fast-json-stable-stringify "^2.0.0" - json-schema-traverse "^0.4.1" - uri-js "^4.2.2" - -ansi-escapes@^4.2.1: - version "4.3.1" - resolved "https://registry.npm.taobao.org/ansi-escapes/download/ansi-escapes-4.3.1.tgz#a5c47cc43181f1f38ffd7076837700d395522a61" - integrity sha1-pcR8xDGB8fOP/XB2g3cA05VSKmE= - dependencies: - type-fest "^0.11.0" - -ansi-regex@^4.0.0, ansi-regex@^4.1.0: - version "4.1.0" - resolved "https://registry.npm.taobao.org/ansi-regex/download/ansi-regex-4.1.0.tgz#8b9f8f08cf1acb843756a839ca8c7e3168c51997" - integrity sha1-i5+PCM8ay4Q3Vqg5yox+MWjFGZc= - -ansi-regex@^5.0.0: - version "5.0.0" - resolved "https://registry.npm.taobao.org/ansi-regex/download/ansi-regex-5.0.0.tgz#388539f55179bf39339c81af30a654d69f87cb75" - integrity sha1-OIU59VF5vzkznIGvMKZU1p+Hy3U= - -ansi-styles@^3.2.0, ansi-styles@^3.2.1: - version "3.2.1" - resolved "https://registry.npm.taobao.org/ansi-styles/download/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" - integrity sha1-QfuyAkPlCxK+DwS43tvwdSDOhB0= - dependencies: - color-convert "^1.9.0" - -ansi-styles@^4.0.0, ansi-styles@^4.1.0: - version "4.2.1" - resolved "https://registry.npm.taobao.org/ansi-styles/download/ansi-styles-4.2.1.tgz#90ae75c424d008d2624c5bf29ead3177ebfcf359" - integrity sha1-kK51xCTQCNJiTFvynq0xd+v881k= - dependencies: - "@types/color-name" "^1.1.1" - color-convert "^2.0.1" - -anymatch@^2.0.0: - version "2.0.0" - resolved "https://registry.npm.taobao.org/anymatch/download/anymatch-2.0.0.tgz#bcb24b4f37934d9aa7ac17b4adaf89e7c76ef2eb" - integrity sha1-vLJLTzeTTZqnrBe0ra+J58du8us= - dependencies: - micromatch "^3.1.4" - normalize-path "^2.1.1" - -anymatch@^3.0.3: - version "3.1.1" - resolved "https://registry.npm.taobao.org/anymatch/download/anymatch-3.1.1.tgz#c55ecf02185e2469259399310c173ce31233b142" - integrity sha1-xV7PAhheJGklk5kxDBc84xIzsUI= - dependencies: - normalize-path "^3.0.0" - picomatch "^2.0.4" - -apollo-cache-control@^0.11.0: - version "0.11.0" - resolved "https://registry.npm.taobao.org/apollo-cache-control/download/apollo-cache-control-0.11.0.tgz#7075492d04c5424e7c6769380b503e8f75b39d61" - integrity sha1-cHVJLQTFQk58Z2k4C1A+j3WznWE= - dependencies: - apollo-server-env "^2.4.4" - apollo-server-plugin-base "^0.9.0" - -apollo-cache-inmemory@^1.6.5: - version "1.6.6" - resolved "https://registry.npm.taobao.org/apollo-cache-inmemory/download/apollo-cache-inmemory-1.6.6.tgz#56d1f2a463a6b9db32e9fa990af16d2a008206fd" - integrity sha1-VtHypGOmudsy6fqZCvFtKgCCBv0= - dependencies: - apollo-cache "^1.3.5" - apollo-utilities "^1.3.4" - optimism "^0.10.0" - ts-invariant "^0.4.0" - tslib "^1.10.0" - -apollo-cache@1.3.5, apollo-cache@^1.3.5: - version "1.3.5" - resolved "https://registry.npm.taobao.org/apollo-cache/download/apollo-cache-1.3.5.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fapollo-cache%2Fdownload%2Fapollo-cache-1.3.5.tgz#9dbebfc8dbe8fe7f97ba568a224bca2c5d81f461" - integrity sha1-nb6/yNvo/n+XulaKIkvKLF2B9GE= - dependencies: - apollo-utilities "^1.3.4" - tslib "^1.10.0" - -apollo-client@^2.6.8: - version "2.6.10" - resolved "https://registry.npm.taobao.org/apollo-client/download/apollo-client-2.6.10.tgz#86637047b51d940c8eaa771a4ce1b02df16bea6a" - integrity sha1-hmNwR7UdlAyOqncaTOGwLfFr6mo= - dependencies: - "@types/zen-observable" "^0.8.0" - apollo-cache "1.3.5" - apollo-link "^1.0.0" - apollo-utilities "1.3.4" - symbol-observable "^1.0.2" - ts-invariant "^0.4.0" - tslib "^1.10.0" - zen-observable "^0.8.0" - -apollo-datasource@^0.7.1: - version "0.7.1" - resolved "https://registry.npm.taobao.org/apollo-datasource/download/apollo-datasource-0.7.1.tgz#0b06da999ace50b7f5fe509f2a03f7de97974334" - integrity sha1-CwbamZrOULf1/lCfKgP33peXQzQ= - dependencies: - apollo-server-caching "^0.5.1" - apollo-server-env "^2.4.4" - -apollo-engine-reporting-protobuf@^0.4.4: - version "0.4.4" - resolved "https://registry.npm.taobao.org/apollo-engine-reporting-protobuf/download/apollo-engine-reporting-protobuf-0.4.4.tgz#73a064f8c9f2d6605192d1673729c66ec47d9cb7" - integrity sha1-c6Bk+Mny1mBRktFnNynGbsR9nLc= - dependencies: - "@apollo/protobufjs" "^1.0.3" - -apollo-engine-reporting-protobuf@^0.5.1: - version "0.5.1" - resolved "https://registry.npm.taobao.org/apollo-engine-reporting-protobuf/download/apollo-engine-reporting-protobuf-0.5.1.tgz#b6e66e6e382f9bcdc2ac8ed168b047eb1470c1a8" - integrity sha1-tuZubjgvm83CrI7RaLBH6xRwwag= - dependencies: - "@apollo/protobufjs" "^1.0.3" - -apollo-engine-reporting@^2.0.0: - version "2.0.0" - resolved "https://registry.npm.taobao.org/apollo-engine-reporting/download/apollo-engine-reporting-2.0.0.tgz#af007b4a8a481fa97baef0eac51a7824f1ec3310" - integrity sha1-rwB7SopIH6l7rvDqxRp4JPHsMxA= - dependencies: - apollo-engine-reporting-protobuf "^0.5.1" - apollo-graphql "^0.4.0" - apollo-server-caching "^0.5.1" - apollo-server-env "^2.4.4" - apollo-server-errors "^2.4.1" - apollo-server-plugin-base "^0.9.0" - apollo-server-types "^0.5.0" - async-retry "^1.2.1" - uuid "^8.0.0" - -apollo-env@^0.6.1, apollo-env@^0.6.5: - version "0.6.5" - resolved "https://registry.npm.taobao.org/apollo-env/download/apollo-env-0.6.5.tgz?cache=0&sync_timestamp=1588778205195&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fapollo-env%2Fdownload%2Fapollo-env-0.6.5.tgz#5a36e699d39e2356381f7203493187260fded9f3" - integrity sha1-WjbmmdOeI1Y4H3IDSTGHJg/e2fM= - dependencies: - "@types/node-fetch" "2.5.7" - core-js "^3.0.1" - node-fetch "^2.2.0" - sha.js "^2.4.11" - -apollo-graphql@^0.3.7: - version "0.3.7" - resolved "https://registry.npm.taobao.org/apollo-graphql/download/apollo-graphql-0.3.7.tgz?cache=0&sync_timestamp=1588778208612&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fapollo-graphql%2Fdownload%2Fapollo-graphql-0.3.7.tgz#533232ed48b0b6dbcf5635f65e66cf8677a5b768" - integrity sha1-UzIy7UiwttvPVjX2XmbPhnelt2g= - dependencies: - apollo-env "^0.6.1" - lodash.sortby "^4.7.0" - -apollo-graphql@^0.4.0: - version "0.4.4" - resolved "https://registry.npm.taobao.org/apollo-graphql/download/apollo-graphql-0.4.4.tgz?cache=0&sync_timestamp=1588778208612&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fapollo-graphql%2Fdownload%2Fapollo-graphql-0.4.4.tgz#25f456b28a4419bb6a42071f8a56e19e15bb80be" - integrity sha1-JfRWsopEGbtqQgcfilbhnhW7gL4= - dependencies: - apollo-env "^0.6.5" - lodash.sortby "^4.7.0" - -apollo-link-http-common@^0.2.16: - version "0.2.16" - resolved "https://registry.npm.taobao.org/apollo-link-http-common/download/apollo-link-http-common-0.2.16.tgz#756749dafc732792c8ca0923f9a40564b7c59ecc" - integrity sha1-dWdJ2vxzJ5LIygkj+aQFZLfFnsw= - dependencies: - apollo-link "^1.2.14" - ts-invariant "^0.4.0" - tslib "^1.9.3" - -apollo-link-http@^1.5.16: - version "1.5.17" - resolved "https://registry.npm.taobao.org/apollo-link-http/download/apollo-link-http-1.5.17.tgz#499e9f1711bf694497f02c51af12d82de5d8d8ba" - integrity sha1-SZ6fFxG/aUSX8CxRrxLYLeXY2Lo= - dependencies: - apollo-link "^1.2.14" - apollo-link-http-common "^0.2.16" - tslib "^1.9.3" - -apollo-link@^1.0.0, apollo-link@^1.2.14: - version "1.2.14" - resolved "https://registry.npm.taobao.org/apollo-link/download/apollo-link-1.2.14.tgz#3feda4b47f9ebba7f4160bef8b977ba725b684d9" - integrity sha1-P+2ktH+eu6f0Fgvvi5d7pyW2hNk= - dependencies: - apollo-utilities "^1.3.0" - ts-invariant "^0.4.0" - tslib "^1.9.3" - zen-observable-ts "^0.8.21" - -apollo-server-caching@^0.5.1: - version "0.5.1" - resolved "https://registry.npm.taobao.org/apollo-server-caching/download/apollo-server-caching-0.5.1.tgz#5cd0536ad5473abb667cc82b59bc56b96fb35db6" - integrity sha1-XNBTatVHOrtmfMgrWbxWuW+zXbY= - dependencies: - lru-cache "^5.0.0" - -apollo-server-core@^2.14.2, apollo-server-core@^2.9.16: - version "2.14.2" - resolved "https://registry.npm.taobao.org/apollo-server-core/download/apollo-server-core-2.14.2.tgz?cache=0&sync_timestamp=1591292263665&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fapollo-server-core%2Fdownload%2Fapollo-server-core-2.14.2.tgz#4ab055b96b8be7821a726c81e8aa412deb7f3644" - integrity sha1-SrBVuWuL54IacmyB6KpBLet/NkQ= - dependencies: - "@apollographql/apollo-tools" "^0.4.3" - "@apollographql/graphql-playground-html" "1.6.24" - "@types/graphql-upload" "^8.0.0" - "@types/ws" "^7.0.0" - apollo-cache-control "^0.11.0" - apollo-datasource "^0.7.1" - apollo-engine-reporting "^2.0.0" - apollo-server-caching "^0.5.1" - apollo-server-env "^2.4.4" - apollo-server-errors "^2.4.1" - apollo-server-plugin-base "^0.9.0" - apollo-server-types "^0.5.0" - apollo-tracing "^0.11.0" - fast-json-stable-stringify "^2.0.0" - graphql-extensions "^0.12.2" - graphql-tag "^2.9.2" - graphql-tools "^4.0.0" - graphql-upload "^8.0.2" - loglevel "^1.6.7" - sha.js "^2.4.11" - subscriptions-transport-ws "^0.9.11" - ws "^6.0.0" - -apollo-server-env@^2.4.3, apollo-server-env@^2.4.4: - version "2.4.4" - resolved "https://registry.npm.taobao.org/apollo-server-env/download/apollo-server-env-2.4.4.tgz#12d2d0896dcb184478cba066c7a683ab18689ca1" - integrity sha1-EtLQiW3LGER4y6Bmx6aDqxhonKE= - dependencies: - node-fetch "^2.1.2" - util.promisify "^1.0.0" - -apollo-server-errors@^2.4.1: - version "2.4.1" - resolved "https://registry.npm.taobao.org/apollo-server-errors/download/apollo-server-errors-2.4.1.tgz?cache=0&sync_timestamp=1586285510004&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fapollo-server-errors%2Fdownload%2Fapollo-server-errors-2.4.1.tgz#16ad49de6c9134bfb2b7dede9842e73bb239dbe2" - integrity sha1-Fq1J3myRNL+yt97emELnO7I52+I= - -apollo-server-express@^2.14.2: - version "2.14.2" - resolved "https://registry.npm.taobao.org/apollo-server-express/download/apollo-server-express-2.14.2.tgz?cache=0&sync_timestamp=1591292265414&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fapollo-server-express%2Fdownload%2Fapollo-server-express-2.14.2.tgz#662dfeb9c794c1eca59dd93e57e74487a8195ae6" - integrity sha1-Zi3+uceUweylndk+V+dEh6gZWuY= - dependencies: - "@apollographql/graphql-playground-html" "1.6.24" - "@types/accepts" "^1.3.5" - "@types/body-parser" "1.19.0" - "@types/cors" "^2.8.4" - "@types/express" "4.17.4" - accepts "^1.3.5" - apollo-server-core "^2.14.2" - apollo-server-types "^0.5.0" - body-parser "^1.18.3" - cors "^2.8.4" - express "^4.17.1" - graphql-subscriptions "^1.0.0" - graphql-tools "^4.0.0" - parseurl "^1.3.2" - subscriptions-transport-ws "^0.9.16" - type-is "^1.6.16" - -apollo-server-plugin-base@^0.9.0: - version "0.9.0" - resolved "https://registry.npm.taobao.org/apollo-server-plugin-base/download/apollo-server-plugin-base-0.9.0.tgz#777f720a1ee827a66b8c159073ca30645f8bc625" - integrity sha1-d39yCh7oJ6ZrjBWQc8owZF+LxiU= - dependencies: - apollo-server-types "^0.5.0" - -apollo-server-types@^0.2.10: - version "0.2.10" - resolved "https://registry.npm.taobao.org/apollo-server-types/download/apollo-server-types-0.2.10.tgz#017ee0c812e70b0846826834eb2c9eda036c1c7a" - integrity sha1-AX7gyBLnCwhGgmg06yye2gNsHHo= - dependencies: - apollo-engine-reporting-protobuf "^0.4.4" - apollo-server-caching "^0.5.1" - apollo-server-env "^2.4.3" - -apollo-server-types@^0.5.0: - version "0.5.0" - resolved "https://registry.npm.taobao.org/apollo-server-types/download/apollo-server-types-0.5.0.tgz#51f39c5fa610ece8b07f1fbcf63c47d4ac150340" - integrity sha1-UfOcX6YQ7Oiwfx+89jxH1KwVA0A= - dependencies: - apollo-engine-reporting-protobuf "^0.5.1" - apollo-server-caching "^0.5.1" - apollo-server-env "^2.4.4" - -apollo-server@^2.14.2: - version "2.14.2" - resolved "https://registry.npm.taobao.org/apollo-server/download/apollo-server-2.14.2.tgz#65167305479d36e96e6f0d08ac201aa6c7571a44" - integrity sha1-ZRZzBUedNulubw0IrCAapsdXGkQ= - dependencies: - apollo-server-core "^2.14.2" - apollo-server-express "^2.14.2" - express "^4.0.0" - graphql-subscriptions "^1.0.0" - graphql-tools "^4.0.0" - -apollo-tracing@^0.11.0: - version "0.11.0" - resolved "https://registry.npm.taobao.org/apollo-tracing/download/apollo-tracing-0.11.0.tgz#8821eb60692f77c06660fb6bc147446f600aecfe" - integrity sha1-iCHrYGkvd8BmYPtrwUdEb2AK7P4= - dependencies: - apollo-server-env "^2.4.4" - apollo-server-plugin-base "^0.9.0" - -apollo-utilities@1.3.4, apollo-utilities@^1.0.1, apollo-utilities@^1.3.0, apollo-utilities@^1.3.4: - version "1.3.4" - resolved "https://registry.npm.taobao.org/apollo-utilities/download/apollo-utilities-1.3.4.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fapollo-utilities%2Fdownload%2Fapollo-utilities-1.3.4.tgz#6129e438e8be201b6c55b0f13ce49d2c7175c9cf" - integrity sha1-YSnkOOi+IBtsVbDxPOSdLHF1yc8= - dependencies: - "@wry/equality" "^0.1.2" - fast-json-stable-stringify "^2.0.0" - ts-invariant "^0.4.0" - tslib "^1.10.0" - -argparse@^1.0.7: - version "1.0.10" - resolved "https://registry.npm.taobao.org/argparse/download/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" - integrity sha1-vNZ5HqWuCXJeF+WtmIE0zUCz2RE= - dependencies: - sprintf-js "~1.0.2" - -arr-diff@^4.0.0: - version "4.0.0" - resolved "https://registry.npm.taobao.org/arr-diff/download/arr-diff-4.0.0.tgz#d6461074febfec71e7e15235761a329a5dc7c520" - integrity sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA= - -arr-flatten@^1.1.0: - version "1.1.0" - resolved "https://registry.npm.taobao.org/arr-flatten/download/arr-flatten-1.1.0.tgz#36048bbff4e7b47e136644316c99669ea5ae91f1" - integrity sha1-NgSLv/TntH4TZkQxbJlmnqWukfE= - -arr-union@^3.1.0: - version "3.1.0" - resolved "https://registry.npm.taobao.org/arr-union/download/arr-union-3.1.0.tgz#e39b09aea9def866a8f206e288af63919bae39c4" - integrity sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ= - -array-equal@^1.0.0: - version "1.0.0" - resolved "https://registry.npm.taobao.org/array-equal/download/array-equal-1.0.0.tgz#8c2a5ef2472fd9ea742b04c77a75093ba2757c93" - integrity sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM= - -array-flatten@1.1.1: - version "1.1.1" - resolved "https://registry.npm.taobao.org/array-flatten/download/array-flatten-1.1.1.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Farray-flatten%2Fdownload%2Farray-flatten-1.1.1.tgz#9a5f699051b1e7073328f2a008968b64ea2955d2" - integrity sha1-ml9pkFGx5wczKPKgCJaLZOopVdI= - -array-unique@^0.3.2: - version "0.3.2" - resolved "https://registry.npm.taobao.org/array-unique/download/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428" - integrity sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg= - -asn1@~0.2.3: - version "0.2.4" - resolved "https://registry.npm.taobao.org/asn1/download/asn1-0.2.4.tgz#8d2475dfab553bb33e77b54e59e880bb8ce23136" - integrity sha1-jSR136tVO7M+d7VOWeiAu4ziMTY= - dependencies: - safer-buffer "~2.1.0" - -assert-plus@1.0.0, assert-plus@^1.0.0: - version "1.0.0" - resolved "https://registry.npm.taobao.org/assert-plus/download/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525" - integrity sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU= - -assign-symbols@^1.0.0: - version "1.0.0" - resolved "https://registry.npm.taobao.org/assign-symbols/download/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367" - integrity sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c= - -astral-regex@^1.0.0: - version "1.0.0" - resolved "https://registry.npm.taobao.org/astral-regex/download/astral-regex-1.0.0.tgz#6c8c3fb827dd43ee3918f27b82782ab7658a6fd9" - integrity sha1-bIw/uCfdQ+45GPJ7gngqt2WKb9k= - -async-limiter@~1.0.0: - version "1.0.1" - resolved "https://registry.npm.taobao.org/async-limiter/download/async-limiter-1.0.1.tgz#dd379e94f0db8310b08291f9d64c3209766617fd" - integrity sha1-3TeelPDbgxCwgpH51kwyCXZmF/0= - -async-retry@^1.2.1: - version "1.3.1" - resolved "https://registry.npm.taobao.org/async-retry/download/async-retry-1.3.1.tgz#139f31f8ddce50c0870b0ba558a6079684aaed55" - integrity sha1-E58x+N3OUMCHCwulWKYHloSq7VU= - dependencies: - retry "0.12.0" - -asynckit@^0.4.0: - version "0.4.0" - resolved "https://registry.npm.taobao.org/asynckit/download/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" - integrity sha1-x57Zf380y48robyXkLzDZkdLS3k= - -atob@^2.1.2: - version "2.1.2" - resolved "https://registry.npm.taobao.org/atob/download/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9" - integrity sha1-bZUX654DDSQ2ZmZR6GvZ9vE1M8k= - -aws-sign2@~0.7.0: - version "0.7.0" - resolved "https://registry.npm.taobao.org/aws-sign2/download/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8" - integrity sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg= - -aws4@^1.8.0: - version "1.10.0" - resolved "https://registry.npm.taobao.org/aws4/download/aws4-1.10.0.tgz#a17b3a8ea811060e74d47d306122400ad4497ae2" - integrity sha1-oXs6jqgRBg501H0wYSJACtRJeuI= - -babel-jest@^25.5.1: - version "25.5.1" - resolved "https://registry.npm.taobao.org/babel-jest/download/babel-jest-25.5.1.tgz#bc2e6101f849d6f6aec09720ffc7bc5332e62853" - integrity sha1-vC5hAfhJ1vauwJcg/8e8UzLmKFM= - dependencies: - "@jest/transform" "^25.5.1" - "@jest/types" "^25.5.0" - "@types/babel__core" "^7.1.7" - babel-plugin-istanbul "^6.0.0" - babel-preset-jest "^25.5.0" - chalk "^3.0.0" - graceful-fs "^4.2.4" - slash "^3.0.0" - -babel-plugin-istanbul@^6.0.0: - version "6.0.0" - resolved "https://registry.npm.taobao.org/babel-plugin-istanbul/download/babel-plugin-istanbul-6.0.0.tgz#e159ccdc9af95e0b570c75b4573b7c34d671d765" - integrity sha1-4VnM3Jr5XgtXDHW0Vzt8NNZx12U= - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@istanbuljs/load-nyc-config" "^1.0.0" - "@istanbuljs/schema" "^0.1.2" - istanbul-lib-instrument "^4.0.0" - test-exclude "^6.0.0" - -babel-plugin-jest-hoist@^25.5.0: - version "25.5.0" - resolved "https://registry.npm.taobao.org/babel-plugin-jest-hoist/download/babel-plugin-jest-hoist-25.5.0.tgz#129c80ba5c7fc75baf3a45b93e2e372d57ca2677" - integrity sha1-EpyAulx/x1uvOkW5Pi43LVfKJnc= - dependencies: - "@babel/template" "^7.3.3" - "@babel/types" "^7.3.3" - "@types/babel__traverse" "^7.0.6" - -babel-preset-current-node-syntax@^0.1.2: - version "0.1.2" - resolved "https://registry.npm.taobao.org/babel-preset-current-node-syntax/download/babel-preset-current-node-syntax-0.1.2.tgz#fb4a4c51fe38ca60fede1dc74ab35eb843cb41d6" - integrity sha1-+0pMUf44ymD+3h3HSrNeuEPLQdY= - dependencies: - "@babel/plugin-syntax-async-generators" "^7.8.4" - "@babel/plugin-syntax-bigint" "^7.8.3" - "@babel/plugin-syntax-class-properties" "^7.8.3" - "@babel/plugin-syntax-json-strings" "^7.8.3" - "@babel/plugin-syntax-logical-assignment-operators" "^7.8.3" - "@babel/plugin-syntax-nullish-coalescing-operator" "^7.8.3" - "@babel/plugin-syntax-numeric-separator" "^7.8.3" - "@babel/plugin-syntax-object-rest-spread" "^7.8.3" - "@babel/plugin-syntax-optional-catch-binding" "^7.8.3" - "@babel/plugin-syntax-optional-chaining" "^7.8.3" - -babel-preset-jest@^25.5.0: - version "25.5.0" - resolved "https://registry.npm.taobao.org/babel-preset-jest/download/babel-preset-jest-25.5.0.tgz#c1d7f191829487a907764c65307faa0e66590b49" - integrity sha1-wdfxkYKUh6kHdkxlMH+qDmZZC0k= - dependencies: - babel-plugin-jest-hoist "^25.5.0" - babel-preset-current-node-syntax "^0.1.2" - -backo2@^1.0.2: - version "1.0.2" - resolved "https://registry.npm.taobao.org/backo2/download/backo2-1.0.2.tgz#31ab1ac8b129363463e35b3ebb69f4dfcfba7947" - integrity sha1-MasayLEpNjRj41s+u2n038+6eUc= - -balanced-match@^1.0.0: - version "1.0.0" - resolved "https://registry.npm.taobao.org/balanced-match/download/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" - integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= - -base@^0.11.1: - version "0.11.2" - resolved "https://registry.npm.taobao.org/base/download/base-0.11.2.tgz#7bde5ced145b6d551a90db87f83c558b4eb48a8f" - integrity sha1-e95c7RRbbVUakNuH+DxVi060io8= - dependencies: - cache-base "^1.0.1" - class-utils "^0.3.5" - component-emitter "^1.2.1" - define-property "^1.0.0" - isobject "^3.0.1" - mixin-deep "^1.2.0" - pascalcase "^0.1.1" - -bcrypt-pbkdf@^1.0.0: - version "1.0.2" - resolved "https://registry.npm.taobao.org/bcrypt-pbkdf/download/bcrypt-pbkdf-1.0.2.tgz#a4301d389b6a43f9b67ff3ca11a3f6637e360e9e" - integrity sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4= - dependencies: - tweetnacl "^0.14.3" - -body-parser@1.19.0, body-parser@^1.18.3: - version "1.19.0" - resolved "https://registry.npm.taobao.org/body-parser/download/body-parser-1.19.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fbody-parser%2Fdownload%2Fbody-parser-1.19.0.tgz#96b2709e57c9c4e09a6fd66a8fd979844f69f08a" - integrity sha1-lrJwnlfJxOCab9Zqj9l5hE9p8Io= - dependencies: - bytes "3.1.0" - content-type "~1.0.4" - debug "2.6.9" - depd "~1.1.2" - http-errors "1.7.2" - iconv-lite "0.4.24" - on-finished "~2.3.0" - qs "6.7.0" - raw-body "2.4.0" - type-is "~1.6.17" - -brace-expansion@^1.1.7: - version "1.1.11" - resolved "https://registry.npm.taobao.org/brace-expansion/download/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" - integrity sha1-PH/L9SnYcibz0vUrlm/1Jx60Qd0= - dependencies: - balanced-match "^1.0.0" - concat-map "0.0.1" - -braces@^2.3.1: - version "2.3.2" - resolved "https://registry.npm.taobao.org/braces/download/braces-2.3.2.tgz#5979fd3f14cd531565e5fa2df1abfff1dfaee729" - integrity sha1-WXn9PxTNUxVl5fot8av/8d+u5yk= - dependencies: - arr-flatten "^1.1.0" - array-unique "^0.3.2" - extend-shallow "^2.0.1" - fill-range "^4.0.0" - isobject "^3.0.1" - repeat-element "^1.1.2" - snapdragon "^0.8.1" - snapdragon-node "^2.0.1" - split-string "^3.0.2" - to-regex "^3.0.1" - -braces@^3.0.1: - version "3.0.2" - resolved "https://registry.npm.taobao.org/braces/download/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" - integrity sha1-NFThpGLujVmeI23zNs2epPiv4Qc= - dependencies: - fill-range "^7.0.1" - -browser-process-hrtime@^1.0.0: - version "1.0.0" - resolved "https://registry.npm.taobao.org/browser-process-hrtime/download/browser-process-hrtime-1.0.0.tgz#3c9b4b7d782c8121e56f10106d84c0d0ffc94626" - integrity sha1-PJtLfXgsgSHlbxAQbYTA0P/JRiY= - -browser-resolve@^1.11.3: - version "1.11.3" - resolved "https://registry.npm.taobao.org/browser-resolve/download/browser-resolve-1.11.3.tgz#9b7cbb3d0f510e4cb86bdbd796124d28b5890af6" - integrity sha1-m3y7PQ9RDky4a9vXlhJNKLWJCvY= - dependencies: - resolve "1.1.7" - -bser@2.1.1: - version "2.1.1" - resolved "https://registry.npm.taobao.org/bser/download/bser-2.1.1.tgz#e6787da20ece9d07998533cfd9de6f5c38f4bc05" - integrity sha1-5nh9og7OnQeZhTPP2d5vXDj0vAU= - dependencies: - node-int64 "^0.4.0" - -buffer-from@^1.0.0: - version "1.1.1" - resolved "https://registry.npm.taobao.org/buffer-from/download/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" - integrity sha1-MnE7wCj3XAL9txDXx7zsHyxgcO8= - -busboy@^0.3.1: - version "0.3.1" - resolved "https://registry.npm.taobao.org/busboy/download/busboy-0.3.1.tgz#170899274c5bf38aae27d5c62b71268cd585fd1b" - integrity sha1-FwiZJ0xb84quJ9XGK3EmjNWF/Rs= - dependencies: - dicer "0.3.0" - -bytes@3.1.0: - version "3.1.0" - resolved "https://registry.npm.taobao.org/bytes/download/bytes-3.1.0.tgz#f6cf7933a360e0588fa9fde85651cdc7f805d1f6" - integrity sha1-9s95M6Ng4FiPqf3oVlHNx/gF0fY= - -cache-base@^1.0.1: - version "1.0.1" - resolved "https://registry.npm.taobao.org/cache-base/download/cache-base-1.0.1.tgz#0a7f46416831c8b662ee36fe4e7c59d76f666ab2" - integrity sha1-Cn9GQWgxyLZi7jb+TnxZ129marI= - dependencies: - collection-visit "^1.0.0" - component-emitter "^1.2.1" - get-value "^2.0.6" - has-value "^1.0.0" - isobject "^3.0.1" - set-value "^2.0.0" - to-object-path "^0.3.0" - union-value "^1.0.0" - unset-value "^1.0.0" - -callsites@^3.0.0: - version "3.1.0" - resolved "https://registry.npm.taobao.org/callsites/download/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" - integrity sha1-s2MKvYlDQy9Us/BRkjjjPNffL3M= - -camelcase@^5.0.0, camelcase@^5.3.1: - version "5.3.1" - resolved "https://registry.npm.taobao.org/camelcase/download/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" - integrity sha1-48mzFWnhBoEd8kL3FXJaH0xJQyA= - -capture-exit@^2.0.0: - version "2.0.0" - resolved "https://registry.npm.taobao.org/capture-exit/download/capture-exit-2.0.0.tgz#fb953bfaebeb781f62898239dabb426d08a509a4" - integrity sha1-+5U7+uvreB9iiYI52rtCbQilCaQ= - dependencies: - rsvp "^4.8.4" - -caseless@~0.12.0: - version "0.12.0" - resolved "https://registry.npm.taobao.org/caseless/download/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" - integrity sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw= - -chalk@^2.0.0: - version "2.4.2" - resolved "https://registry.npm.taobao.org/chalk/download/chalk-2.4.2.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fchalk%2Fdownload%2Fchalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" - integrity sha1-zUJUFnelQzPPVBpJEIwUMrRMlCQ= - dependencies: - ansi-styles "^3.2.1" - escape-string-regexp "^1.0.5" - supports-color "^5.3.0" - -chalk@^3.0.0: - version "3.0.0" - resolved "https://registry.npm.taobao.org/chalk/download/chalk-3.0.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fchalk%2Fdownload%2Fchalk-3.0.0.tgz#3f73c2bf526591f574cc492c51e2456349f844e4" - integrity sha1-P3PCv1JlkfV0zEksUeJFY0n4ROQ= - dependencies: - ansi-styles "^4.1.0" - supports-color "^7.1.0" - -ci-info@^2.0.0: - version "2.0.0" - resolved "https://registry.npm.taobao.org/ci-info/download/ci-info-2.0.0.tgz#67a9e964be31a51e15e5010d58e6f12834002f46" - integrity sha1-Z6npZL4xpR4V5QENWObxKDQAL0Y= - -class-utils@^0.3.5: - version "0.3.6" - resolved "https://registry.npm.taobao.org/class-utils/download/class-utils-0.3.6.tgz#f93369ae8b9a7ce02fd41faad0ca83033190c463" - integrity sha1-+TNprouafOAv1B+q0MqDAzGQxGM= - dependencies: - arr-union "^3.1.0" - define-property "^0.2.5" - isobject "^3.0.0" - static-extend "^0.1.1" - -cliui@^6.0.0: - version "6.0.0" - resolved "https://registry.npm.taobao.org/cliui/download/cliui-6.0.0.tgz#511d702c0c4e41ca156d7d0e96021f23e13225b1" - integrity sha1-UR1wLAxOQcoVbX0OlgIfI+EyJbE= - dependencies: - string-width "^4.2.0" - strip-ansi "^6.0.0" - wrap-ansi "^6.2.0" - -co@^4.6.0: - version "4.6.0" - resolved "https://registry.npm.taobao.org/co/download/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" - integrity sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ= - -collect-v8-coverage@^1.0.0: - version "1.0.1" - resolved "https://registry.npm.taobao.org/collect-v8-coverage/download/collect-v8-coverage-1.0.1.tgz#cc2c8e94fc18bbdffe64d6534570c8a673b27f59" - integrity sha1-zCyOlPwYu9/+ZNZTRXDIpnOyf1k= - -collection-visit@^1.0.0: - version "1.0.0" - resolved "https://registry.npm.taobao.org/collection-visit/download/collection-visit-1.0.0.tgz#4bc0373c164bc3291b4d368c829cf1a80a59dca0" - integrity sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA= - dependencies: - map-visit "^1.0.0" - object-visit "^1.0.0" - -color-convert@^1.9.0: - version "1.9.3" - resolved "https://registry.npm.taobao.org/color-convert/download/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" - integrity sha1-u3GFBpDh8TZWfeYp0tVHHe2kweg= - dependencies: - color-name "1.1.3" - -color-convert@^2.0.1: - version "2.0.1" - resolved "https://registry.npm.taobao.org/color-convert/download/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" - integrity sha1-ctOmjVmMm9s68q0ehPIdiWq9TeM= - dependencies: - color-name "~1.1.4" - -color-name@1.1.3: - version "1.1.3" - resolved "https://registry.npm.taobao.org/color-name/download/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" - integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= - -color-name@~1.1.4: - version "1.1.4" - resolved "https://registry.npm.taobao.org/color-name/download/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" - integrity sha1-wqCah6y95pVD3m9j+jmVyCbFNqI= - -combined-stream@^1.0.6, combined-stream@^1.0.8, combined-stream@~1.0.6: - version "1.0.8" - resolved "https://registry.npm.taobao.org/combined-stream/download/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" - integrity sha1-w9RaizT9cwYxoRCoolIGgrMdWn8= - dependencies: - delayed-stream "~1.0.0" - -component-emitter@^1.2.1: - version "1.3.0" - resolved "https://registry.npm.taobao.org/component-emitter/download/component-emitter-1.3.0.tgz#16e4070fba8ae29b679f2215853ee181ab2eabc0" - integrity sha1-FuQHD7qK4ptnnyIVhT7hgasuq8A= - -concat-map@0.0.1: - version "0.0.1" - resolved "https://registry.npm.taobao.org/concat-map/download/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" - integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= - -content-disposition@0.5.3: - version "0.5.3" - resolved "https://registry.npm.taobao.org/content-disposition/download/content-disposition-0.5.3.tgz#e130caf7e7279087c5616c2007d0485698984fbd" - integrity sha1-4TDK9+cnkIfFYWwgB9BIVpiYT70= - dependencies: - safe-buffer "5.1.2" - -content-type@~1.0.4: - version "1.0.4" - resolved "https://registry.npm.taobao.org/content-type/download/content-type-1.0.4.tgz#e138cc75e040c727b1966fe5e5f8c9aee256fe3b" - integrity sha1-4TjMdeBAxyexlm/l5fjJruJW/js= - -convert-source-map@^1.4.0, convert-source-map@^1.6.0, convert-source-map@^1.7.0: - version "1.7.0" - resolved "https://registry.npm.taobao.org/convert-source-map/download/convert-source-map-1.7.0.tgz#17a2cb882d7f77d3490585e2ce6c524424a3a442" - integrity sha1-F6LLiC1/d9NJBYXizmxSRCSjpEI= - dependencies: - safe-buffer "~5.1.1" - -cookie-signature@1.0.6: - version "1.0.6" - resolved "https://registry.npm.taobao.org/cookie-signature/download/cookie-signature-1.0.6.tgz#e303a882b342cc3ee8ca513a79999734dab3ae2c" - integrity sha1-4wOogrNCzD7oylE6eZmXNNqzriw= - -cookie@0.4.0: - version "0.4.0" - resolved "https://registry.npm.taobao.org/cookie/download/cookie-0.4.0.tgz#beb437e7022b3b6d49019d088665303ebe9c14ba" - integrity sha1-vrQ35wIrO21JAZ0IhmUwPr6cFLo= - -copy-descriptor@^0.1.0: - version "0.1.1" - resolved "https://registry.npm.taobao.org/copy-descriptor/download/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" - integrity sha1-Z29us8OZl8LuGsOpJP1hJHSPV40= - -core-js@^3.0.1, core-js@^3.4.0: - version "3.6.5" - resolved "https://registry.npm.taobao.org/core-js/download/core-js-3.6.5.tgz?cache=0&sync_timestamp=1586450269267&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcore-js%2Fdownload%2Fcore-js-3.6.5.tgz#7395dc273af37fb2e50e9bd3d9fe841285231d1a" - integrity sha1-c5XcJzrzf7LlDpvT2f6EEoUjHRo= - -core-util-is@1.0.2: - version "1.0.2" - resolved "https://registry.npm.taobao.org/core-util-is/download/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" - integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= - -cors@^2.8.4: - version "2.8.5" - resolved "https://registry.npm.taobao.org/cors/download/cors-2.8.5.tgz#eac11da51592dd86b9f06f6e7ac293b3df875d29" - integrity sha1-6sEdpRWS3Ya58G9uesKTs9+HXSk= - dependencies: - object-assign "^4" - vary "^1" - -cross-spawn@^6.0.0: - version "6.0.5" - resolved "https://registry.npm.taobao.org/cross-spawn/download/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" - integrity sha1-Sl7Hxk364iw6FBJNus3uhG2Ay8Q= - dependencies: - nice-try "^1.0.4" - path-key "^2.0.1" - semver "^5.5.0" - shebang-command "^1.2.0" - which "^1.2.9" - -cross-spawn@^7.0.0: - version "7.0.3" - resolved "https://registry.npm.taobao.org/cross-spawn/download/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" - integrity sha1-9zqFudXUHQRVUcF34ogtSshXKKY= - dependencies: - path-key "^3.1.0" - shebang-command "^2.0.0" - which "^2.0.1" - -cssom@^0.4.1: - version "0.4.4" - resolved "https://registry.npm.taobao.org/cssom/download/cssom-0.4.4.tgz?cache=0&sync_timestamp=1573719337707&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcssom%2Fdownload%2Fcssom-0.4.4.tgz#5a66cf93d2d0b661d80bf6a44fb65f5c2e4e0a10" - integrity sha1-WmbPk9LQtmHYC/akT7ZfXC5OChA= - -cssom@~0.3.6: - version "0.3.8" - resolved "https://registry.npm.taobao.org/cssom/download/cssom-0.3.8.tgz?cache=0&sync_timestamp=1573719337707&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcssom%2Fdownload%2Fcssom-0.3.8.tgz#9f1276f5b2b463f2114d3f2c75250af8c1a36f4a" - integrity sha1-nxJ29bK0Y/IRTT8sdSUK+MGjb0o= - -cssstyle@^2.0.0: - version "2.3.0" - resolved "https://registry.npm.taobao.org/cssstyle/download/cssstyle-2.3.0.tgz?cache=0&sync_timestamp=1588171504463&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcssstyle%2Fdownload%2Fcssstyle-2.3.0.tgz#ff665a0ddbdc31864b09647f34163443d90b0852" - integrity sha1-/2ZaDdvcMYZLCWR/NBY0Q9kLCFI= - dependencies: - cssom "~0.3.6" - -dashdash@^1.12.0: - version "1.14.1" - resolved "https://registry.npm.taobao.org/dashdash/download/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0" - integrity sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA= - dependencies: - assert-plus "^1.0.0" - -data-urls@^1.1.0: - version "1.1.0" - resolved "https://registry.npm.taobao.org/data-urls/download/data-urls-1.1.0.tgz#15ee0582baa5e22bb59c77140da8f9c76963bbfe" - integrity sha1-Fe4Fgrql4iu1nHcUDaj5x2lju/4= - dependencies: - abab "^2.0.0" - whatwg-mimetype "^2.2.0" - whatwg-url "^7.0.0" - -debug@2.6.9, debug@^2.2.0, debug@^2.3.3: - version "2.6.9" - resolved "https://registry.npm.taobao.org/debug/download/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" - integrity sha1-XRKFFd8TT/Mn6QpMk/Tgd6U2NB8= - dependencies: - ms "2.0.0" - -debug@^4.1.0, debug@^4.1.1: - version "4.1.1" - resolved "https://registry.npm.taobao.org/debug/download/debug-4.1.1.tgz#3b72260255109c6b589cee050f1d516139664791" - integrity sha1-O3ImAlUQnGtYnO4FDx1RYTlmR5E= - dependencies: - ms "^2.1.1" - -decamelize@^1.2.0: - version "1.2.0" - resolved "https://registry.npm.taobao.org/decamelize/download/decamelize-1.2.0.tgz?cache=0&sync_timestamp=1580010393599&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fdecamelize%2Fdownload%2Fdecamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" - integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA= - -decode-uri-component@^0.2.0: - version "0.2.0" - resolved "https://registry.npm.taobao.org/decode-uri-component/download/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" - integrity sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU= - -deep-is@~0.1.3: - version "0.1.3" - resolved "https://registry.npm.taobao.org/deep-is/download/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" - integrity sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ= - -deepmerge@^4.2.2: - version "4.2.2" - resolved "https://registry.npm.taobao.org/deepmerge/download/deepmerge-4.2.2.tgz?cache=0&sync_timestamp=1572279720382&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fdeepmerge%2Fdownload%2Fdeepmerge-4.2.2.tgz#44d2ea3679b8f4d4ffba33f03d865fc1e7bf4955" - integrity sha1-RNLqNnm49NT/ujPwPYZfwee/SVU= - -define-properties@^1.1.2, define-properties@^1.1.3: - version "1.1.3" - resolved "https://registry.npm.taobao.org/define-properties/download/define-properties-1.1.3.tgz#cf88da6cbee26fe6db7094f61d870cbd84cee9f1" - integrity sha1-z4jabL7ib+bbcJT2HYcMvYTO6fE= - dependencies: - object-keys "^1.0.12" - -define-property@^0.2.5: - version "0.2.5" - resolved "https://registry.npm.taobao.org/define-property/download/define-property-0.2.5.tgz#c35b1ef918ec3c990f9a5bc57be04aacec5c8116" - integrity sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY= - dependencies: - is-descriptor "^0.1.0" - -define-property@^1.0.0: - version "1.0.0" - resolved "https://registry.npm.taobao.org/define-property/download/define-property-1.0.0.tgz#769ebaaf3f4a63aad3af9e8d304c9bbe79bfb0e6" - integrity sha1-dp66rz9KY6rTr56NMEybvnm/sOY= - dependencies: - is-descriptor "^1.0.0" - -define-property@^2.0.2: - version "2.0.2" - resolved "https://registry.npm.taobao.org/define-property/download/define-property-2.0.2.tgz#d459689e8d654ba77e02a817f8710d702cb16e9d" - integrity sha1-1Flono1lS6d+AqgX+HENcCyxbp0= - dependencies: - is-descriptor "^1.0.2" - isobject "^3.0.1" - -delayed-stream@~1.0.0: - version "1.0.0" - resolved "https://registry.npm.taobao.org/delayed-stream/download/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" - integrity sha1-3zrhmayt+31ECqrgsp4icrJOxhk= - -depd@~1.1.2: - version "1.1.2" - resolved "https://registry.npm.taobao.org/depd/download/depd-1.1.2.tgz#9bcd52e14c097763e749b274c4346ed2e560b5a9" - integrity sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak= - -deprecated-decorator@^0.1.6: - version "0.1.6" - resolved "https://registry.npm.taobao.org/deprecated-decorator/download/deprecated-decorator-0.1.6.tgz#00966317b7a12fe92f3cc831f7583af329b86c37" - integrity sha1-AJZjF7ehL+kvPMgx91g68ym4bDc= - -destroy@~1.0.4: - version "1.0.4" - resolved "https://registry.npm.taobao.org/destroy/download/destroy-1.0.4.tgz#978857442c44749e4206613e37946205826abd80" - integrity sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA= - -detect-newline@^3.0.0: - version "3.1.0" - resolved "https://registry.npm.taobao.org/detect-newline/download/detect-newline-3.1.0.tgz?cache=0&sync_timestamp=1573634824396&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fdetect-newline%2Fdownload%2Fdetect-newline-3.1.0.tgz#576f5dfc63ae1a192ff192d8ad3af6308991b651" - integrity sha1-V29d/GOuGhkv8ZLYrTr2MImRtlE= - -dicer@0.3.0: - version "0.3.0" - resolved "https://registry.npm.taobao.org/dicer/download/dicer-0.3.0.tgz#eacd98b3bfbf92e8ab5c2fdb71aaac44bb06b872" - integrity sha1-6s2Ys7+/kuirXC/bcaqsRLsGuHI= - dependencies: - streamsearch "0.1.2" - -diff-sequences@^25.2.6: - version "25.2.6" - resolved "https://registry.npm.taobao.org/diff-sequences/download/diff-sequences-25.2.6.tgz#5f467c00edd35352b7bca46d7927d60e687a76dd" - integrity sha1-X0Z8AO3TU1K3vKRteSfWDmh6dt0= - -domexception@^1.0.1: - version "1.0.1" - resolved "https://registry.npm.taobao.org/domexception/download/domexception-1.0.1.tgz#937442644ca6a31261ef36e3ec677fe805582c90" - integrity sha1-k3RCZEymoxJh7zbj7Gd/6AVYLJA= - dependencies: - webidl-conversions "^4.0.2" - -ecc-jsbn@~0.1.1: - version "0.1.2" - resolved "https://registry.npm.taobao.org/ecc-jsbn/download/ecc-jsbn-0.1.2.tgz#3a83a904e54353287874c564b7549386849a98c9" - integrity sha1-OoOpBOVDUyh4dMVkt1SThoSamMk= - dependencies: - jsbn "~0.1.0" - safer-buffer "^2.1.0" - -ee-first@1.1.1: - version "1.1.1" - resolved "https://registry.npm.taobao.org/ee-first/download/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" - integrity sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0= - -emoji-regex@^8.0.0: - version "8.0.0" - resolved "https://registry.npm.taobao.org/emoji-regex/download/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" - integrity sha1-6Bj9ac5cz8tARZT4QpY79TFkzDc= - -encodeurl@~1.0.2: - version "1.0.2" - resolved "https://registry.npm.taobao.org/encodeurl/download/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59" - integrity sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k= - -end-of-stream@^1.1.0: - version "1.4.4" - resolved "https://registry.npm.taobao.org/end-of-stream/download/end-of-stream-1.4.4.tgz#5ae64a5f45057baf3626ec14da0ca5e4b2431eb0" - integrity sha1-WuZKX0UFe682JuwU2gyl5LJDHrA= - dependencies: - once "^1.4.0" - -error-ex@^1.3.1: - version "1.3.2" - resolved "https://registry.npm.taobao.org/error-ex/download/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf" - integrity sha1-tKxAZIEH/c3PriQvQovqihTU8b8= - dependencies: - is-arrayish "^0.2.1" - -es-abstract@^1.17.0-next.1, es-abstract@^1.17.2, es-abstract@^1.17.5: - version "1.17.5" - resolved "https://registry.npm.taobao.org/es-abstract/download/es-abstract-1.17.5.tgz#d8c9d1d66c8981fb9200e2251d799eee92774ae9" - integrity sha1-2MnR1myJgfuSAOIlHXme7pJ3Suk= - dependencies: - es-to-primitive "^1.2.1" - function-bind "^1.1.1" - has "^1.0.3" - has-symbols "^1.0.1" - is-callable "^1.1.5" - is-regex "^1.0.5" - object-inspect "^1.7.0" - object-keys "^1.1.1" - object.assign "^4.1.0" - string.prototype.trimleft "^2.1.1" - string.prototype.trimright "^2.1.1" - -es-to-primitive@^1.2.1: - version "1.2.1" - resolved "https://registry.npm.taobao.org/es-to-primitive/download/es-to-primitive-1.2.1.tgz#e55cd4c9cdc188bcefb03b366c736323fc5c898a" - integrity sha1-5VzUyc3BiLzvsDs2bHNjI/xciYo= - dependencies: - is-callable "^1.1.4" - is-date-object "^1.0.1" - is-symbol "^1.0.2" - -escape-html@~1.0.3: - version "1.0.3" - resolved "https://registry.npm.taobao.org/escape-html/download/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" - integrity sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg= - -escape-string-regexp@^1.0.5: - version "1.0.5" - resolved "https://registry.npm.taobao.org/escape-string-regexp/download/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" - integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= - -escodegen@^1.11.1: - version "1.14.2" - resolved "https://registry.npm.taobao.org/escodegen/download/escodegen-1.14.2.tgz?cache=0&sync_timestamp=1591221934086&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fescodegen%2Fdownload%2Fescodegen-1.14.2.tgz#14ab71bf5026c2aa08173afba22c6f3173284a84" - integrity sha1-FKtxv1AmwqoIFzr7oixvMXMoSoQ= - dependencies: - esprima "^4.0.1" - estraverse "^4.2.0" - esutils "^2.0.2" - optionator "^0.8.1" - optionalDependencies: - source-map "~0.6.1" - -esprima@^4.0.0, esprima@^4.0.1: - version "4.0.1" - resolved "https://registry.npm.taobao.org/esprima/download/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" - integrity sha1-E7BM2z5sXRnfkatph6hpVhmwqnE= - -estraverse@^4.2.0: - version "4.3.0" - resolved "https://registry.npm.taobao.org/estraverse/download/estraverse-4.3.0.tgz?cache=0&sync_timestamp=1586996117385&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Festraverse%2Fdownload%2Festraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d" - integrity sha1-OYrT88WiSUi+dyXoPRGn3ijNvR0= - -esutils@^2.0.2: - version "2.0.3" - resolved "https://registry.npm.taobao.org/esutils/download/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" - integrity sha1-dNLrTeC42hKTcRkQ1Qd1ubcQ72Q= - -etag@~1.8.1: - version "1.8.1" - resolved "https://registry.npm.taobao.org/etag/download/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" - integrity sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc= - -eventemitter3@^3.1.0: - version "3.1.2" - resolved "https://registry.npm.taobao.org/eventemitter3/download/eventemitter3-3.1.2.tgz?cache=0&sync_timestamp=1589283150629&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Feventemitter3%2Fdownload%2Feventemitter3-3.1.2.tgz#2d3d48f9c346698fce83a85d7d664e98535df6e7" - integrity sha1-LT1I+cNGaY/Og6hdfWZOmFNd9uc= - -exec-sh@^0.3.2: - version "0.3.4" - resolved "https://registry.npm.taobao.org/exec-sh/download/exec-sh-0.3.4.tgz#3a018ceb526cc6f6df2bb504b2bfe8e3a4934ec5" - integrity sha1-OgGM61JsxvbfK7UEsr/o46STTsU= - -execa@^1.0.0: - version "1.0.0" - resolved "https://registry.npm.taobao.org/execa/download/execa-1.0.0.tgz?cache=0&sync_timestamp=1590156534762&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fexeca%2Fdownload%2Fexeca-1.0.0.tgz#c6236a5bb4df6d6f15e88e7f017798216749ddd8" - integrity sha1-xiNqW7TfbW8V6I5/AXeYIWdJ3dg= - dependencies: - cross-spawn "^6.0.0" - get-stream "^4.0.0" - is-stream "^1.1.0" - npm-run-path "^2.0.0" - p-finally "^1.0.0" - signal-exit "^3.0.0" - strip-eof "^1.0.0" - -execa@^3.2.0: - version "3.4.0" - resolved "https://registry.npm.taobao.org/execa/download/execa-3.4.0.tgz?cache=0&sync_timestamp=1590156534762&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fexeca%2Fdownload%2Fexeca-3.4.0.tgz#c08ed4550ef65d858fac269ffc8572446f37eb89" - integrity sha1-wI7UVQ72XYWPrCaf/IVyRG8364k= - dependencies: - cross-spawn "^7.0.0" - get-stream "^5.0.0" - human-signals "^1.1.1" - is-stream "^2.0.0" - merge-stream "^2.0.0" - npm-run-path "^4.0.0" - onetime "^5.1.0" - p-finally "^2.0.0" - signal-exit "^3.0.2" - strip-final-newline "^2.0.0" - -exit@^0.1.2: - version "0.1.2" - resolved "https://registry.npm.taobao.org/exit/download/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c" - integrity sha1-BjJjj42HfMghB9MKD/8aF8uhzQw= - -expand-brackets@^2.1.4: - version "2.1.4" - resolved "https://registry.npm.taobao.org/expand-brackets/download/expand-brackets-2.1.4.tgz#b77735e315ce30f6b6eff0f83b04151a22449622" - integrity sha1-t3c14xXOMPa27/D4OwQVGiJEliI= - dependencies: - debug "^2.3.3" - define-property "^0.2.5" - extend-shallow "^2.0.1" - posix-character-classes "^0.1.0" - regex-not "^1.0.0" - snapdragon "^0.8.1" - to-regex "^3.0.1" - -expect@^25.5.0: - version "25.5.0" - resolved "https://registry.npm.taobao.org/expect/download/expect-25.5.0.tgz?cache=0&sync_timestamp=1588675340802&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fexpect%2Fdownload%2Fexpect-25.5.0.tgz#f07f848712a2813bb59167da3fb828ca21f58bba" - integrity sha1-8H+EhxKigTu1kWfaP7goyiH1i7o= - dependencies: - "@jest/types" "^25.5.0" - ansi-styles "^4.0.0" - jest-get-type "^25.2.6" - jest-matcher-utils "^25.5.0" - jest-message-util "^25.5.0" - jest-regex-util "^25.2.6" - -express@^4.0.0, express@^4.17.1: - version "4.17.1" - resolved "https://registry.npm.taobao.org/express/download/express-4.17.1.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fexpress%2Fdownload%2Fexpress-4.17.1.tgz#4491fc38605cf51f8629d39c2b5d026f98a4c134" - integrity sha1-RJH8OGBc9R+GKdOcK10Cb5ikwTQ= - dependencies: - accepts "~1.3.7" - array-flatten "1.1.1" - body-parser "1.19.0" - content-disposition "0.5.3" - content-type "~1.0.4" - cookie "0.4.0" - cookie-signature "1.0.6" - debug "2.6.9" - depd "~1.1.2" - encodeurl "~1.0.2" - escape-html "~1.0.3" - etag "~1.8.1" - finalhandler "~1.1.2" - fresh "0.5.2" - merge-descriptors "1.0.1" - methods "~1.1.2" - on-finished "~2.3.0" - parseurl "~1.3.3" - path-to-regexp "0.1.7" - proxy-addr "~2.0.5" - qs "6.7.0" - range-parser "~1.2.1" - safe-buffer "5.1.2" - send "0.17.1" - serve-static "1.14.1" - setprototypeof "1.1.1" - statuses "~1.5.0" - type-is "~1.6.18" - utils-merge "1.0.1" - vary "~1.1.2" - -extend-shallow@^2.0.1: - version "2.0.1" - resolved "https://registry.npm.taobao.org/extend-shallow/download/extend-shallow-2.0.1.tgz#51af7d614ad9a9f610ea1bafbb989d6b1c56890f" - integrity sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8= - dependencies: - is-extendable "^0.1.0" - -extend-shallow@^3.0.0, extend-shallow@^3.0.2: - version "3.0.2" - resolved "https://registry.npm.taobao.org/extend-shallow/download/extend-shallow-3.0.2.tgz#26a71aaf073b39fb2127172746131c2704028db8" - integrity sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg= - dependencies: - assign-symbols "^1.0.0" - is-extendable "^1.0.1" - -extend@~3.0.2: - version "3.0.2" - resolved "https://registry.npm.taobao.org/extend/download/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa" - integrity sha1-+LETa0Bx+9jrFAr/hYsQGewpFfo= - -extglob@^2.0.4: - version "2.0.4" - resolved "https://registry.npm.taobao.org/extglob/download/extglob-2.0.4.tgz#ad00fe4dc612a9232e8718711dc5cb5ab0285543" - integrity sha1-rQD+TcYSqSMuhxhxHcXLWrAoVUM= - dependencies: - array-unique "^0.3.2" - define-property "^1.0.0" - expand-brackets "^2.1.4" - extend-shallow "^2.0.1" - fragment-cache "^0.2.1" - regex-not "^1.0.0" - snapdragon "^0.8.1" - to-regex "^3.0.1" - -extsprintf@1.3.0: - version "1.3.0" - resolved "https://registry.npm.taobao.org/extsprintf/download/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05" - integrity sha1-lpGEQOMEGnpBT4xS48V06zw+HgU= - -extsprintf@^1.2.0: - version "1.4.0" - resolved "https://registry.npm.taobao.org/extsprintf/download/extsprintf-1.4.0.tgz#e2689f8f356fad62cca65a3a91c5df5f9551692f" - integrity sha1-4mifjzVvrWLMplo6kcXfX5VRaS8= - -fast-deep-equal@^3.1.1: - version "3.1.3" - resolved "https://registry.npm.taobao.org/fast-deep-equal/download/fast-deep-equal-3.1.3.tgz?cache=0&sync_timestamp=1591599666712&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ffast-deep-equal%2Fdownload%2Ffast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" - integrity sha1-On1WtVnWy8PrUSMlJE5hmmXGxSU= - -fast-json-stable-stringify@^2.0.0: - version "2.1.0" - resolved "https://registry.npm.taobao.org/fast-json-stable-stringify/download/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" - integrity sha1-h0v2nG9ATCtdmcSBNBOZ/VWJJjM= - -fast-levenshtein@~2.0.6: - version "2.0.6" - resolved "https://registry.npm.taobao.org/fast-levenshtein/download/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" - integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= - -fb-watchman@^2.0.0: - version "2.0.1" - resolved "https://registry.npm.taobao.org/fb-watchman/download/fb-watchman-2.0.1.tgz#fc84fb39d2709cf3ff6d743706157bb5708a8a85" - integrity sha1-/IT7OdJwnPP/bXQ3BhV7tXCKioU= - dependencies: - bser "2.1.1" - -fill-range@^4.0.0: - version "4.0.0" - resolved "https://registry.npm.taobao.org/fill-range/download/fill-range-4.0.0.tgz#d544811d428f98eb06a63dc402d2403c328c38f7" - integrity sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc= - dependencies: - extend-shallow "^2.0.1" - is-number "^3.0.0" - repeat-string "^1.6.1" - to-regex-range "^2.1.0" - -fill-range@^7.0.1: - version "7.0.1" - resolved "https://registry.npm.taobao.org/fill-range/download/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" - integrity sha1-GRmmp8df44ssfHflGYU12prN2kA= - dependencies: - to-regex-range "^5.0.1" - -finalhandler@~1.1.2: - version "1.1.2" - resolved "https://registry.npm.taobao.org/finalhandler/download/finalhandler-1.1.2.tgz#b7e7d000ffd11938d0fdb053506f6ebabe9f587d" - integrity sha1-t+fQAP/RGTjQ/bBTUG9uur6fWH0= - dependencies: - debug "2.6.9" - encodeurl "~1.0.2" - escape-html "~1.0.3" - on-finished "~2.3.0" - parseurl "~1.3.3" - statuses "~1.5.0" - unpipe "~1.0.0" - -find-up@^4.0.0, find-up@^4.1.0: - version "4.1.0" - resolved "https://registry.npm.taobao.org/find-up/download/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19" - integrity sha1-l6/n1s3AvFkoWEt8jXsW6KmqXRk= - dependencies: - locate-path "^5.0.0" - path-exists "^4.0.0" - -for-in@^1.0.2: - version "1.0.2" - resolved "https://registry.npm.taobao.org/for-in/download/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" - integrity sha1-gQaNKVqBQuwKxybG4iAMMPttXoA= - -forever-agent@~0.6.1: - version "0.6.1" - resolved "https://registry.npm.taobao.org/forever-agent/download/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" - integrity sha1-+8cfDEGt6zf5bFd60e1C2P2sypE= - -form-data@^3.0.0: - version "3.0.0" - resolved "https://registry.npm.taobao.org/form-data/download/form-data-3.0.0.tgz?cache=0&sync_timestamp=1573027118125&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fform-data%2Fdownload%2Fform-data-3.0.0.tgz#31b7e39c85f1355b7139ee0c647cf0de7f83c682" - integrity sha1-MbfjnIXxNVtxOe4MZHzw3n+DxoI= - dependencies: - asynckit "^0.4.0" - combined-stream "^1.0.8" - mime-types "^2.1.12" - -form-data@~2.3.2: - version "2.3.3" - resolved "https://registry.npm.taobao.org/form-data/download/form-data-2.3.3.tgz?cache=0&sync_timestamp=1573027118125&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fform-data%2Fdownload%2Fform-data-2.3.3.tgz#dcce52c05f644f298c6a7ab936bd724ceffbf3a6" - integrity sha1-3M5SwF9kTymManq5Nr1yTO/786Y= - dependencies: - asynckit "^0.4.0" - combined-stream "^1.0.6" - mime-types "^2.1.12" - -forwarded@~0.1.2: - version "0.1.2" - resolved "https://registry.npm.taobao.org/forwarded/download/forwarded-0.1.2.tgz#98c23dab1175657b8c0573e8ceccd91b0ff18c84" - integrity sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ= - -fragment-cache@^0.2.1: - version "0.2.1" - resolved "https://registry.npm.taobao.org/fragment-cache/download/fragment-cache-0.2.1.tgz#4290fad27f13e89be7f33799c6bc5a0abfff0d19" - integrity sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk= - dependencies: - map-cache "^0.2.2" - -fresh@0.5.2: - version "0.5.2" - resolved "https://registry.npm.taobao.org/fresh/download/fresh-0.5.2.tgz#3d8cadd90d976569fa835ab1f8e4b23a105605a7" - integrity sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac= - -fs-capacitor@^2.0.4: - version "2.0.4" - resolved "https://registry.npm.taobao.org/fs-capacitor/download/fs-capacitor-2.0.4.tgz?cache=0&sync_timestamp=1590810205669&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ffs-capacitor%2Fdownload%2Ffs-capacitor-2.0.4.tgz#5a22e72d40ae5078b4fe64fe4d08c0d3fc88ad3c" - integrity sha1-WiLnLUCuUHi0/mT+TQjA0/yIrTw= - -fs.realpath@^1.0.0: - version "1.0.0" - resolved "https://registry.npm.taobao.org/fs.realpath/download/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" - integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= - -fsevents@^2.1.2: - version "2.1.3" - resolved "https://registry.npm.taobao.org/fsevents/download/fsevents-2.1.3.tgz#fb738703ae8d2f9fe900c33836ddebee8b97f23e" - integrity sha1-+3OHA66NL5/pAMM4Nt3r7ouX8j4= - -function-bind@^1.1.1: - version "1.1.1" - resolved "https://registry.npm.taobao.org/function-bind/download/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" - integrity sha1-pWiZ0+o8m6uHS7l3O3xe3pL0iV0= - -gensync@^1.0.0-beta.1: - version "1.0.0-beta.1" - resolved "https://registry.npm.taobao.org/gensync/download/gensync-1.0.0-beta.1.tgz#58f4361ff987e5ff6e1e7a210827aa371eaac269" - integrity sha1-WPQ2H/mH5f9uHnohCCeqNx6qwmk= - -get-caller-file@^2.0.1: - version "2.0.5" - resolved "https://registry.npm.taobao.org/get-caller-file/download/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" - integrity sha1-T5RBKoLbMvNuOwuXQfipf+sDH34= - -get-package-type@^0.1.0: - version "0.1.0" - resolved "https://registry.npm.taobao.org/get-package-type/download/get-package-type-0.1.0.tgz#8de2d803cff44df3bc6c456e6668b36c3926e11a" - integrity sha1-jeLYA8/0TfO8bEVuZmizbDkm4Ro= - -get-stream@^4.0.0: - version "4.1.0" - resolved "https://registry.npm.taobao.org/get-stream/download/get-stream-4.1.0.tgz#c1b255575f3dc21d59bfc79cd3d2b46b1c3a54b5" - integrity sha1-wbJVV189wh1Zv8ec09K0axw6VLU= - dependencies: - pump "^3.0.0" - -get-stream@^5.0.0: - version "5.1.0" - resolved "https://registry.npm.taobao.org/get-stream/download/get-stream-5.1.0.tgz#01203cdc92597f9b909067c3e656cc1f4d3c4dc9" - integrity sha1-ASA83JJZf5uQkGfD5lbMH008Tck= - dependencies: - pump "^3.0.0" - -get-value@^2.0.3, get-value@^2.0.6: - version "2.0.6" - resolved "https://registry.npm.taobao.org/get-value/download/get-value-2.0.6.tgz#dc15ca1c672387ca76bd37ac0a395ba2042a2c28" - integrity sha1-3BXKHGcjh8p2vTesCjlbogQqLCg= - -getpass@^0.1.1: - version "0.1.7" - resolved "https://registry.npm.taobao.org/getpass/download/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa" - integrity sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo= - dependencies: - assert-plus "^1.0.0" - -glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4: - version "7.1.6" - resolved "https://registry.npm.taobao.org/glob/download/glob-7.1.6.tgz?cache=0&sync_timestamp=1573078079496&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fglob%2Fdownload%2Fglob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" - integrity sha1-FB8zuBp8JJLhJVlDB0gMRmeSeKY= - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^3.0.4" - once "^1.3.0" - path-is-absolute "^1.0.0" - -globals@^11.1.0: - version "11.12.0" - resolved "https://registry.npm.taobao.org/globals/download/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" - integrity sha1-q4eVM4hooLq9hSV1gBjCp+uVxC4= - -graceful-fs@^4.2.4: - version "4.2.4" - resolved "https://registry.npm.taobao.org/graceful-fs/download/graceful-fs-4.2.4.tgz?cache=0&sync_timestamp=1588086905523&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fgraceful-fs%2Fdownload%2Fgraceful-fs-4.2.4.tgz#2256bde14d3632958c465ebc96dc467ca07a29fb" - integrity sha1-Ila94U02MpWMRl68ltxGfKB6Kfs= - -graphql-extensions@^0.10.10: - version "0.10.10" - resolved "https://registry.npm.taobao.org/graphql-extensions/download/graphql-extensions-0.10.10.tgz#6b89d6b171f02a83bd4252f1e71c8d69147e7e2d" - integrity sha1-a4nWsXHwKoO9QlLx5xyNaRR+fi0= - dependencies: - "@apollographql/apollo-tools" "^0.4.3" - apollo-server-env "^2.4.3" - apollo-server-types "^0.2.10" - -graphql-extensions@^0.12.2: - version "0.12.2" - resolved "https://registry.npm.taobao.org/graphql-extensions/download/graphql-extensions-0.12.2.tgz#f22210e812939b7caa2127589f30e6a1c671540f" - integrity sha1-8iIQ6BKTm3yqISdYnzDmocZxVA8= - dependencies: - "@apollographql/apollo-tools" "^0.4.3" - apollo-server-env "^2.4.4" - apollo-server-types "^0.5.0" - -graphql-subscriptions@^1.0.0: - version "1.1.0" - resolved "https://registry.npm.taobao.org/graphql-subscriptions/download/graphql-subscriptions-1.1.0.tgz#5f2fa4233eda44cf7570526adfcf3c16937aef11" - integrity sha1-Xy+kIz7aRM91cFJq3888FpN67xE= - dependencies: - iterall "^1.2.1" - -graphql-tag@^2.9.2: - version "2.10.3" - resolved "https://registry.npm.taobao.org/graphql-tag/download/graphql-tag-2.10.3.tgz#ea1baba5eb8fc6339e4c4cf049dabe522b0edf03" - integrity sha1-6hurpeuPxjOeTEzwSdq+UisO3wM= - -graphql-tools@^4.0.0: - version "4.0.8" - resolved "https://registry.npm.taobao.org/graphql-tools/download/graphql-tools-4.0.8.tgz?cache=0&sync_timestamp=1591594453911&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fgraphql-tools%2Fdownload%2Fgraphql-tools-4.0.8.tgz#e7fb9f0d43408fb0878ba66b522ce871bafe9d30" - integrity sha1-5/ufDUNAj7CHi6ZrUizocbr+nTA= - dependencies: - apollo-link "^1.2.14" - apollo-utilities "^1.0.1" - deprecated-decorator "^0.1.6" - iterall "^1.1.3" - uuid "^3.1.0" - -graphql-upload@^8.0.2: - version "8.1.0" - resolved "https://registry.npm.taobao.org/graphql-upload/download/graphql-upload-8.1.0.tgz?cache=0&sync_timestamp=1590384460622&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fgraphql-upload%2Fdownload%2Fgraphql-upload-8.1.0.tgz#6d0ab662db5677a68bfb1f2c870ab2544c14939a" - integrity sha1-bQq2YttWd6aL+x8shwqyVEwUk5o= - dependencies: - busboy "^0.3.1" - fs-capacitor "^2.0.4" - http-errors "^1.7.3" - object-path "^0.11.4" - -graphql@^14.5.3, graphql@^14.6.0: - version "14.6.0" - resolved "https://registry.npm.taobao.org/graphql/download/graphql-14.6.0.tgz#57822297111e874ea12f5cd4419616930cd83e49" - integrity sha1-V4IilxEeh06hL1zUQZYWkwzYPkk= - dependencies: - iterall "^1.2.2" - -growly@^1.3.0: - version "1.3.0" - resolved "https://registry.npm.taobao.org/growly/download/growly-1.3.0.tgz#f10748cbe76af964b7c96c93c6bcc28af120c081" - integrity sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE= - -har-schema@^2.0.0: - version "2.0.0" - resolved "https://registry.npm.taobao.org/har-schema/download/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92" - integrity sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI= - -har-validator@~5.1.3: - version "5.1.3" - resolved "https://registry.npm.taobao.org/har-validator/download/har-validator-5.1.3.tgz#1ef89ebd3e4996557675eed9893110dc350fa080" - integrity sha1-HvievT5JllV2de7ZiTEQ3DUPoIA= - dependencies: - ajv "^6.5.5" - har-schema "^2.0.0" - -has-flag@^3.0.0: - version "3.0.0" - resolved "https://registry.npm.taobao.org/has-flag/download/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" - integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0= - -has-flag@^4.0.0: - version "4.0.0" - resolved "https://registry.npm.taobao.org/has-flag/download/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" - integrity sha1-lEdx/ZyByBJlxNaUGGDaBrtZR5s= - -has-symbols@^1.0.0, has-symbols@^1.0.1: - version "1.0.1" - resolved "https://registry.npm.taobao.org/has-symbols/download/has-symbols-1.0.1.tgz#9f5214758a44196c406d9bd76cebf81ec2dd31e8" - integrity sha1-n1IUdYpEGWxAbZvXbOv4HsLdMeg= - -has-value@^0.3.1: - version "0.3.1" - resolved "https://registry.npm.taobao.org/has-value/download/has-value-0.3.1.tgz#7b1f58bada62ca827ec0a2078025654845995e1f" - integrity sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8= - dependencies: - get-value "^2.0.3" - has-values "^0.1.4" - isobject "^2.0.0" - -has-value@^1.0.0: - version "1.0.0" - resolved "https://registry.npm.taobao.org/has-value/download/has-value-1.0.0.tgz#18b281da585b1c5c51def24c930ed29a0be6b177" - integrity sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc= - dependencies: - get-value "^2.0.6" - has-values "^1.0.0" - isobject "^3.0.0" - -has-values@^0.1.4: - version "0.1.4" - resolved "https://registry.npm.taobao.org/has-values/download/has-values-0.1.4.tgz#6d61de95d91dfca9b9a02089ad384bff8f62b771" - integrity sha1-bWHeldkd/Km5oCCJrThL/49it3E= - -has-values@^1.0.0: - version "1.0.0" - resolved "https://registry.npm.taobao.org/has-values/download/has-values-1.0.0.tgz#95b0b63fec2146619a6fe57fe75628d5a39efe4f" - integrity sha1-lbC2P+whRmGab+V/51Yo1aOe/k8= - dependencies: - is-number "^3.0.0" - kind-of "^4.0.0" - -has@^1.0.3: - version "1.0.3" - resolved "https://registry.npm.taobao.org/has/download/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" - integrity sha1-ci18v8H2qoJB8W3YFOAR4fQeh5Y= - dependencies: - function-bind "^1.1.1" - -hosted-git-info@^2.1.4: - version "2.8.8" - resolved "https://registry.npm.taobao.org/hosted-git-info/download/hosted-git-info-2.8.8.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fhosted-git-info%2Fdownload%2Fhosted-git-info-2.8.8.tgz#7539bd4bc1e0e0a895815a2e0262420b12858488" - integrity sha1-dTm9S8Hg4KiVgVouAmJCCxKFhIg= - -html-encoding-sniffer@^1.0.2: - version "1.0.2" - resolved "https://registry.npm.taobao.org/html-encoding-sniffer/download/html-encoding-sniffer-1.0.2.tgz#e70d84b94da53aa375e11fe3a351be6642ca46f8" - integrity sha1-5w2EuU2lOqN14R/jo1G+ZkLKRvg= - dependencies: - whatwg-encoding "^1.0.1" - -html-escaper@^2.0.0: - version "2.0.2" - resolved "https://registry.npm.taobao.org/html-escaper/download/html-escaper-2.0.2.tgz?cache=0&sync_timestamp=1585316700260&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fhtml-escaper%2Fdownload%2Fhtml-escaper-2.0.2.tgz#dfd60027da36a36dfcbe236262c00a5822681453" - integrity sha1-39YAJ9o2o238viNiYsAKWCJoFFM= - -http-errors@1.7.2: - version "1.7.2" - resolved "https://registry.npm.taobao.org/http-errors/download/http-errors-1.7.2.tgz#4f5029cf13239f31036e5b2e55292bcfbcc85c8f" - integrity sha1-T1ApzxMjnzEDblsuVSkrz7zIXI8= - dependencies: - depd "~1.1.2" - inherits "2.0.3" - setprototypeof "1.1.1" - statuses ">= 1.5.0 < 2" - toidentifier "1.0.0" - -http-errors@^1.7.3, http-errors@~1.7.2: - version "1.7.3" - resolved "https://registry.npm.taobao.org/http-errors/download/http-errors-1.7.3.tgz#6c619e4f9c60308c38519498c14fbb10aacebb06" - integrity sha1-bGGeT5xgMIw4UZSYwU+7EKrOuwY= - dependencies: - depd "~1.1.2" - inherits "2.0.4" - setprototypeof "1.1.1" - statuses ">= 1.5.0 < 2" - toidentifier "1.0.0" - -http-signature@~1.2.0: - version "1.2.0" - resolved "https://registry.npm.taobao.org/http-signature/download/http-signature-1.2.0.tgz#9aecd925114772f3d95b65a60abb8f7c18fbace1" - integrity sha1-muzZJRFHcvPZW2WmCruPfBj7rOE= - dependencies: - assert-plus "^1.0.0" - jsprim "^1.2.2" - sshpk "^1.7.0" - -human-signals@^1.1.1: - version "1.1.1" - resolved "https://registry.npm.taobao.org/human-signals/download/human-signals-1.1.1.tgz#c5b1cd14f50aeae09ab6c59fe63ba3395fe4dfa3" - integrity sha1-xbHNFPUK6uCatsWf5jujOV/k36M= - -iconv-lite@0.4.24: - version "0.4.24" - resolved "https://registry.npm.taobao.org/iconv-lite/download/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" - integrity sha1-ICK0sl+93CHS9SSXSkdKr+czkIs= - dependencies: - safer-buffer ">= 2.1.2 < 3" - -import-local@^3.0.2: - version "3.0.2" - resolved "https://registry.npm.taobao.org/import-local/download/import-local-3.0.2.tgz#a8cfd0431d1de4a2199703d003e3e62364fa6db6" - integrity sha1-qM/QQx0d5KIZlwPQA+PmI2T6bbY= - dependencies: - pkg-dir "^4.2.0" - resolve-cwd "^3.0.0" - -imurmurhash@^0.1.4: - version "0.1.4" - resolved "https://registry.npm.taobao.org/imurmurhash/download/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" - integrity sha1-khi5srkoojixPcT7a21XbyMUU+o= - -inflight@^1.0.4: - version "1.0.6" - resolved "https://registry.npm.taobao.org/inflight/download/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" - integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= - dependencies: - once "^1.3.0" - wrappy "1" - -inherits@2, inherits@2.0.4, inherits@^2.0.1: - version "2.0.4" - resolved "https://registry.npm.taobao.org/inherits/download/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" - integrity sha1-D6LGT5MpF8NDOg3tVTY6rjdBa3w= - -inherits@2.0.3: - version "2.0.3" - resolved "https://registry.npm.taobao.org/inherits/download/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" - integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4= - -ip-regex@^2.1.0: - version "2.1.0" - resolved "https://registry.npm.taobao.org/ip-regex/download/ip-regex-2.1.0.tgz#fa78bf5d2e6913c911ce9f819ee5146bb6d844e9" - integrity sha1-+ni/XS5pE8kRzp+BnuUUa7bYROk= - -ipaddr.js@1.9.1: - version "1.9.1" - resolved "https://registry.npm.taobao.org/ipaddr.js/download/ipaddr.js-1.9.1.tgz#bff38543eeb8984825079ff3a2a8e6cbd46781b3" - integrity sha1-v/OFQ+64mEglB5/zoqjmy9RngbM= - -is-accessor-descriptor@^0.1.6: - version "0.1.6" - resolved "https://registry.npm.taobao.org/is-accessor-descriptor/download/is-accessor-descriptor-0.1.6.tgz#a9e12cb3ae8d876727eeef3843f8a0897b5c98d6" - integrity sha1-qeEss66Nh2cn7u84Q/igiXtcmNY= - dependencies: - kind-of "^3.0.2" - -is-accessor-descriptor@^1.0.0: - version "1.0.0" - resolved "https://registry.npm.taobao.org/is-accessor-descriptor/download/is-accessor-descriptor-1.0.0.tgz#169c2f6d3df1f992618072365c9b0ea1f6878656" - integrity sha1-FpwvbT3x+ZJhgHI2XJsOofaHhlY= - dependencies: - kind-of "^6.0.0" - -is-arrayish@^0.2.1: - version "0.2.1" - resolved "https://registry.npm.taobao.org/is-arrayish/download/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" - integrity sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0= - -is-buffer@^1.1.5: - version "1.1.6" - resolved "https://registry.npm.taobao.org/is-buffer/download/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" - integrity sha1-76ouqdqg16suoTqXsritUf776L4= - -is-callable@^1.1.4, is-callable@^1.1.5: - version "1.2.0" - resolved "https://registry.npm.taobao.org/is-callable/download/is-callable-1.2.0.tgz?cache=0&sync_timestamp=1591427584255&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fis-callable%2Fdownload%2Fis-callable-1.2.0.tgz#83336560b54a38e35e3a2df7afd0454d691468bb" - integrity sha1-gzNlYLVKOONeOi33r9BFTWkUaLs= - -is-ci@^2.0.0: - version "2.0.0" - resolved "https://registry.npm.taobao.org/is-ci/download/is-ci-2.0.0.tgz#6bc6334181810e04b5c22b3d589fdca55026404c" - integrity sha1-a8YzQYGBDgS1wis9WJ/cpVAmQEw= - dependencies: - ci-info "^2.0.0" - -is-data-descriptor@^0.1.4: - version "0.1.4" - resolved "https://registry.npm.taobao.org/is-data-descriptor/download/is-data-descriptor-0.1.4.tgz#0b5ee648388e2c860282e793f1856fec3f301b56" - integrity sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y= - dependencies: - kind-of "^3.0.2" - -is-data-descriptor@^1.0.0: - version "1.0.0" - resolved "https://registry.npm.taobao.org/is-data-descriptor/download/is-data-descriptor-1.0.0.tgz#d84876321d0e7add03990406abbbbd36ba9268c7" - integrity sha1-2Eh2Mh0Oet0DmQQGq7u9NrqSaMc= - dependencies: - kind-of "^6.0.0" - -is-date-object@^1.0.1: - version "1.0.2" - resolved "https://registry.npm.taobao.org/is-date-object/download/is-date-object-1.0.2.tgz?cache=0&sync_timestamp=1576729165697&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fis-date-object%2Fdownload%2Fis-date-object-1.0.2.tgz#bda736f2cd8fd06d32844e7743bfa7494c3bfd7e" - integrity sha1-vac28s2P0G0yhE53Q7+nSUw7/X4= - -is-descriptor@^0.1.0: - version "0.1.6" - resolved "https://registry.npm.taobao.org/is-descriptor/download/is-descriptor-0.1.6.tgz#366d8240dde487ca51823b1ab9f07a10a78251ca" - integrity sha1-Nm2CQN3kh8pRgjsaufB6EKeCUco= - dependencies: - is-accessor-descriptor "^0.1.6" - is-data-descriptor "^0.1.4" - kind-of "^5.0.0" - -is-descriptor@^1.0.0, is-descriptor@^1.0.2: - version "1.0.2" - resolved "https://registry.npm.taobao.org/is-descriptor/download/is-descriptor-1.0.2.tgz#3b159746a66604b04f8c81524ba365c5f14d86ec" - integrity sha1-OxWXRqZmBLBPjIFSS6NlxfFNhuw= - dependencies: - is-accessor-descriptor "^1.0.0" - is-data-descriptor "^1.0.0" - kind-of "^6.0.2" - -is-docker@^2.0.0: - version "2.0.0" - resolved "https://registry.npm.taobao.org/is-docker/download/is-docker-2.0.0.tgz#2cb0df0e75e2d064fe1864c37cdeacb7b2dcf25b" - integrity sha1-LLDfDnXi0GT+GGTDfN6st7Lc8ls= - -is-extendable@^0.1.0, is-extendable@^0.1.1: - version "0.1.1" - resolved "https://registry.npm.taobao.org/is-extendable/download/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89" - integrity sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik= - -is-extendable@^1.0.1: - version "1.0.1" - resolved "https://registry.npm.taobao.org/is-extendable/download/is-extendable-1.0.1.tgz#a7470f9e426733d81bd81e1155264e3a3507cab4" - integrity sha1-p0cPnkJnM9gb2B4RVSZOOjUHyrQ= - dependencies: - is-plain-object "^2.0.4" - -is-fullwidth-code-point@^3.0.0: - version "3.0.0" - resolved "https://registry.npm.taobao.org/is-fullwidth-code-point/download/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" - integrity sha1-8Rb4Bk/pCz94RKOJl8C3UFEmnx0= - -is-generator-fn@^2.0.0: - version "2.1.0" - resolved "https://registry.npm.taobao.org/is-generator-fn/download/is-generator-fn-2.1.0.tgz#7d140adc389aaf3011a8f2a2a4cfa6faadffb118" - integrity sha1-fRQK3DiarzARqPKipM+m+q3/sRg= - -is-number@^3.0.0: - version "3.0.0" - resolved "https://registry.npm.taobao.org/is-number/download/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195" - integrity sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU= - dependencies: - kind-of "^3.0.2" - -is-number@^7.0.0: - version "7.0.0" - resolved "https://registry.npm.taobao.org/is-number/download/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" - integrity sha1-dTU0W4lnNNX4DE0GxQlVUnoU8Ss= - -is-plain-object@^2.0.3, is-plain-object@^2.0.4: - version "2.0.4" - resolved "https://registry.npm.taobao.org/is-plain-object/download/is-plain-object-2.0.4.tgz#2c163b3fafb1b606d9d17928f05c2a1c38e07677" - integrity sha1-LBY7P6+xtgbZ0Xko8FwqHDjgdnc= - dependencies: - isobject "^3.0.1" - -is-regex@^1.0.5: - version "1.1.0" - resolved "https://registry.npm.taobao.org/is-regex/download/is-regex-1.1.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fis-regex%2Fdownload%2Fis-regex-1.1.0.tgz#ece38e389e490df0dc21caea2bd596f987f767ff" - integrity sha1-7OOOOJ5JDfDcIcrqK9WW+Yf3Z/8= - dependencies: - has-symbols "^1.0.1" - -is-stream@^1.1.0: - version "1.1.0" - resolved "https://registry.npm.taobao.org/is-stream/download/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" - integrity sha1-EtSj3U5o4Lec6428hBc66A2RykQ= - -is-stream@^2.0.0: - version "2.0.0" - resolved "https://registry.npm.taobao.org/is-stream/download/is-stream-2.0.0.tgz#bde9c32680d6fae04129d6ac9d921ce7815f78e3" - integrity sha1-venDJoDW+uBBKdasnZIc54FfeOM= - -is-symbol@^1.0.2: - version "1.0.3" - resolved "https://registry.npm.taobao.org/is-symbol/download/is-symbol-1.0.3.tgz?cache=0&sync_timestamp=1574296307739&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fis-symbol%2Fdownload%2Fis-symbol-1.0.3.tgz#38e1014b9e6329be0de9d24a414fd7441ec61937" - integrity sha1-OOEBS55jKb4N6dJKQU/XRB7GGTc= - dependencies: - has-symbols "^1.0.1" - -is-typedarray@^1.0.0, is-typedarray@~1.0.0: - version "1.0.0" - resolved "https://registry.npm.taobao.org/is-typedarray/download/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" - integrity sha1-5HnICFjfDBsR3dppQPlgEfzaSpo= - -is-windows@^1.0.2: - version "1.0.2" - resolved "https://registry.npm.taobao.org/is-windows/download/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" - integrity sha1-0YUOuXkezRjmGCzhKjDzlmNLsZ0= - -is-wsl@^2.1.1: - version "2.2.0" - resolved "https://registry.npm.taobao.org/is-wsl/download/is-wsl-2.2.0.tgz?cache=0&sync_timestamp=1588494180082&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fis-wsl%2Fdownload%2Fis-wsl-2.2.0.tgz#74a4c76e77ca9fd3f932f290c17ea326cd157271" - integrity sha1-dKTHbnfKn9P5MvKQwX6jJs0VcnE= - dependencies: - is-docker "^2.0.0" - -isarray@1.0.0: - version "1.0.0" - resolved "https://registry.npm.taobao.org/isarray/download/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" - integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= - -isexe@^2.0.0: - version "2.0.0" - resolved "https://registry.npm.taobao.org/isexe/download/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" - integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA= - -isobject@^2.0.0: - version "2.1.0" - resolved "https://registry.npm.taobao.org/isobject/download/isobject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89" - integrity sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk= - dependencies: - isarray "1.0.0" - -isobject@^3.0.0, isobject@^3.0.1: - version "3.0.1" - resolved "https://registry.npm.taobao.org/isobject/download/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" - integrity sha1-TkMekrEalzFjaqH5yNHMvP2reN8= - -isstream@~0.1.2: - version "0.1.2" - resolved "https://registry.npm.taobao.org/isstream/download/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" - integrity sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo= - -istanbul-lib-coverage@^3.0.0: - version "3.0.0" - resolved "https://registry.npm.taobao.org/istanbul-lib-coverage/download/istanbul-lib-coverage-3.0.0.tgz#f5944a37c70b550b02a78a5c3b2055b280cec8ec" - integrity sha1-9ZRKN8cLVQsCp4pcOyBVsoDOyOw= - -istanbul-lib-instrument@^4.0.0: - version "4.0.3" - resolved "https://registry.npm.taobao.org/istanbul-lib-instrument/download/istanbul-lib-instrument-4.0.3.tgz#873c6fff897450118222774696a3f28902d77c1d" - integrity sha1-hzxv/4l0UBGCIndGlqPyiQLXfB0= - dependencies: - "@babel/core" "^7.7.5" - "@istanbuljs/schema" "^0.1.2" - istanbul-lib-coverage "^3.0.0" - semver "^6.3.0" - -istanbul-lib-report@^3.0.0: - version "3.0.0" - resolved "https://registry.npm.taobao.org/istanbul-lib-report/download/istanbul-lib-report-3.0.0.tgz?cache=0&sync_timestamp=1577062542584&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fistanbul-lib-report%2Fdownload%2Fistanbul-lib-report-3.0.0.tgz#7518fe52ea44de372f460a76b5ecda9ffb73d8a6" - integrity sha1-dRj+UupE3jcvRgp2tezan/tz2KY= - dependencies: - istanbul-lib-coverage "^3.0.0" - make-dir "^3.0.0" - supports-color "^7.1.0" - -istanbul-lib-source-maps@^4.0.0: - version "4.0.0" - resolved "https://registry.npm.taobao.org/istanbul-lib-source-maps/download/istanbul-lib-source-maps-4.0.0.tgz#75743ce6d96bb86dc7ee4352cf6366a23f0b1ad9" - integrity sha1-dXQ85tlruG3H7kNSz2Nmoj8LGtk= - dependencies: - debug "^4.1.1" - istanbul-lib-coverage "^3.0.0" - source-map "^0.6.1" - -istanbul-reports@^3.0.2: - version "3.0.2" - resolved "https://registry.npm.taobao.org/istanbul-reports/download/istanbul-reports-3.0.2.tgz?cache=0&sync_timestamp=1585931692719&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fistanbul-reports%2Fdownload%2Fistanbul-reports-3.0.2.tgz#d593210e5000683750cb09fc0644e4b6e27fd53b" - integrity sha1-1ZMhDlAAaDdQywn8BkTktuJ/1Ts= - dependencies: - html-escaper "^2.0.0" - istanbul-lib-report "^3.0.0" - -iterall@^1.1.3, iterall@^1.2.1, iterall@^1.2.2: - version "1.3.0" - resolved "https://registry.npm.taobao.org/iterall/download/iterall-1.3.0.tgz#afcb08492e2915cbd8a0884eb93a8c94d0d72fea" - integrity sha1-r8sISS4pFcvYoIhOuTqMlNDXL+o= - -jest-changed-files@^25.5.0: - version "25.5.0" - resolved "https://registry.npm.taobao.org/jest-changed-files/download/jest-changed-files-25.5.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fjest-changed-files%2Fdownload%2Fjest-changed-files-25.5.0.tgz#141cc23567ceb3f534526f8614ba39421383634c" - integrity sha1-FBzCNWfOs/U0Um+GFLo5QhODY0w= - dependencies: - "@jest/types" "^25.5.0" - execa "^3.2.0" - throat "^5.0.0" - -jest-cli@^25.5.4: - version "25.5.4" - resolved "https://registry.npm.taobao.org/jest-cli/download/jest-cli-25.5.4.tgz#b9f1a84d1301a92c5c217684cb79840831db9f0d" - integrity sha1-ufGoTRMBqSxcIXaEy3mECDHbnw0= - dependencies: - "@jest/core" "^25.5.4" - "@jest/test-result" "^25.5.0" - "@jest/types" "^25.5.0" - chalk "^3.0.0" - exit "^0.1.2" - graceful-fs "^4.2.4" - import-local "^3.0.2" - is-ci "^2.0.0" - jest-config "^25.5.4" - jest-util "^25.5.0" - jest-validate "^25.5.0" - prompts "^2.0.1" - realpath-native "^2.0.0" - yargs "^15.3.1" - -jest-config@^25.5.4: - version "25.5.4" - resolved "https://registry.npm.taobao.org/jest-config/download/jest-config-25.5.4.tgz?cache=0&sync_timestamp=1588675314467&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fjest-config%2Fdownload%2Fjest-config-25.5.4.tgz#38e2057b3f976ef7309b2b2c8dcd2a708a67f02c" - integrity sha1-OOIFez+Xbvcwmyssjc0qcIpn8Cw= - dependencies: - "@babel/core" "^7.1.0" - "@jest/test-sequencer" "^25.5.4" - "@jest/types" "^25.5.0" - babel-jest "^25.5.1" - chalk "^3.0.0" - deepmerge "^4.2.2" - glob "^7.1.1" - graceful-fs "^4.2.4" - jest-environment-jsdom "^25.5.0" - jest-environment-node "^25.5.0" - jest-get-type "^25.2.6" - jest-jasmine2 "^25.5.4" - jest-regex-util "^25.2.6" - jest-resolve "^25.5.1" - jest-util "^25.5.0" - jest-validate "^25.5.0" - micromatch "^4.0.2" - pretty-format "^25.5.0" - realpath-native "^2.0.0" - -jest-diff@^25.5.0: - version "25.5.0" - resolved "https://registry.npm.taobao.org/jest-diff/download/jest-diff-25.5.0.tgz#1dd26ed64f96667c068cef026b677dfa01afcfa9" - integrity sha1-HdJu1k+WZnwGjO8Ca2d9+gGvz6k= - dependencies: - chalk "^3.0.0" - diff-sequences "^25.2.6" - jest-get-type "^25.2.6" - pretty-format "^25.5.0" - -jest-docblock@^25.3.0: - version "25.3.0" - resolved "https://registry.npm.taobao.org/jest-docblock/download/jest-docblock-25.3.0.tgz#8b777a27e3477cd77a168c05290c471a575623ef" - integrity sha1-i3d6J+NHfNd6FowFKQxHGldWI+8= - dependencies: - detect-newline "^3.0.0" - -jest-each@^25.5.0: - version "25.5.0" - resolved "https://registry.npm.taobao.org/jest-each/download/jest-each-25.5.0.tgz?cache=0&sync_timestamp=1588675329383&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fjest-each%2Fdownload%2Fjest-each-25.5.0.tgz#0c3c2797e8225cb7bec7e4d249dcd96b934be516" - integrity sha1-DDwnl+giXLe+x+TSSdzZa5NL5RY= - dependencies: - "@jest/types" "^25.5.0" - chalk "^3.0.0" - jest-get-type "^25.2.6" - jest-util "^25.5.0" - pretty-format "^25.5.0" - -jest-environment-jsdom@^25.5.0: - version "25.5.0" - resolved "https://registry.npm.taobao.org/jest-environment-jsdom/download/jest-environment-jsdom-25.5.0.tgz#dcbe4da2ea997707997040ecf6e2560aec4e9834" - integrity sha1-3L5NouqZdweZcEDs9uJWCuxOmDQ= - dependencies: - "@jest/environment" "^25.5.0" - "@jest/fake-timers" "^25.5.0" - "@jest/types" "^25.5.0" - jest-mock "^25.5.0" - jest-util "^25.5.0" - jsdom "^15.2.1" - -jest-environment-node@^25.5.0: - version "25.5.0" - resolved "https://registry.npm.taobao.org/jest-environment-node/download/jest-environment-node-25.5.0.tgz?cache=0&sync_timestamp=1588675336982&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fjest-environment-node%2Fdownload%2Fjest-environment-node-25.5.0.tgz#0f55270d94804902988e64adca37c6ce0f7d07a1" - integrity sha1-D1UnDZSASQKYjmStyjfGzg99B6E= - dependencies: - "@jest/environment" "^25.5.0" - "@jest/fake-timers" "^25.5.0" - "@jest/types" "^25.5.0" - jest-mock "^25.5.0" - jest-util "^25.5.0" - semver "^6.3.0" - -jest-get-type@^25.2.6: - version "25.2.6" - resolved "https://registry.npm.taobao.org/jest-get-type/download/jest-get-type-25.2.6.tgz#0b0a32fab8908b44d508be81681487dbabb8d877" - integrity sha1-Cwoy+riQi0TVCL6BaBSH26u42Hc= - -jest-haste-map@^25.5.1: - version "25.5.1" - resolved "https://registry.npm.taobao.org/jest-haste-map/download/jest-haste-map-25.5.1.tgz#1df10f716c1d94e60a1ebf7798c9fb3da2620943" - integrity sha1-HfEPcWwdlOYKHr93mMn7PaJiCUM= - dependencies: - "@jest/types" "^25.5.0" - "@types/graceful-fs" "^4.1.2" - anymatch "^3.0.3" - fb-watchman "^2.0.0" - graceful-fs "^4.2.4" - jest-serializer "^25.5.0" - jest-util "^25.5.0" - jest-worker "^25.5.0" - micromatch "^4.0.2" - sane "^4.0.3" - walker "^1.0.7" - which "^2.0.2" - optionalDependencies: - fsevents "^2.1.2" - -jest-jasmine2@^25.5.4: - version "25.5.4" - resolved "https://registry.npm.taobao.org/jest-jasmine2/download/jest-jasmine2-25.5.4.tgz?cache=0&sync_timestamp=1588675312987&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fjest-jasmine2%2Fdownload%2Fjest-jasmine2-25.5.4.tgz#66ca8b328fb1a3c5364816f8958f6970a8526968" - integrity sha1-ZsqLMo+xo8U2SBb4lY9pcKhSaWg= - dependencies: - "@babel/traverse" "^7.1.0" - "@jest/environment" "^25.5.0" - "@jest/source-map" "^25.5.0" - "@jest/test-result" "^25.5.0" - "@jest/types" "^25.5.0" - chalk "^3.0.0" - co "^4.6.0" - expect "^25.5.0" - is-generator-fn "^2.0.0" - jest-each "^25.5.0" - jest-matcher-utils "^25.5.0" - jest-message-util "^25.5.0" - jest-runtime "^25.5.4" - jest-snapshot "^25.5.1" - jest-util "^25.5.0" - pretty-format "^25.5.0" - throat "^5.0.0" - -jest-leak-detector@^25.5.0: - version "25.5.0" - resolved "https://registry.npm.taobao.org/jest-leak-detector/download/jest-leak-detector-25.5.0.tgz?cache=0&sync_timestamp=1588675417838&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fjest-leak-detector%2Fdownload%2Fjest-leak-detector-25.5.0.tgz#2291c6294b0ce404241bb56fe60e2d0c3e34f0bb" - integrity sha1-IpHGKUsM5AQkG7Vv5g4tDD408Ls= - dependencies: - jest-get-type "^25.2.6" - pretty-format "^25.5.0" - -jest-matcher-utils@^25.5.0: - version "25.5.0" - resolved "https://registry.npm.taobao.org/jest-matcher-utils/download/jest-matcher-utils-25.5.0.tgz?cache=0&sync_timestamp=1588675334251&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fjest-matcher-utils%2Fdownload%2Fjest-matcher-utils-25.5.0.tgz#fbc98a12d730e5d2453d7f1ed4a4d948e34b7867" - integrity sha1-+8mKEtcw5dJFPX8e1KTZSONLeGc= - dependencies: - chalk "^3.0.0" - jest-diff "^25.5.0" - jest-get-type "^25.2.6" - pretty-format "^25.5.0" - -jest-message-util@^25.5.0: - version "25.5.0" - resolved "https://registry.npm.taobao.org/jest-message-util/download/jest-message-util-25.5.0.tgz?cache=0&sync_timestamp=1588675416652&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fjest-message-util%2Fdownload%2Fjest-message-util-25.5.0.tgz#ea11d93204cc7ae97456e1d8716251185b8880ea" - integrity sha1-6hHZMgTMeul0VuHYcWJRGFuIgOo= - dependencies: - "@babel/code-frame" "^7.0.0" - "@jest/types" "^25.5.0" - "@types/stack-utils" "^1.0.1" - chalk "^3.0.0" - graceful-fs "^4.2.4" - micromatch "^4.0.2" - slash "^3.0.0" - stack-utils "^1.0.1" - -jest-mock@^25.5.0: - version "25.5.0" - resolved "https://registry.npm.taobao.org/jest-mock/download/jest-mock-25.5.0.tgz?cache=0&sync_timestamp=1588675318142&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fjest-mock%2Fdownload%2Fjest-mock-25.5.0.tgz#a91a54dabd14e37ecd61665d6b6e06360a55387a" - integrity sha1-qRpU2r0U437NYWZda24GNgpVOHo= - dependencies: - "@jest/types" "^25.5.0" - -jest-pnp-resolver@^1.2.1: - version "1.2.1" - resolved "https://registry.npm.taobao.org/jest-pnp-resolver/download/jest-pnp-resolver-1.2.1.tgz#ecdae604c077a7fbc70defb6d517c3c1c898923a" - integrity sha1-7NrmBMB3p/vHDe+21RfDwciYkjo= - -jest-regex-util@^25.2.6: - version "25.2.6" - resolved "https://registry.npm.taobao.org/jest-regex-util/download/jest-regex-util-25.2.6.tgz#d847d38ba15d2118d3b06390056028d0f2fd3964" - integrity sha1-2EfTi6FdIRjTsGOQBWAo0PL9OWQ= - -jest-resolve-dependencies@^25.5.4: - version "25.5.4" - resolved "https://registry.npm.taobao.org/jest-resolve-dependencies/download/jest-resolve-dependencies-25.5.4.tgz?cache=0&sync_timestamp=1588675308084&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fjest-resolve-dependencies%2Fdownload%2Fjest-resolve-dependencies-25.5.4.tgz#85501f53957c8e3be446e863a74777b5a17397a7" - integrity sha1-hVAfU5V8jjvkRuhjp0d3taFzl6c= - dependencies: - "@jest/types" "^25.5.0" - jest-regex-util "^25.2.6" - jest-snapshot "^25.5.1" - -jest-resolve@^25.5.1: - version "25.5.1" - resolved "https://registry.npm.taobao.org/jest-resolve/download/jest-resolve-25.5.1.tgz?cache=0&sync_timestamp=1588675323403&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fjest-resolve%2Fdownload%2Fjest-resolve-25.5.1.tgz#0e6fbcfa7c26d2a5fe8f456088dc332a79266829" - integrity sha1-Dm+8+nwm0qX+j0VgiNwzKnkmaCk= - dependencies: - "@jest/types" "^25.5.0" - browser-resolve "^1.11.3" - chalk "^3.0.0" - graceful-fs "^4.2.4" - jest-pnp-resolver "^1.2.1" - read-pkg-up "^7.0.1" - realpath-native "^2.0.0" - resolve "^1.17.0" - slash "^3.0.0" - -jest-runner@^25.5.4: - version "25.5.4" - resolved "https://registry.npm.taobao.org/jest-runner/download/jest-runner-25.5.4.tgz?cache=0&sync_timestamp=1588675313164&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fjest-runner%2Fdownload%2Fjest-runner-25.5.4.tgz#ffec5df3875da5f5c878ae6d0a17b8e4ecd7c71d" - integrity sha1-/+xd84ddpfXIeK5tChe45OzXxx0= - dependencies: - "@jest/console" "^25.5.0" - "@jest/environment" "^25.5.0" - "@jest/test-result" "^25.5.0" - "@jest/types" "^25.5.0" - chalk "^3.0.0" - exit "^0.1.2" - graceful-fs "^4.2.4" - jest-config "^25.5.4" - jest-docblock "^25.3.0" - jest-haste-map "^25.5.1" - jest-jasmine2 "^25.5.4" - jest-leak-detector "^25.5.0" - jest-message-util "^25.5.0" - jest-resolve "^25.5.1" - jest-runtime "^25.5.4" - jest-util "^25.5.0" - jest-worker "^25.5.0" - source-map-support "^0.5.6" - throat "^5.0.0" - -jest-runtime@^25.5.4: - version "25.5.4" - resolved "https://registry.npm.taobao.org/jest-runtime/download/jest-runtime-25.5.4.tgz?cache=0&sync_timestamp=1588675313048&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fjest-runtime%2Fdownload%2Fjest-runtime-25.5.4.tgz#dc981fe2cb2137abcd319e74ccae7f7eeffbfaab" - integrity sha1-3Jgf4sshN6vNMZ50zK5/fu/7+qs= - dependencies: - "@jest/console" "^25.5.0" - "@jest/environment" "^25.5.0" - "@jest/globals" "^25.5.2" - "@jest/source-map" "^25.5.0" - "@jest/test-result" "^25.5.0" - "@jest/transform" "^25.5.1" - "@jest/types" "^25.5.0" - "@types/yargs" "^15.0.0" - chalk "^3.0.0" - collect-v8-coverage "^1.0.0" - exit "^0.1.2" - glob "^7.1.3" - graceful-fs "^4.2.4" - jest-config "^25.5.4" - jest-haste-map "^25.5.1" - jest-message-util "^25.5.0" - jest-mock "^25.5.0" - jest-regex-util "^25.2.6" - jest-resolve "^25.5.1" - jest-snapshot "^25.5.1" - jest-util "^25.5.0" - jest-validate "^25.5.0" - realpath-native "^2.0.0" - slash "^3.0.0" - strip-bom "^4.0.0" - yargs "^15.3.1" - -jest-serializer@^25.5.0: - version "25.5.0" - resolved "https://registry.npm.taobao.org/jest-serializer/download/jest-serializer-25.5.0.tgz#a993f484e769b4ed54e70e0efdb74007f503072b" - integrity sha1-qZP0hOdptO1U5w4O/bdAB/UDBys= - dependencies: - graceful-fs "^4.2.4" - -jest-snapshot@^25.5.1: - version "25.5.1" - resolved "https://registry.npm.taobao.org/jest-snapshot/download/jest-snapshot-25.5.1.tgz#1a2a576491f9961eb8d00c2e5fd479bc28e5ff7f" - integrity sha1-GipXZJH5lh640AwuX9R5vCjl/38= - dependencies: - "@babel/types" "^7.0.0" - "@jest/types" "^25.5.0" - "@types/prettier" "^1.19.0" - chalk "^3.0.0" - expect "^25.5.0" - graceful-fs "^4.2.4" - jest-diff "^25.5.0" - jest-get-type "^25.2.6" - jest-matcher-utils "^25.5.0" - jest-message-util "^25.5.0" - jest-resolve "^25.5.1" - make-dir "^3.0.0" - natural-compare "^1.4.0" - pretty-format "^25.5.0" - semver "^6.3.0" - -jest-util@^25.5.0: - version "25.5.0" - resolved "https://registry.npm.taobao.org/jest-util/download/jest-util-25.5.0.tgz#31c63b5d6e901274d264a4fec849230aa3fa35b0" - integrity sha1-McY7XW6QEnTSZKT+yEkjCqP6NbA= - dependencies: - "@jest/types" "^25.5.0" - chalk "^3.0.0" - graceful-fs "^4.2.4" - is-ci "^2.0.0" - make-dir "^3.0.0" - -jest-validate@^25.5.0: - version "25.5.0" - resolved "https://registry.npm.taobao.org/jest-validate/download/jest-validate-25.5.0.tgz?cache=0&sync_timestamp=1588675419522&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fjest-validate%2Fdownload%2Fjest-validate-25.5.0.tgz#fb4c93f332c2e4cf70151a628e58a35e459a413a" - integrity sha1-+0yT8zLC5M9wFRpijlijXkWaQTo= - dependencies: - "@jest/types" "^25.5.0" - camelcase "^5.3.1" - chalk "^3.0.0" - jest-get-type "^25.2.6" - leven "^3.1.0" - pretty-format "^25.5.0" - -jest-watcher@^25.5.0: - version "25.5.0" - resolved "https://registry.npm.taobao.org/jest-watcher/download/jest-watcher-25.5.0.tgz?cache=0&sync_timestamp=1588675365689&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fjest-watcher%2Fdownload%2Fjest-watcher-25.5.0.tgz#d6110d101df98badebe435003956fd4a465e8456" - integrity sha1-1hENEB35i63r5DUAOVb9SkZehFY= - dependencies: - "@jest/test-result" "^25.5.0" - "@jest/types" "^25.5.0" - ansi-escapes "^4.2.1" - chalk "^3.0.0" - jest-util "^25.5.0" - string-length "^3.1.0" - -jest-worker@^25.5.0: - version "25.5.0" - resolved "https://registry.npm.taobao.org/jest-worker/download/jest-worker-25.5.0.tgz#2611d071b79cea0f43ee57a3d118593ac1547db1" - integrity sha1-JhHQcbec6g9D7lej0RhZOsFUfbE= - dependencies: - merge-stream "^2.0.0" - supports-color "^7.0.0" - -jest@^25.1.0: - version "25.5.4" - resolved "https://registry.npm.taobao.org/jest/download/jest-25.5.4.tgz#f21107b6489cfe32b076ce2adcadee3587acb9db" - integrity sha1-8hEHtkic/jKwds4q3K3uNYesuds= - dependencies: - "@jest/core" "^25.5.4" - import-local "^3.0.2" - jest-cli "^25.5.4" - -js-tokens@^4.0.0: - version "4.0.0" - resolved "https://registry.npm.taobao.org/js-tokens/download/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" - integrity sha1-GSA/tZmR35jjoocFDUZHzerzJJk= - -js-yaml@^3.13.1: - version "3.14.0" - resolved "https://registry.npm.taobao.org/js-yaml/download/js-yaml-3.14.0.tgz#a7a34170f26a21bb162424d8adacb4113a69e482" - integrity sha1-p6NBcPJqIbsWJCTYray0ETpp5II= - dependencies: - argparse "^1.0.7" - esprima "^4.0.0" - -jsbn@~0.1.0: - version "0.1.1" - resolved "https://registry.npm.taobao.org/jsbn/download/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" - integrity sha1-peZUwuWi3rXyAdls77yoDA7y9RM= - -jsdom@^15.2.1: - version "15.2.1" - resolved "https://registry.npm.taobao.org/jsdom/download/jsdom-15.2.1.tgz?cache=0&sync_timestamp=1585532008781&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fjsdom%2Fdownload%2Fjsdom-15.2.1.tgz#d2feb1aef7183f86be521b8c6833ff5296d07ec5" - integrity sha1-0v6xrvcYP4a+UhuMaDP/UpbQfsU= - dependencies: - abab "^2.0.0" - acorn "^7.1.0" - acorn-globals "^4.3.2" - array-equal "^1.0.0" - cssom "^0.4.1" - cssstyle "^2.0.0" - data-urls "^1.1.0" - domexception "^1.0.1" - escodegen "^1.11.1" - html-encoding-sniffer "^1.0.2" - nwsapi "^2.2.0" - parse5 "5.1.0" - pn "^1.1.0" - request "^2.88.0" - request-promise-native "^1.0.7" - saxes "^3.1.9" - symbol-tree "^3.2.2" - tough-cookie "^3.0.1" - w3c-hr-time "^1.0.1" - w3c-xmlserializer "^1.1.2" - webidl-conversions "^4.0.2" - whatwg-encoding "^1.0.5" - whatwg-mimetype "^2.3.0" - whatwg-url "^7.0.0" - ws "^7.0.0" - xml-name-validator "^3.0.0" - -jsesc@^2.5.1: - version "2.5.2" - resolved "https://registry.npm.taobao.org/jsesc/download/jsesc-2.5.2.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fjsesc%2Fdownload%2Fjsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4" - integrity sha1-gFZNLkg9rPbo7yCWUKZ98/DCg6Q= - -json-parse-better-errors@^1.0.1: - version "1.0.2" - resolved "https://registry.npm.taobao.org/json-parse-better-errors/download/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9" - integrity sha1-u4Z8+zRQ5pEHwTHRxRS6s9yLyqk= - -json-schema-traverse@^0.4.1: - version "0.4.1" - resolved "https://registry.npm.taobao.org/json-schema-traverse/download/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" - integrity sha1-afaofZUTq4u4/mO9sJecRI5oRmA= - -json-schema@0.2.3: - version "0.2.3" - resolved "https://registry.npm.taobao.org/json-schema/download/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13" - integrity sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM= - -json-stringify-safe@~5.0.1: - version "5.0.1" - resolved "https://registry.npm.taobao.org/json-stringify-safe/download/json-stringify-safe-5.0.1.tgz?cache=0&sync_timestamp=1573614722142&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fjson-stringify-safe%2Fdownload%2Fjson-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" - integrity sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus= - -json5@^2.1.2: - version "2.1.3" - resolved "https://registry.npm.taobao.org/json5/download/json5-2.1.3.tgz?cache=0&sync_timestamp=1586045666090&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fjson5%2Fdownload%2Fjson5-2.1.3.tgz#c9b0f7fa9233bfe5807fe66fcf3a5617ed597d43" - integrity sha1-ybD3+pIzv+WAf+ZvzzpWF+1ZfUM= - dependencies: - minimist "^1.2.5" - -jsprim@^1.2.2: - version "1.4.1" - resolved "https://registry.npm.taobao.org/jsprim/download/jsprim-1.4.1.tgz#313e66bc1e5cc06e438bc1b7499c2e5c56acb6a2" - integrity sha1-MT5mvB5cwG5Di8G3SZwuXFastqI= - dependencies: - assert-plus "1.0.0" - extsprintf "1.3.0" - json-schema "0.2.3" - verror "1.10.0" - -kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.2.0: - version "3.2.2" - resolved "https://registry.npm.taobao.org/kind-of/download/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" - integrity sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ= - dependencies: - is-buffer "^1.1.5" - -kind-of@^4.0.0: - version "4.0.0" - resolved "https://registry.npm.taobao.org/kind-of/download/kind-of-4.0.0.tgz#20813df3d712928b207378691a45066fae72dd57" - integrity sha1-IIE989cSkosgc3hpGkUGb65y3Vc= - dependencies: - is-buffer "^1.1.5" - -kind-of@^5.0.0: - version "5.1.0" - resolved "https://registry.npm.taobao.org/kind-of/download/kind-of-5.1.0.tgz#729c91e2d857b7a419a1f9aa65685c4c33f5845d" - integrity sha1-cpyR4thXt6QZofmqZWhcTDP1hF0= - -kind-of@^6.0.0, kind-of@^6.0.2: - version "6.0.3" - resolved "https://registry.npm.taobao.org/kind-of/download/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd" - integrity sha1-B8BQNKbDSfoG4k+jWqdttFgM5N0= - -kleur@^3.0.3: - version "3.0.3" - resolved "https://registry.npm.taobao.org/kleur/download/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e" - integrity sha1-p5yezIbuHOP6YgbRIWxQHxR/wH4= - -leven@^3.1.0: - version "3.1.0" - resolved "https://registry.npm.taobao.org/leven/download/leven-3.1.0.tgz#77891de834064cccba82ae7842bb6b14a13ed7f2" - integrity sha1-d4kd6DQGTMy6gq54QrtrFKE+1/I= - -levn@~0.3.0: - version "0.3.0" - resolved "https://registry.npm.taobao.org/levn/download/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" - integrity sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4= - dependencies: - prelude-ls "~1.1.2" - type-check "~0.3.2" - -lines-and-columns@^1.1.6: - version "1.1.6" - resolved "https://registry.npm.taobao.org/lines-and-columns/download/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00" - integrity sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA= - -locate-path@^5.0.0: - version "5.0.0" - resolved "https://registry.npm.taobao.org/locate-path/download/locate-path-5.0.0.tgz#1afba396afd676a6d42504d0a67a3a7eb9f62aa0" - integrity sha1-Gvujlq/WdqbUJQTQpno6frn2KqA= - dependencies: - p-locate "^4.1.0" - -lodash.sortby@^4.7.0: - version "4.7.0" - resolved "https://registry.npm.taobao.org/lodash.sortby/download/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438" - integrity sha1-7dFMgk4sycHgsKG0K7UhBRakJDg= - -lodash.xorby@^4.7.0: - version "4.7.0" - resolved "https://registry.npm.taobao.org/lodash.xorby/download/lodash.xorby-4.7.0.tgz#9c19a6f9f063a6eb53dd03c1b6871799801463d7" - integrity sha1-nBmm+fBjputT3QPBtocXmYAUY9c= - -lodash@^4.17.13, lodash@^4.17.15: - version "4.17.15" - resolved "https://registry.npm.taobao.org/lodash/download/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" - integrity sha1-tEf2ZwoEVbv+7dETku/zMOoJdUg= - -loglevel-debug@^0.0.1: - version "0.0.1" - resolved "https://registry.npm.taobao.org/loglevel-debug/download/loglevel-debug-0.0.1.tgz#89f89d3dba13cba8a2cb4615d5d3ad7189f48a29" - integrity sha1-ifidPboTy6iiy0YV1dOtcYn0iik= - dependencies: - loglevel "^1.4.0" - -loglevel@^1.4.0, loglevel@^1.6.1, loglevel@^1.6.7: - version "1.6.8" - resolved "https://registry.npm.taobao.org/loglevel/download/loglevel-1.6.8.tgz#8a25fb75d092230ecd4457270d80b54e28011171" - integrity sha1-iiX7ddCSIw7NRFcnDYC1TigBEXE= - -lolex@^5.0.0: - version "5.1.2" - resolved "https://registry.npm.taobao.org/lolex/download/lolex-5.1.2.tgz#953694d098ce7c07bc5ed6d0e42bc6c0c6d5a367" - integrity sha1-lTaU0JjOfAe8XtbQ5CvGwMbVo2c= - dependencies: - "@sinonjs/commons" "^1.7.0" - -long@^4.0.0: - version "4.0.0" - resolved "https://registry.npm.taobao.org/long/download/long-4.0.0.tgz#9a7b71cfb7d361a194ea555241c92f7468d5bf28" - integrity sha1-mntxz7fTYaGU6lVSQckvdGjVvyg= - -lru-cache@^5.0.0: - version "5.1.1" - resolved "https://registry.npm.taobao.org/lru-cache/download/lru-cache-5.1.1.tgz#1da27e6710271947695daf6848e847f01d84b920" - integrity sha1-HaJ+ZxAnGUdpXa9oSOhH8B2EuSA= - dependencies: - yallist "^3.0.2" - -make-dir@^3.0.0: - version "3.1.0" - resolved "https://registry.npm.taobao.org/make-dir/download/make-dir-3.1.0.tgz?cache=0&sync_timestamp=1587567610342&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fmake-dir%2Fdownload%2Fmake-dir-3.1.0.tgz#415e967046b3a7f1d185277d84aa58203726a13f" - integrity sha1-QV6WcEazp/HRhSd9hKpYIDcmoT8= - dependencies: - semver "^6.0.0" - -makeerror@1.0.x: - version "1.0.11" - resolved "https://registry.npm.taobao.org/makeerror/download/makeerror-1.0.11.tgz#e01a5c9109f2af79660e4e8b9587790184f5a96c" - integrity sha1-4BpckQnyr3lmDk6LlYd5AYT1qWw= - dependencies: - tmpl "1.0.x" - -map-cache@^0.2.2: - version "0.2.2" - resolved "https://registry.npm.taobao.org/map-cache/download/map-cache-0.2.2.tgz#c32abd0bd6525d9b051645bb4f26ac5dc98a0dbf" - integrity sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8= - -map-visit@^1.0.0: - version "1.0.0" - resolved "https://registry.npm.taobao.org/map-visit/download/map-visit-1.0.0.tgz#ecdca8f13144e660f1b5bd41f12f3479d98dfb8f" - integrity sha1-7Nyo8TFE5mDxtb1B8S80edmN+48= - dependencies: - object-visit "^1.0.0" - -media-typer@0.3.0: - version "0.3.0" - resolved "https://registry.npm.taobao.org/media-typer/download/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748" - integrity sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g= - -merge-descriptors@1.0.1: - version "1.0.1" - resolved "https://registry.npm.taobao.org/merge-descriptors/download/merge-descriptors-1.0.1.tgz#b00aaa556dd8b44568150ec9d1b953f3f90cbb61" - integrity sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E= - -merge-stream@^2.0.0: - version "2.0.0" - resolved "https://registry.npm.taobao.org/merge-stream/download/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" - integrity sha1-UoI2KaFN0AyXcPtq1H3GMQ8sH2A= - -methods@~1.1.2: - version "1.1.2" - resolved "https://registry.npm.taobao.org/methods/download/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" - integrity sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4= - -micromatch@^3.1.4: - version "3.1.10" - resolved "https://registry.npm.taobao.org/micromatch/download/micromatch-3.1.10.tgz?cache=0&sync_timestamp=1588851826089&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fmicromatch%2Fdownload%2Fmicromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23" - integrity sha1-cIWbyVyYQJUvNZoGij/En57PrCM= - dependencies: - arr-diff "^4.0.0" - array-unique "^0.3.2" - braces "^2.3.1" - define-property "^2.0.2" - extend-shallow "^3.0.2" - extglob "^2.0.4" - fragment-cache "^0.2.1" - kind-of "^6.0.2" - nanomatch "^1.2.9" - object.pick "^1.3.0" - regex-not "^1.0.0" - snapdragon "^0.8.1" - to-regex "^3.0.2" - -micromatch@^4.0.2: - version "4.0.2" - resolved "https://registry.npm.taobao.org/micromatch/download/micromatch-4.0.2.tgz?cache=0&sync_timestamp=1588851826089&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fmicromatch%2Fdownload%2Fmicromatch-4.0.2.tgz#4fcb0999bf9fbc2fcbdd212f6d629b9a56c39259" - integrity sha1-T8sJmb+fvC/L3SEvbWKbmlbDklk= - dependencies: - braces "^3.0.1" - picomatch "^2.0.5" - -mime-db@1.44.0: - version "1.44.0" - resolved "https://registry.npm.taobao.org/mime-db/download/mime-db-1.44.0.tgz#fa11c5eb0aca1334b4233cb4d52f10c5a6272f92" - integrity sha1-+hHF6wrKEzS0Izy01S8QxaYnL5I= - -mime-types@^2.1.12, mime-types@~2.1.19, mime-types@~2.1.24: - version "2.1.27" - resolved "https://registry.npm.taobao.org/mime-types/download/mime-types-2.1.27.tgz#47949f98e279ea53119f5722e0f34e529bec009f" - integrity sha1-R5SfmOJ56lMRn1ci4PNOUpvsAJ8= - dependencies: - mime-db "1.44.0" - -mime@1.6.0: - version "1.6.0" - resolved "https://registry.npm.taobao.org/mime/download/mime-1.6.0.tgz?cache=0&sync_timestamp=1590596728112&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fmime%2Fdownload%2Fmime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1" - integrity sha1-Ms2eXGRVO9WNGaVor0Uqz/BJgbE= - -mimic-fn@^2.1.0: - version "2.1.0" - resolved "https://registry.npm.taobao.org/mimic-fn/download/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" - integrity sha1-ftLCzMyvhNP/y3pptXcR/CCDQBs= - -minimatch@^3.0.4: - version "3.0.4" - resolved "https://registry.npm.taobao.org/minimatch/download/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" - integrity sha1-UWbihkV/AzBgZL5Ul+jbsMPTIIM= - dependencies: - brace-expansion "^1.1.7" - -minimist@^1.1.1, minimist@^1.2.0, minimist@^1.2.5: - version "1.2.5" - resolved "https://registry.npm.taobao.org/minimist/download/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602" - integrity sha1-Z9ZgFLZqaoqqDAg8X9WN9OTpdgI= - -mixin-deep@^1.2.0: - version "1.3.2" - resolved "https://registry.npm.taobao.org/mixin-deep/download/mixin-deep-1.3.2.tgz#1120b43dc359a785dce65b55b82e257ccf479566" - integrity sha1-ESC0PcNZp4Xc5ltVuC4lfM9HlWY= - dependencies: - for-in "^1.0.2" - is-extendable "^1.0.1" - -ms@2.0.0: - version "2.0.0" - resolved "https://registry.npm.taobao.org/ms/download/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" - integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g= - -ms@2.1.1: - version "2.1.1" - resolved "https://registry.npm.taobao.org/ms/download/ms-2.1.1.tgz#30a5864eb3ebb0a66f2ebe6d727af06a09d86e0a" - integrity sha1-MKWGTrPrsKZvLr5tcnrwagnYbgo= - -ms@^2.1.1: - version "2.1.2" - resolved "https://registry.npm.taobao.org/ms/download/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" - integrity sha1-0J0fNXtEP0kzgqjrPM0YOHKuYAk= - -nanomatch@^1.2.9: - version "1.2.13" - resolved "https://registry.npm.taobao.org/nanomatch/download/nanomatch-1.2.13.tgz#b87a8aa4fc0de8fe6be88895b38983ff265bd119" - integrity sha1-uHqKpPwN6P5r6IiVs4mD/yZb0Rk= - dependencies: - arr-diff "^4.0.0" - array-unique "^0.3.2" - define-property "^2.0.2" - extend-shallow "^3.0.2" - fragment-cache "^0.2.1" - is-windows "^1.0.2" - kind-of "^6.0.2" - object.pick "^1.3.0" - regex-not "^1.0.0" - snapdragon "^0.8.1" - to-regex "^3.0.1" - -natural-compare@^1.4.0: - version "1.4.0" - resolved "https://registry.npm.taobao.org/natural-compare/download/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" - integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc= - -negotiator@0.6.2: - version "0.6.2" - resolved "https://registry.npm.taobao.org/negotiator/download/negotiator-0.6.2.tgz#feacf7ccf525a77ae9634436a64883ffeca346fb" - integrity sha1-/qz3zPUlp3rpY0Q2pkiD/+yjRvs= - -nice-try@^1.0.4: - version "1.0.5" - resolved "https://registry.npm.taobao.org/nice-try/download/nice-try-1.0.5.tgz?cache=0&sync_timestamp=1584699756095&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fnice-try%2Fdownload%2Fnice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" - integrity sha1-ozeKdpbOfSI+iPybdkvX7xCJ42Y= - -node-fetch@^2.1.2, node-fetch@^2.2.0, node-fetch@^2.6.0: - version "2.6.0" - resolved "https://registry.npm.taobao.org/node-fetch/download/node-fetch-2.6.0.tgz#e633456386d4aa55863f676a7ab0daa8fdecb0fd" - integrity sha1-5jNFY4bUqlWGP2dqerDaqP3ssP0= - -node-int64@^0.4.0: - version "0.4.0" - resolved "https://registry.npm.taobao.org/node-int64/download/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" - integrity sha1-h6kGXNs1XTGC2PlM4RGIuCXGijs= - -node-modules-regexp@^1.0.0: - version "1.0.0" - resolved "https://registry.npm.taobao.org/node-modules-regexp/download/node-modules-regexp-1.0.0.tgz#8d9dbe28964a4ac5712e9131642107c71e90ec40" - integrity sha1-jZ2+KJZKSsVxLpExZCEHxx6Q7EA= - -node-notifier@^6.0.0: - version "6.0.0" - resolved "https://registry.npm.taobao.org/node-notifier/download/node-notifier-6.0.0.tgz#cea319e06baa16deec8ce5cd7f133c4a46b68e12" - integrity sha1-zqMZ4GuqFt7sjOXNfxM8Ska2jhI= - dependencies: - growly "^1.3.0" - is-wsl "^2.1.1" - semver "^6.3.0" - shellwords "^0.1.1" - which "^1.3.1" - -normalize-package-data@^2.5.0: - version "2.5.0" - resolved "https://registry.npm.taobao.org/normalize-package-data/download/normalize-package-data-2.5.0.tgz#e66db1838b200c1dfc233225d12cb36520e234a8" - integrity sha1-5m2xg4sgDB38IzIl0SyzZSDiNKg= - dependencies: - hosted-git-info "^2.1.4" - resolve "^1.10.0" - semver "2 || 3 || 4 || 5" - validate-npm-package-license "^3.0.1" - -normalize-path@^2.1.1: - version "2.1.1" - resolved "https://registry.npm.taobao.org/normalize-path/download/normalize-path-2.1.1.tgz?cache=0&sync_timestamp=1588851827399&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fnormalize-path%2Fdownload%2Fnormalize-path-2.1.1.tgz#1ab28b556e198363a8c1a6f7e6fa20137fe6aed9" - integrity sha1-GrKLVW4Zg2Oowab35vogE3/mrtk= - dependencies: - remove-trailing-separator "^1.0.1" - -normalize-path@^3.0.0: - version "3.0.0" - resolved "https://registry.npm.taobao.org/normalize-path/download/normalize-path-3.0.0.tgz?cache=0&sync_timestamp=1588851827399&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fnormalize-path%2Fdownload%2Fnormalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" - integrity sha1-Dc1p/yOhybEf0JeDFmRKA4ghamU= - -npm-run-path@^2.0.0: - version "2.0.2" - resolved "https://registry.npm.taobao.org/npm-run-path/download/npm-run-path-2.0.2.tgz?cache=0&sync_timestamp=1577052941951&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fnpm-run-path%2Fdownload%2Fnpm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f" - integrity sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8= - dependencies: - path-key "^2.0.0" - -npm-run-path@^4.0.0: - version "4.0.1" - resolved "https://registry.npm.taobao.org/npm-run-path/download/npm-run-path-4.0.1.tgz?cache=0&sync_timestamp=1577052941951&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fnpm-run-path%2Fdownload%2Fnpm-run-path-4.0.1.tgz#b7ecd1e5ed53da8e37a55e1c2269e0b97ed748ea" - integrity sha1-t+zR5e1T2o43pV4cImnguX7XSOo= - dependencies: - path-key "^3.0.0" - -nwsapi@^2.2.0: - version "2.2.0" - resolved "https://registry.npm.taobao.org/nwsapi/download/nwsapi-2.2.0.tgz#204879a9e3d068ff2a55139c2c772780681a38b7" - integrity sha1-IEh5qePQaP8qVROcLHcngGgaOLc= - -oauth-sign@~0.9.0: - version "0.9.0" - resolved "https://registry.npm.taobao.org/oauth-sign/download/oauth-sign-0.9.0.tgz#47a7b016baa68b5fa0ecf3dee08a85c679ac6455" - integrity sha1-R6ewFrqmi1+g7PPe4IqFxnmsZFU= - -object-assign@^4: - version "4.1.1" - resolved "https://registry.npm.taobao.org/object-assign/download/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" - integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= - -object-copy@^0.1.0: - version "0.1.0" - resolved "https://registry.npm.taobao.org/object-copy/download/object-copy-0.1.0.tgz#7e7d858b781bd7c991a41ba975ed3812754e998c" - integrity sha1-fn2Fi3gb18mRpBupde04EnVOmYw= - dependencies: - copy-descriptor "^0.1.0" - define-property "^0.2.5" - kind-of "^3.0.3" - -object-inspect@^1.7.0: - version "1.7.0" - resolved "https://registry.npm.taobao.org/object-inspect/download/object-inspect-1.7.0.tgz#f4f6bd181ad77f006b5ece60bd0b6f398ff74a67" - integrity sha1-9Pa9GBrXfwBrXs5gvQtvOY/3Smc= - -object-keys@^1.0.11, object-keys@^1.0.12, object-keys@^1.1.1: - version "1.1.1" - resolved "https://registry.npm.taobao.org/object-keys/download/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" - integrity sha1-HEfyct8nfzsdrwYWd9nILiMixg4= - -object-path@^0.11.4: - version "0.11.4" - resolved "https://registry.npm.taobao.org/object-path/download/object-path-0.11.4.tgz#370ae752fbf37de3ea70a861c23bba8915691949" - integrity sha1-NwrnUvvzfePqcKhhwju6iRVpGUk= - -object-visit@^1.0.0: - version "1.0.1" - resolved "https://registry.npm.taobao.org/object-visit/download/object-visit-1.0.1.tgz#f79c4493af0c5377b59fe39d395e41042dd045bb" - integrity sha1-95xEk68MU3e1n+OdOV5BBC3QRbs= - dependencies: - isobject "^3.0.0" - -object.assign@^4.1.0: - version "4.1.0" - resolved "https://registry.npm.taobao.org/object.assign/download/object.assign-4.1.0.tgz#968bf1100d7956bb3ca086f006f846b3bc4008da" - integrity sha1-lovxEA15Vrs8oIbwBvhGs7xACNo= - dependencies: - define-properties "^1.1.2" - function-bind "^1.1.1" - has-symbols "^1.0.0" - object-keys "^1.0.11" - -object.getownpropertydescriptors@^2.1.0: - version "2.1.0" - resolved "https://registry.npm.taobao.org/object.getownpropertydescriptors/download/object.getownpropertydescriptors-2.1.0.tgz#369bf1f9592d8ab89d712dced5cb81c7c5352649" - integrity sha1-Npvx+VktiridcS3O1cuBx8U1Jkk= - dependencies: - define-properties "^1.1.3" - es-abstract "^1.17.0-next.1" - -object.pick@^1.3.0: - version "1.3.0" - resolved "https://registry.npm.taobao.org/object.pick/download/object.pick-1.3.0.tgz#87a10ac4c1694bd2e1cbf53591a66141fb5dd747" - integrity sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c= - dependencies: - isobject "^3.0.1" - -on-finished@~2.3.0: - version "2.3.0" - resolved "https://registry.npm.taobao.org/on-finished/download/on-finished-2.3.0.tgz#20f1336481b083cd75337992a16971aa2d906947" - integrity sha1-IPEzZIGwg811M3mSoWlxqi2QaUc= - dependencies: - ee-first "1.1.1" - -once@^1.3.0, once@^1.3.1, once@^1.4.0: - version "1.4.0" - resolved "https://registry.npm.taobao.org/once/download/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" - integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= - dependencies: - wrappy "1" - -onetime@^5.1.0: - version "5.1.0" - resolved "https://registry.npm.taobao.org/onetime/download/onetime-5.1.0.tgz#fff0f3c91617fe62bb50189636e99ac8a6df7be5" - integrity sha1-//DzyRYX/mK7UBiWNumayKbfe+U= - dependencies: - mimic-fn "^2.1.0" - -optimism@^0.10.0: - version "0.10.3" - resolved "https://registry.npm.taobao.org/optimism/download/optimism-0.10.3.tgz#163268fdc741dea2fb50f300bedda80356445fd7" - integrity sha1-FjJo/cdB3qL7UPMAvt2oA1ZEX9c= - dependencies: - "@wry/context" "^0.4.0" - -optionator@^0.8.1: - version "0.8.3" - resolved "https://registry.npm.taobao.org/optionator/download/optionator-0.8.3.tgz?cache=0&sync_timestamp=1585966209412&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Foptionator%2Fdownload%2Foptionator-0.8.3.tgz#84fa1d036fe9d3c7e21d99884b601167ec8fb495" - integrity sha1-hPodA2/p08fiHZmIS2ARZ+yPtJU= - dependencies: - deep-is "~0.1.3" - fast-levenshtein "~2.0.6" - levn "~0.3.0" - prelude-ls "~1.1.2" - type-check "~0.3.2" - word-wrap "~1.2.3" - -p-each-series@^2.1.0: - version "2.1.0" - resolved "https://registry.npm.taobao.org/p-each-series/download/p-each-series-2.1.0.tgz#961c8dd3f195ea96c747e636b262b800a6b1af48" - integrity sha1-lhyN0/GV6pbHR+Y2smK4AKaxr0g= - -p-finally@^1.0.0: - version "1.0.0" - resolved "https://registry.npm.taobao.org/p-finally/download/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" - integrity sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4= - -p-finally@^2.0.0: - version "2.0.1" - resolved "https://registry.npm.taobao.org/p-finally/download/p-finally-2.0.1.tgz#bd6fcaa9c559a096b680806f4d657b3f0f240561" - integrity sha1-vW/KqcVZoJa2gIBvTWV7Pw8kBWE= - -p-limit@^2.2.0: - version "2.3.0" - resolved "https://registry.npm.taobao.org/p-limit/download/p-limit-2.3.0.tgz?cache=0&sync_timestamp=1591460614335&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fp-limit%2Fdownload%2Fp-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1" - integrity sha1-PdM8ZHohT9//2DWTPrCG2g3CHbE= - dependencies: - p-try "^2.0.0" - -p-locate@^4.1.0: - version "4.1.0" - resolved "https://registry.npm.taobao.org/p-locate/download/p-locate-4.1.0.tgz#a3428bb7088b3a60292f66919278b7c297ad4f07" - integrity sha1-o0KLtwiLOmApL2aRkni3wpetTwc= - dependencies: - p-limit "^2.2.0" - -p-try@^2.0.0: - version "2.2.0" - resolved "https://registry.npm.taobao.org/p-try/download/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" - integrity sha1-yyhoVA4xPWHeWPr741zpAE1VQOY= - -parse-json@^5.0.0: - version "5.0.0" - resolved "https://registry.npm.taobao.org/parse-json/download/parse-json-5.0.0.tgz#73e5114c986d143efa3712d4ea24db9a4266f60f" - integrity sha1-c+URTJhtFD76NxLU6iTbmkJm9g8= - dependencies: - "@babel/code-frame" "^7.0.0" - error-ex "^1.3.1" - json-parse-better-errors "^1.0.1" - lines-and-columns "^1.1.6" - -parse5@5.1.0: - version "5.1.0" - resolved "https://registry.npm.taobao.org/parse5/download/parse5-5.1.0.tgz#c59341c9723f414c452975564c7c00a68d58acd2" - integrity sha1-xZNByXI/QUxFKXVWTHwApo1YrNI= - -parseurl@^1.3.2, parseurl@~1.3.3: - version "1.3.3" - resolved "https://registry.npm.taobao.org/parseurl/download/parseurl-1.3.3.tgz#9da19e7bee8d12dff0513ed5b76957793bc2e8d4" - integrity sha1-naGee+6NEt/wUT7Vt2lXeTvC6NQ= - -pascalcase@^0.1.1: - version "0.1.1" - resolved "https://registry.npm.taobao.org/pascalcase/download/pascalcase-0.1.1.tgz#b363e55e8006ca6fe21784d2db22bd15d7917f14" - integrity sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ= - -path-exists@^4.0.0: - version "4.0.0" - resolved "https://registry.npm.taobao.org/path-exists/download/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" - integrity sha1-UTvb4tO5XXdi6METfvoZXGxhtbM= - -path-is-absolute@^1.0.0: - version "1.0.1" - resolved "https://registry.npm.taobao.org/path-is-absolute/download/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" - integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= - -path-key@^2.0.0, path-key@^2.0.1: - version "2.0.1" - resolved "https://registry.npm.taobao.org/path-key/download/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" - integrity sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A= - -path-key@^3.0.0, path-key@^3.1.0: - version "3.1.1" - resolved "https://registry.npm.taobao.org/path-key/download/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" - integrity sha1-WB9q3mWMu6ZaDTOA3ndTKVBU83U= - -path-parse@^1.0.6: - version "1.0.6" - resolved "https://registry.npm.taobao.org/path-parse/download/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c" - integrity sha1-1i27VnlAXXLEc37FhgDp3c8G0kw= - -path-to-regexp@0.1.7: - version "0.1.7" - resolved "https://registry.npm.taobao.org/path-to-regexp/download/path-to-regexp-0.1.7.tgz?cache=0&sync_timestamp=1574278262588&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fpath-to-regexp%2Fdownload%2Fpath-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c" - integrity sha1-32BBeABfUi8V60SQ5yR6G/qmf4w= - -performance-now@^2.1.0: - version "2.1.0" - resolved "https://registry.npm.taobao.org/performance-now/download/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" - integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns= - -picomatch@^2.0.4, picomatch@^2.0.5: - version "2.2.2" - resolved "https://registry.npm.taobao.org/picomatch/download/picomatch-2.2.2.tgz#21f333e9b6b8eaff02468f5146ea406d345f4dad" - integrity sha1-IfMz6ba46v8CRo9RRupAbTRfTa0= - -pirates@^4.0.1: - version "4.0.1" - resolved "https://registry.npm.taobao.org/pirates/download/pirates-4.0.1.tgz#643a92caf894566f91b2b986d2c66950a8e2fb87" - integrity sha1-ZDqSyviUVm+RsrmG0sZpUKji+4c= - dependencies: - node-modules-regexp "^1.0.0" - -pkg-dir@^4.2.0: - version "4.2.0" - resolved "https://registry.npm.taobao.org/pkg-dir/download/pkg-dir-4.2.0.tgz#f099133df7ede422e81d1d8448270eeb3e4261f3" - integrity sha1-8JkTPfft5CLoHR2ESCcO6z5CYfM= - dependencies: - find-up "^4.0.0" - -pn@^1.1.0: - version "1.1.0" - resolved "https://registry.npm.taobao.org/pn/download/pn-1.1.0.tgz#e2f4cef0e219f463c179ab37463e4e1ecdccbafb" - integrity sha1-4vTO8OIZ9GPBeas3Rj5OHs3Muvs= - -posix-character-classes@^0.1.0: - version "0.1.1" - resolved "https://registry.npm.taobao.org/posix-character-classes/download/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab" - integrity sha1-AerA/jta9xoqbAL+q7jB/vfgDqs= - -prelude-ls@~1.1.2: - version "1.1.2" - resolved "https://registry.npm.taobao.org/prelude-ls/download/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" - integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ= - -pretty-format@^24.7.0: - version "24.9.0" - resolved "https://registry.npm.taobao.org/pretty-format/download/pretty-format-24.9.0.tgz#12fac31b37019a4eea3c11aa9a959eb7628aa7c9" - integrity sha1-EvrDGzcBmk7qPBGqmpWet2KKp8k= - dependencies: - "@jest/types" "^24.9.0" - ansi-regex "^4.0.0" - ansi-styles "^3.2.0" - react-is "^16.8.4" - -pretty-format@^25.5.0: - version "25.5.0" - resolved "https://registry.npm.taobao.org/pretty-format/download/pretty-format-25.5.0.tgz#7873c1d774f682c34b8d48b6743a2bf2ac55791a" - integrity sha1-eHPB13T2gsNLjUi2dDor8qxVeRo= - dependencies: - "@jest/types" "^25.5.0" - ansi-regex "^5.0.0" - ansi-styles "^4.0.0" - react-is "^16.12.0" - -prompts@^2.0.1: - version "2.3.2" - resolved "https://registry.npm.taobao.org/prompts/download/prompts-2.3.2.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fprompts%2Fdownload%2Fprompts-2.3.2.tgz#480572d89ecf39566d2bd3fe2c9fccb7c4c0b068" - integrity sha1-SAVy2J7POVZtK9P+LJ/Mt8TAsGg= - dependencies: - kleur "^3.0.3" - sisteransi "^1.0.4" - -proxy-addr@~2.0.5: - version "2.0.6" - resolved "https://registry.npm.taobao.org/proxy-addr/download/proxy-addr-2.0.6.tgz#fdc2336505447d3f2f2c638ed272caf614bbb2bf" - integrity sha1-/cIzZQVEfT8vLGOO0nLK9hS7sr8= - dependencies: - forwarded "~0.1.2" - ipaddr.js "1.9.1" - -psl@^1.1.28: - version "1.8.0" - resolved "https://registry.npm.taobao.org/psl/download/psl-1.8.0.tgz#9326f8bcfb013adcc005fdff056acce020e51c24" - integrity sha1-kyb4vPsBOtzABf3/BWrM4CDlHCQ= - -pump@^3.0.0: - version "3.0.0" - resolved "https://registry.npm.taobao.org/pump/download/pump-3.0.0.tgz#b4a2116815bde2f4e1ea602354e8c75565107a64" - integrity sha1-tKIRaBW94vTh6mAjVOjHVWUQemQ= - dependencies: - end-of-stream "^1.1.0" - once "^1.3.1" - -punycode@^2.1.0, punycode@^2.1.1: - version "2.1.1" - resolved "https://registry.npm.taobao.org/punycode/download/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" - integrity sha1-tYsBCsQMIsVldhbI0sLALHv0eew= - -qs@6.7.0: - version "6.7.0" - resolved "https://registry.npm.taobao.org/qs/download/qs-6.7.0.tgz#41dc1a015e3d581f1621776be31afb2876a9b1bc" - integrity sha1-QdwaAV49WB8WIXdr4xr7KHapsbw= - -qs@~6.5.2: - version "6.5.2" - resolved "https://registry.npm.taobao.org/qs/download/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" - integrity sha1-yzroBuh0BERYTvFUzo7pjUA/PjY= - -range-parser@~1.2.1: - version "1.2.1" - resolved "https://registry.npm.taobao.org/range-parser/download/range-parser-1.2.1.tgz#3cf37023d199e1c24d1a55b84800c2f3e6468031" - integrity sha1-PPNwI9GZ4cJNGlW4SADC8+ZGgDE= - -raw-body@2.4.0: - version "2.4.0" - resolved "https://registry.npm.taobao.org/raw-body/download/raw-body-2.4.0.tgz#a1ce6fb9c9bc356ca52e89256ab59059e13d0332" - integrity sha1-oc5vucm8NWylLoklarWQWeE9AzI= - dependencies: - bytes "3.1.0" - http-errors "1.7.2" - iconv-lite "0.4.24" - unpipe "1.0.0" - -react-is@^16.12.0, react-is@^16.8.4: - version "16.13.1" - resolved "https://registry.npm.taobao.org/react-is/download/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4" - integrity sha1-eJcppNw23imZ3BVt1sHZwYzqVqQ= - -read-pkg-up@^7.0.1: - version "7.0.1" - resolved "https://registry.npm.taobao.org/read-pkg-up/download/read-pkg-up-7.0.1.tgz?cache=0&sync_timestamp=1575620499078&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fread-pkg-up%2Fdownload%2Fread-pkg-up-7.0.1.tgz#f3a6135758459733ae2b95638056e1854e7ef507" - integrity sha1-86YTV1hFlzOuK5VjgFbhhU5+9Qc= - dependencies: - find-up "^4.1.0" - read-pkg "^5.2.0" - type-fest "^0.8.1" - -read-pkg@^5.2.0: - version "5.2.0" - resolved "https://registry.npm.taobao.org/read-pkg/download/read-pkg-5.2.0.tgz#7bf295438ca5a33e56cd30e053b34ee7250c93cc" - integrity sha1-e/KVQ4yloz5WzTDgU7NO5yUMk8w= - dependencies: - "@types/normalize-package-data" "^2.4.0" - normalize-package-data "^2.5.0" - parse-json "^5.0.0" - type-fest "^0.6.0" - -realpath-native@^2.0.0: - version "2.0.0" - resolved "https://registry.npm.taobao.org/realpath-native/download/realpath-native-2.0.0.tgz?cache=0&sync_timestamp=1588859352745&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Frealpath-native%2Fdownload%2Frealpath-native-2.0.0.tgz#7377ac429b6e1fd599dc38d08ed942d0d7beb866" - integrity sha1-c3esQptuH9WZ3DjQjtlC0Ne+uGY= - -regex-not@^1.0.0, regex-not@^1.0.2: - version "1.0.2" - resolved "https://registry.npm.taobao.org/regex-not/download/regex-not-1.0.2.tgz#1f4ece27e00b0b65e0247a6810e6a85d83a5752c" - integrity sha1-H07OJ+ALC2XgJHpoEOaoXYOldSw= - dependencies: - extend-shallow "^3.0.2" - safe-regex "^1.1.0" - -remove-trailing-separator@^1.0.1: - version "1.1.0" - resolved "https://registry.npm.taobao.org/remove-trailing-separator/download/remove-trailing-separator-1.1.0.tgz#c24bce2a283adad5bc3f58e0d48249b92379d8ef" - integrity sha1-wkvOKig62tW8P1jg1IJJuSN52O8= - -repeat-element@^1.1.2: - version "1.1.3" - resolved "https://registry.npm.taobao.org/repeat-element/download/repeat-element-1.1.3.tgz#782e0d825c0c5a3bb39731f84efee6b742e6b1ce" - integrity sha1-eC4NglwMWjuzlzH4Tv7mt0Lmsc4= - -repeat-string@^1.6.1: - version "1.6.1" - resolved "https://registry.npm.taobao.org/repeat-string/download/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" - integrity sha1-jcrkcOHIirwtYA//Sndihtp15jc= - -request-promise-core@1.1.3: - version "1.1.3" - resolved "https://registry.npm.taobao.org/request-promise-core/download/request-promise-core-1.1.3.tgz#e9a3c081b51380dfea677336061fea879a829ee9" - integrity sha1-6aPAgbUTgN/qZ3M2Bh/qh5qCnuk= - dependencies: - lodash "^4.17.15" - -request-promise-native@^1.0.7: - version "1.0.8" - resolved "https://registry.npm.taobao.org/request-promise-native/download/request-promise-native-1.0.8.tgz?cache=0&sync_timestamp=1572829683581&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Frequest-promise-native%2Fdownload%2Frequest-promise-native-1.0.8.tgz#a455b960b826e44e2bf8999af64dff2bfe58cb36" - integrity sha1-pFW5YLgm5E4r+Jma9k3/K/5YyzY= - dependencies: - request-promise-core "1.1.3" - stealthy-require "^1.1.1" - tough-cookie "^2.3.3" - -request@^2.88.0: - version "2.88.2" - resolved "https://registry.npm.taobao.org/request/download/request-2.88.2.tgz#d73c918731cb5a87da047e207234146f664d12b3" - integrity sha1-1zyRhzHLWofaBH4gcjQUb2ZNErM= - dependencies: - aws-sign2 "~0.7.0" - aws4 "^1.8.0" - caseless "~0.12.0" - combined-stream "~1.0.6" - extend "~3.0.2" - forever-agent "~0.6.1" - form-data "~2.3.2" - har-validator "~5.1.3" - http-signature "~1.2.0" - is-typedarray "~1.0.0" - isstream "~0.1.2" - json-stringify-safe "~5.0.1" - mime-types "~2.1.19" - oauth-sign "~0.9.0" - performance-now "^2.1.0" - qs "~6.5.2" - safe-buffer "^5.1.2" - tough-cookie "~2.5.0" - tunnel-agent "^0.6.0" - uuid "^3.3.2" - -require-directory@^2.1.1: - version "2.1.1" - resolved "https://registry.npm.taobao.org/require-directory/download/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" - integrity sha1-jGStX9MNqxyXbiNE/+f3kqam30I= - -require-main-filename@^2.0.0: - version "2.0.0" - resolved "https://registry.npm.taobao.org/require-main-filename/download/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b" - integrity sha1-0LMp7MfMD2Fkn2IhW+aa9UqomJs= - -resolve-cwd@^3.0.0: - version "3.0.0" - resolved "https://registry.npm.taobao.org/resolve-cwd/download/resolve-cwd-3.0.0.tgz#0f0075f1bb2544766cf73ba6a6e2adfebcb13f2d" - integrity sha1-DwB18bslRHZs9zumpuKt/ryxPy0= - dependencies: - resolve-from "^5.0.0" - -resolve-from@^5.0.0: - version "5.0.0" - resolved "https://registry.npm.taobao.org/resolve-from/download/resolve-from-5.0.0.tgz#c35225843df8f776df21c57557bc087e9dfdfc69" - integrity sha1-w1IlhD3493bfIcV1V7wIfp39/Gk= - -resolve-url@^0.2.1: - version "0.2.1" - resolved "https://registry.npm.taobao.org/resolve-url/download/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" - integrity sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo= - -resolve@1.1.7: - version "1.1.7" - resolved "https://registry.npm.taobao.org/resolve/download/resolve-1.1.7.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fresolve%2Fdownload%2Fresolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" - integrity sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs= - -resolve@^1.10.0, resolve@^1.17.0, resolve@^1.3.2: - version "1.17.0" - resolved "https://registry.npm.taobao.org/resolve/download/resolve-1.17.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fresolve%2Fdownload%2Fresolve-1.17.0.tgz#b25941b54968231cc2d1bb76a79cb7f2c0bf8444" - integrity sha1-sllBtUloIxzC0bt2p5y38sC/hEQ= - dependencies: - path-parse "^1.0.6" - -ret@~0.1.10: - version "0.1.15" - resolved "https://registry.npm.taobao.org/ret/download/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc" - integrity sha1-uKSCXVvbH8P29Twrwz+BOIaBx7w= - -retry@0.12.0: - version "0.12.0" - resolved "https://registry.npm.taobao.org/retry/download/retry-0.12.0.tgz#1b42a6266a21f07421d1b0b54b7dc167b01c013b" - integrity sha1-G0KmJmoh8HQh0bC1S33BZ7AcATs= - -rimraf@^3.0.0: - version "3.0.2" - resolved "https://registry.npm.taobao.org/rimraf/download/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" - integrity sha1-8aVAK6YiCtUswSgrrBrjqkn9Bho= - dependencies: - glob "^7.1.3" - -rsvp@^4.8.4: - version "4.8.5" - resolved "https://registry.npm.taobao.org/rsvp/download/rsvp-4.8.5.tgz#c8f155311d167f68f21e168df71ec5b083113734" - integrity sha1-yPFVMR0Wf2jyHhaN9x7FsIMRNzQ= - -safe-buffer@5.1.2, safe-buffer@~5.1.1: - version "5.1.2" - resolved "https://registry.npm.taobao.org/safe-buffer/download/safe-buffer-5.1.2.tgz?cache=0&sync_timestamp=1589129010497&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsafe-buffer%2Fdownload%2Fsafe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" - integrity sha1-mR7GnSluAxN0fVm9/St0XDX4go0= - -safe-buffer@^5.0.1, safe-buffer@^5.1.2: - version "5.2.1" - resolved "https://registry.npm.taobao.org/safe-buffer/download/safe-buffer-5.2.1.tgz?cache=0&sync_timestamp=1589129010497&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsafe-buffer%2Fdownload%2Fsafe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" - integrity sha1-Hq+fqb2x/dTsdfWPnNtOa3gn7sY= - -safe-regex@^1.1.0: - version "1.1.0" - resolved "https://registry.npm.taobao.org/safe-regex/download/safe-regex-1.1.0.tgz?cache=0&sync_timestamp=1571687713993&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsafe-regex%2Fdownload%2Fsafe-regex-1.1.0.tgz#40a3669f3b077d1e943d44629e157dd48023bf2e" - integrity sha1-QKNmnzsHfR6UPURinhV91IAjvy4= - dependencies: - ret "~0.1.10" - -"safer-buffer@>= 2.1.2 < 3", safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0: - version "2.1.2" - resolved "https://registry.npm.taobao.org/safer-buffer/download/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" - integrity sha1-RPoWGwGHuVSd2Eu5GAL5vYOFzWo= - -sane@^4.0.3: - version "4.1.0" - resolved "https://registry.npm.taobao.org/sane/download/sane-4.1.0.tgz#ed881fd922733a6c461bc189dc2b6c006f3ffded" - integrity sha1-7Ygf2SJzOmxGG8GJ3CtsAG8//e0= - dependencies: - "@cnakazawa/watch" "^1.0.3" - anymatch "^2.0.0" - capture-exit "^2.0.0" - exec-sh "^0.3.2" - execa "^1.0.0" - fb-watchman "^2.0.0" - micromatch "^3.1.4" - minimist "^1.1.1" - walker "~1.0.5" - -saxes@^3.1.9: - version "3.1.11" - resolved "https://registry.npm.taobao.org/saxes/download/saxes-3.1.11.tgz#d59d1fd332ec92ad98a2e0b2ee644702384b1c5b" - integrity sha1-1Z0f0zLskq2YouCy7mRHAjhLHFs= - dependencies: - xmlchars "^2.1.1" - -"semver@2 || 3 || 4 || 5", semver@^5.4.1, semver@^5.5.0: - version "5.7.1" - resolved "https://registry.npm.taobao.org/semver/download/semver-5.7.1.tgz?cache=0&sync_timestamp=1586886301819&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsemver%2Fdownload%2Fsemver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" - integrity sha1-qVT5Ma66UI0we78Gnv8MAclhFvc= - -semver@^6.0.0, semver@^6.3.0: - version "6.3.0" - resolved "https://registry.npm.taobao.org/semver/download/semver-6.3.0.tgz?cache=0&sync_timestamp=1586886301819&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsemver%2Fdownload%2Fsemver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" - integrity sha1-7gpkyK9ejO6mdoexM3YeG+y9HT0= - -send@0.17.1: - version "0.17.1" - resolved "https://registry.npm.taobao.org/send/download/send-0.17.1.tgz#c1d8b059f7900f7466dd4938bdc44e11ddb376c8" - integrity sha1-wdiwWfeQD3Rm3Uk4vcROEd2zdsg= - dependencies: - debug "2.6.9" - depd "~1.1.2" - destroy "~1.0.4" - encodeurl "~1.0.2" - escape-html "~1.0.3" - etag "~1.8.1" - fresh "0.5.2" - http-errors "~1.7.2" - mime "1.6.0" - ms "2.1.1" - on-finished "~2.3.0" - range-parser "~1.2.1" - statuses "~1.5.0" - -serve-static@1.14.1: - version "1.14.1" - resolved "https://registry.npm.taobao.org/serve-static/download/serve-static-1.14.1.tgz#666e636dc4f010f7ef29970a88a674320898b2f9" - integrity sha1-Zm5jbcTwEPfvKZcKiKZ0MgiYsvk= - dependencies: - encodeurl "~1.0.2" - escape-html "~1.0.3" - parseurl "~1.3.3" - send "0.17.1" - -set-blocking@^2.0.0: - version "2.0.0" - resolved "https://registry.npm.taobao.org/set-blocking/download/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" - integrity sha1-BF+XgtARrppoA93TgrJDkrPYkPc= - -set-value@^2.0.0, set-value@^2.0.1: - version "2.0.1" - resolved "https://registry.npm.taobao.org/set-value/download/set-value-2.0.1.tgz?cache=0&sync_timestamp=1585775409029&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fset-value%2Fdownload%2Fset-value-2.0.1.tgz#a18d40530e6f07de4228c7defe4227af8cad005b" - integrity sha1-oY1AUw5vB95CKMfe/kInr4ytAFs= - dependencies: - extend-shallow "^2.0.1" - is-extendable "^0.1.1" - is-plain-object "^2.0.3" - split-string "^3.0.1" - -setprototypeof@1.1.1: - version "1.1.1" - resolved "https://registry.npm.taobao.org/setprototypeof/download/setprototypeof-1.1.1.tgz#7e95acb24aa92f5885e0abef5ba131330d4ae683" - integrity sha1-fpWsskqpL1iF4KvvW6ExMw1K5oM= - -sha.js@^2.4.11: - version "2.4.11" - resolved "https://registry.npm.taobao.org/sha.js/download/sha.js-2.4.11.tgz#37a5cf0b81ecbc6943de109ba2960d1b26584ae7" - integrity sha1-N6XPC4HsvGlD3hCbopYNGyZYSuc= - dependencies: - inherits "^2.0.1" - safe-buffer "^5.0.1" - -shebang-command@^1.2.0: - version "1.2.0" - resolved "https://registry.npm.taobao.org/shebang-command/download/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" - integrity sha1-RKrGW2lbAzmJaMOfNj/uXer98eo= - dependencies: - shebang-regex "^1.0.0" - -shebang-command@^2.0.0: - version "2.0.0" - resolved "https://registry.npm.taobao.org/shebang-command/download/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" - integrity sha1-zNCvT4g1+9wmW4JGGq8MNmY/NOo= - dependencies: - shebang-regex "^3.0.0" - -shebang-regex@^1.0.0: - version "1.0.0" - resolved "https://registry.npm.taobao.org/shebang-regex/download/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" - integrity sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM= - -shebang-regex@^3.0.0: - version "3.0.0" - resolved "https://registry.npm.taobao.org/shebang-regex/download/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" - integrity sha1-rhbxZE2HPsrYQ7AwexQzYtTEIXI= - -shellwords@^0.1.1: - version "0.1.1" - resolved "https://registry.npm.taobao.org/shellwords/download/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b" - integrity sha1-1rkYHBpI05cyTISHHvvPxz/AZUs= - -signal-exit@^3.0.0, signal-exit@^3.0.2: - version "3.0.3" - resolved "https://registry.npm.taobao.org/signal-exit/download/signal-exit-3.0.3.tgz?cache=0&sync_timestamp=1585253373618&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsignal-exit%2Fdownload%2Fsignal-exit-3.0.3.tgz#a1410c2edd8f077b08b4e253c8eacfcaf057461c" - integrity sha1-oUEMLt2PB3sItOJTyOrPyvBXRhw= - -sisteransi@^1.0.4: - version "1.0.5" - resolved "https://registry.npm.taobao.org/sisteransi/download/sisteransi-1.0.5.tgz#134d681297756437cc05ca01370d3a7a571075ed" - integrity sha1-E01oEpd1ZDfMBcoBNw06elcQde0= - -slash@^3.0.0: - version "3.0.0" - resolved "https://registry.npm.taobao.org/slash/download/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" - integrity sha1-ZTm+hwwWWtvVJAIg2+Nh8bxNRjQ= - -snapdragon-node@^2.0.1: - version "2.1.1" - resolved "https://registry.npm.taobao.org/snapdragon-node/download/snapdragon-node-2.1.1.tgz#6c175f86ff14bdb0724563e8f3c1b021a286853b" - integrity sha1-bBdfhv8UvbByRWPo88GwIaKGhTs= - dependencies: - define-property "^1.0.0" - isobject "^3.0.0" - snapdragon-util "^3.0.1" - -snapdragon-util@^3.0.1: - version "3.0.1" - resolved "https://registry.npm.taobao.org/snapdragon-util/download/snapdragon-util-3.0.1.tgz#f956479486f2acd79700693f6f7b805e45ab56e2" - integrity sha1-+VZHlIbyrNeXAGk/b3uAXkWrVuI= - dependencies: - kind-of "^3.2.0" - -snapdragon@^0.8.1: - version "0.8.2" - resolved "https://registry.npm.taobao.org/snapdragon/download/snapdragon-0.8.2.tgz#64922e7c565b0e14204ba1aa7d6964278d25182d" - integrity sha1-ZJIufFZbDhQgS6GqfWlkJ40lGC0= - dependencies: - base "^0.11.1" - debug "^2.2.0" - define-property "^0.2.5" - extend-shallow "^2.0.1" - map-cache "^0.2.2" - source-map "^0.5.6" - source-map-resolve "^0.5.0" - use "^3.1.0" - -source-map-resolve@^0.5.0: - version "0.5.3" - resolved "https://registry.npm.taobao.org/source-map-resolve/download/source-map-resolve-0.5.3.tgz?cache=0&sync_timestamp=1584831908370&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsource-map-resolve%2Fdownload%2Fsource-map-resolve-0.5.3.tgz#190866bece7553e1f8f267a2ee82c606b5509a1a" - integrity sha1-GQhmvs51U+H48mei7oLGBrVQmho= - dependencies: - atob "^2.1.2" - decode-uri-component "^0.2.0" - resolve-url "^0.2.1" - source-map-url "^0.4.0" - urix "^0.1.0" - -source-map-support@^0.5.6: - version "0.5.19" - resolved "https://registry.npm.taobao.org/source-map-support/download/source-map-support-0.5.19.tgz?cache=0&sync_timestamp=1587719493563&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsource-map-support%2Fdownload%2Fsource-map-support-0.5.19.tgz#a98b62f86dcaf4f67399648c085291ab9e8fed61" - integrity sha1-qYti+G3K9PZzmWSMCFKRq56P7WE= - dependencies: - buffer-from "^1.0.0" - source-map "^0.6.0" - -source-map-url@^0.4.0: - version "0.4.0" - resolved "https://registry.npm.taobao.org/source-map-url/download/source-map-url-0.4.0.tgz#3e935d7ddd73631b97659956d55128e87b5084a3" - integrity sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM= - -source-map@^0.5.0, source-map@^0.5.6: - version "0.5.7" - resolved "https://registry.npm.taobao.org/source-map/download/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" - integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w= - -source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.1: - version "0.6.1" - resolved "https://registry.npm.taobao.org/source-map/download/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" - integrity sha1-dHIq8y6WFOnCh6jQu95IteLxomM= - -source-map@^0.7.3: - version "0.7.3" - resolved "https://registry.npm.taobao.org/source-map/download/source-map-0.7.3.tgz#5302f8169031735226544092e64981f751750383" - integrity sha1-UwL4FpAxc1ImVECS5kmB91F1A4M= - -spdx-correct@^3.0.0: - version "3.1.1" - resolved "https://registry.npm.taobao.org/spdx-correct/download/spdx-correct-3.1.1.tgz#dece81ac9c1e6713e5f7d1b6f17d468fa53d89a9" - integrity sha1-3s6BrJweZxPl99G28X1Gj6U9iak= - dependencies: - spdx-expression-parse "^3.0.0" - spdx-license-ids "^3.0.0" - -spdx-exceptions@^2.1.0: - version "2.3.0" - resolved "https://registry.npm.taobao.org/spdx-exceptions/download/spdx-exceptions-2.3.0.tgz#3f28ce1a77a00372683eade4a433183527a2163d" - integrity sha1-PyjOGnegA3JoPq3kpDMYNSeiFj0= - -spdx-expression-parse@^3.0.0: - version "3.0.1" - resolved "https://registry.npm.taobao.org/spdx-expression-parse/download/spdx-expression-parse-3.0.1.tgz?cache=0&sync_timestamp=1589386503783&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fspdx-expression-parse%2Fdownload%2Fspdx-expression-parse-3.0.1.tgz#cf70f50482eefdc98e3ce0a6833e4a53ceeba679" - integrity sha1-z3D1BILu/cmOPOCmgz5KU87rpnk= - dependencies: - spdx-exceptions "^2.1.0" - spdx-license-ids "^3.0.0" - -spdx-license-ids@^3.0.0: - version "3.0.5" - resolved "https://registry.npm.taobao.org/spdx-license-ids/download/spdx-license-ids-3.0.5.tgz#3694b5804567a458d3c8045842a6358632f62654" - integrity sha1-NpS1gEVnpFjTyARYQqY1hjL2JlQ= - -split-string@^3.0.1, split-string@^3.0.2: - version "3.1.0" - resolved "https://registry.npm.taobao.org/split-string/download/split-string-3.1.0.tgz#7cb09dda3a86585705c64b39a6466038682e8fe2" - integrity sha1-fLCd2jqGWFcFxks5pkZgOGguj+I= - dependencies: - extend-shallow "^3.0.0" - -sprintf-js@~1.0.2: - version "1.0.3" - resolved "https://registry.npm.taobao.org/sprintf-js/download/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" - integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= - -sshpk@^1.7.0: - version "1.16.1" - resolved "https://registry.npm.taobao.org/sshpk/download/sshpk-1.16.1.tgz#fb661c0bef29b39db40769ee39fa70093d6f6877" - integrity sha1-+2YcC+8ps520B2nuOfpwCT1vaHc= - dependencies: - asn1 "~0.2.3" - assert-plus "^1.0.0" - bcrypt-pbkdf "^1.0.0" - dashdash "^1.12.0" - ecc-jsbn "~0.1.1" - getpass "^0.1.1" - jsbn "~0.1.0" - safer-buffer "^2.0.2" - tweetnacl "~0.14.0" - -stack-utils@^1.0.1: - version "1.0.2" - resolved "https://registry.npm.taobao.org/stack-utils/download/stack-utils-1.0.2.tgz#33eba3897788558bebfc2db059dc158ec36cebb8" - integrity sha1-M+ujiXeIVYvr/C2wWdwVjsNs67g= - -static-extend@^0.1.1: - version "0.1.2" - resolved "https://registry.npm.taobao.org/static-extend/download/static-extend-0.1.2.tgz#60809c39cbff55337226fd5e0b520f341f1fb5c6" - integrity sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY= - dependencies: - define-property "^0.2.5" - object-copy "^0.1.0" - -"statuses@>= 1.5.0 < 2", statuses@~1.5.0: - version "1.5.0" - resolved "https://registry.npm.taobao.org/statuses/download/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c" - integrity sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow= - -stealthy-require@^1.1.1: - version "1.1.1" - resolved "https://registry.npm.taobao.org/stealthy-require/download/stealthy-require-1.1.1.tgz#35b09875b4ff49f26a777e509b3090a3226bf24b" - integrity sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks= - -streamsearch@0.1.2: - version "0.1.2" - resolved "https://registry.npm.taobao.org/streamsearch/download/streamsearch-0.1.2.tgz#808b9d0e56fc273d809ba57338e929919a1a9f1a" - integrity sha1-gIudDlb8Jz2Am6VzOOkpkZoanxo= - -string-length@^3.1.0: - version "3.1.0" - resolved "https://registry.npm.taobao.org/string-length/download/string-length-3.1.0.tgz?cache=0&sync_timestamp=1584636016697&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fstring-length%2Fdownload%2Fstring-length-3.1.0.tgz#107ef8c23456e187a8abd4a61162ff4ac6e25837" - integrity sha1-EH74wjRW4Yeoq9SmEWL/SsbiWDc= - dependencies: - astral-regex "^1.0.0" - strip-ansi "^5.2.0" - -string-width@^4.1.0, string-width@^4.2.0: - version "4.2.0" - resolved "https://registry.npm.taobao.org/string-width/download/string-width-4.2.0.tgz#952182c46cc7b2c313d1596e623992bd163b72b5" - integrity sha1-lSGCxGzHssMT0VluYjmSvRY7crU= - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.0" - -string.prototype.trimend@^1.0.0: - version "1.0.1" - resolved "https://registry.npm.taobao.org/string.prototype.trimend/download/string.prototype.trimend-1.0.1.tgz#85812a6b847ac002270f5808146064c995fb6913" - integrity sha1-hYEqa4R6wAInD1gIFGBkyZX7aRM= - dependencies: - define-properties "^1.1.3" - es-abstract "^1.17.5" - -string.prototype.trimleft@^2.1.1: - version "2.1.2" - resolved "https://registry.npm.taobao.org/string.prototype.trimleft/download/string.prototype.trimleft-2.1.2.tgz?cache=0&sync_timestamp=1585557033464&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fstring.prototype.trimleft%2Fdownload%2Fstring.prototype.trimleft-2.1.2.tgz#4408aa2e5d6ddd0c9a80739b087fbc067c03b3cc" - integrity sha1-RAiqLl1t3QyagHObCH+8BnwDs8w= - dependencies: - define-properties "^1.1.3" - es-abstract "^1.17.5" - string.prototype.trimstart "^1.0.0" - -string.prototype.trimright@^2.1.1: - version "2.1.2" - resolved "https://registry.npm.taobao.org/string.prototype.trimright/download/string.prototype.trimright-2.1.2.tgz?cache=0&sync_timestamp=1585557209944&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fstring.prototype.trimright%2Fdownload%2Fstring.prototype.trimright-2.1.2.tgz#c76f1cef30f21bbad8afeb8db1511496cfb0f2a3" - integrity sha1-x28c7zDyG7rYr+uNsVEUls+w8qM= - dependencies: - define-properties "^1.1.3" - es-abstract "^1.17.5" - string.prototype.trimend "^1.0.0" - -string.prototype.trimstart@^1.0.0: - version "1.0.1" - resolved "https://registry.npm.taobao.org/string.prototype.trimstart/download/string.prototype.trimstart-1.0.1.tgz#14af6d9f34b053f7cfc89b72f8f2ee14b9039a54" - integrity sha1-FK9tnzSwU/fPyJty+PLuFLkDmlQ= - dependencies: - define-properties "^1.1.3" - es-abstract "^1.17.5" - -strip-ansi@^5.2.0: - version "5.2.0" - resolved "https://registry.npm.taobao.org/strip-ansi/download/strip-ansi-5.2.0.tgz#8c9a536feb6afc962bdfa5b104a5091c1ad9c0ae" - integrity sha1-jJpTb+tq/JYr36WxBKUJHBrZwK4= - dependencies: - ansi-regex "^4.1.0" - -strip-ansi@^6.0.0: - version "6.0.0" - resolved "https://registry.npm.taobao.org/strip-ansi/download/strip-ansi-6.0.0.tgz#0b1571dd7669ccd4f3e06e14ef1eed26225ae532" - integrity sha1-CxVx3XZpzNTz4G4U7x7tJiJa5TI= - dependencies: - ansi-regex "^5.0.0" - -strip-bom@^4.0.0: - version "4.0.0" - resolved "https://registry.npm.taobao.org/strip-bom/download/strip-bom-4.0.0.tgz#9c3505c1db45bcedca3d9cf7a16f5c5aa3901878" - integrity sha1-nDUFwdtFvO3KPZz3oW9cWqOQGHg= - -strip-eof@^1.0.0: - version "1.0.0" - resolved "https://registry.npm.taobao.org/strip-eof/download/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" - integrity sha1-u0P/VZim6wXYm1n80SnJgzE2Br8= - -strip-final-newline@^2.0.0: - version "2.0.0" - resolved "https://registry.npm.taobao.org/strip-final-newline/download/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad" - integrity sha1-ibhS+y/L6Tb29LMYevsKEsGrWK0= - -subscriptions-transport-ws@^0.9.11, subscriptions-transport-ws@^0.9.16: - version "0.9.16" - resolved "https://registry.npm.taobao.org/subscriptions-transport-ws/download/subscriptions-transport-ws-0.9.16.tgz#90a422f0771d9c32069294c08608af2d47f596ec" - integrity sha1-kKQi8HcdnDIGkpTAhgivLUf1luw= - dependencies: - backo2 "^1.0.2" - eventemitter3 "^3.1.0" - iterall "^1.2.1" - symbol-observable "^1.0.4" - ws "^5.2.0" - -supports-color@^5.3.0: - version "5.5.0" - resolved "https://registry.npm.taobao.org/supports-color/download/supports-color-5.5.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsupports-color%2Fdownload%2Fsupports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" - integrity sha1-4uaaRKyHcveKHsCzW2id9lMO/I8= - dependencies: - has-flag "^3.0.0" - -supports-color@^7.0.0, supports-color@^7.1.0: - version "7.1.0" - resolved "https://registry.npm.taobao.org/supports-color/download/supports-color-7.1.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsupports-color%2Fdownload%2Fsupports-color-7.1.0.tgz#68e32591df73e25ad1c4b49108a2ec507962bfd1" - integrity sha1-aOMlkd9z4lrRxLSRCKLsUHliv9E= - dependencies: - has-flag "^4.0.0" - -supports-hyperlinks@^2.0.0: - version "2.1.0" - resolved "https://registry.npm.taobao.org/supports-hyperlinks/download/supports-hyperlinks-2.1.0.tgz#f663df252af5f37c5d49bbd7eeefa9e0b9e59e47" - integrity sha1-9mPfJSr183xdSbvX7u+p4Lnlnkc= - dependencies: - has-flag "^4.0.0" - supports-color "^7.0.0" - -symbol-observable@^1.0.2, symbol-observable@^1.0.4: - version "1.2.0" - resolved "https://registry.npm.taobao.org/symbol-observable/download/symbol-observable-1.2.0.tgz#c22688aed4eab3cdc2dfeacbb561660560a00804" - integrity sha1-wiaIrtTqs83C3+rLtWFmBWCgCAQ= - -symbol-tree@^3.2.2: - version "3.2.4" - resolved "https://registry.npm.taobao.org/symbol-tree/download/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2" - integrity sha1-QwY30ki6d+B4iDlR+5qg7tfGP6I= - -terminal-link@^2.0.0: - version "2.1.1" - resolved "https://registry.npm.taobao.org/terminal-link/download/terminal-link-2.1.1.tgz#14a64a27ab3c0df933ea546fba55f2d078edc994" - integrity sha1-FKZKJ6s8Dfkz6lRvulXy0HjtyZQ= - dependencies: - ansi-escapes "^4.2.1" - supports-hyperlinks "^2.0.0" - -test-exclude@^6.0.0: - version "6.0.0" - resolved "https://registry.npm.taobao.org/test-exclude/download/test-exclude-6.0.0.tgz?cache=0&sync_timestamp=1576874719359&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ftest-exclude%2Fdownload%2Ftest-exclude-6.0.0.tgz#04a8698661d805ea6fa293b6cb9e63ac044ef15e" - integrity sha1-BKhphmHYBepvopO2y55jrARO8V4= - dependencies: - "@istanbuljs/schema" "^0.1.2" - glob "^7.1.4" - minimatch "^3.0.4" - -throat@^5.0.0: - version "5.0.0" - resolved "https://registry.npm.taobao.org/throat/download/throat-5.0.0.tgz#c5199235803aad18754a667d659b5e72ce16764b" - integrity sha1-xRmSNYA6rRh1SmZ9ZZtecs4Wdks= - -tmpl@1.0.x: - version "1.0.4" - resolved "https://registry.npm.taobao.org/tmpl/download/tmpl-1.0.4.tgz#23640dd7b42d00433911140820e5cf440e521dd1" - integrity sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE= - -to-fast-properties@^2.0.0: - version "2.0.0" - resolved "https://registry.npm.taobao.org/to-fast-properties/download/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" - integrity sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4= - -to-object-path@^0.3.0: - version "0.3.0" - resolved "https://registry.npm.taobao.org/to-object-path/download/to-object-path-0.3.0.tgz#297588b7b0e7e0ac08e04e672f85c1f4999e17af" - integrity sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68= - dependencies: - kind-of "^3.0.2" - -to-regex-range@^2.1.0: - version "2.1.1" - resolved "https://registry.npm.taobao.org/to-regex-range/download/to-regex-range-2.1.1.tgz#7c80c17b9dfebe599e27367e0d4dd5590141db38" - integrity sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg= - dependencies: - is-number "^3.0.0" - repeat-string "^1.6.1" - -to-regex-range@^5.0.1: - version "5.0.1" - resolved "https://registry.npm.taobao.org/to-regex-range/download/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" - integrity sha1-FkjESq58jZiKMmAY7XL1tN0DkuQ= - dependencies: - is-number "^7.0.0" - -to-regex@^3.0.1, to-regex@^3.0.2: - version "3.0.2" - resolved "https://registry.npm.taobao.org/to-regex/download/to-regex-3.0.2.tgz#13cfdd9b336552f30b51f33a8ae1b42a7a7599ce" - integrity sha1-E8/dmzNlUvMLUfM6iuG0Knp1mc4= - dependencies: - define-property "^2.0.2" - extend-shallow "^3.0.2" - regex-not "^1.0.2" - safe-regex "^1.1.0" - -toidentifier@1.0.0: - version "1.0.0" - resolved "https://registry.npm.taobao.org/toidentifier/download/toidentifier-1.0.0.tgz#7e1be3470f1e77948bc43d94a3c8f4d7752ba553" - integrity sha1-fhvjRw8ed5SLxD2Uo8j013UrpVM= - -tough-cookie@^2.3.3, tough-cookie@~2.5.0: - version "2.5.0" - resolved "https://registry.npm.taobao.org/tough-cookie/download/tough-cookie-2.5.0.tgz#cd9fb2a0aa1d5a12b473bd9fb96fa3dcff65ade2" - integrity sha1-zZ+yoKodWhK0c72fuW+j3P9lreI= - dependencies: - psl "^1.1.28" - punycode "^2.1.1" - -tough-cookie@^3.0.1: - version "3.0.1" - resolved "https://registry.npm.taobao.org/tough-cookie/download/tough-cookie-3.0.1.tgz#9df4f57e739c26930a018184887f4adb7dca73b2" - integrity sha1-nfT1fnOcJpMKAYGEiH9K233Kc7I= - dependencies: - ip-regex "^2.1.0" - psl "^1.1.28" - punycode "^2.1.1" - -tr46@^1.0.1: - version "1.0.1" - resolved "https://registry.npm.taobao.org/tr46/download/tr46-1.0.1.tgz#a8b13fd6bfd2489519674ccde55ba3693b706d09" - integrity sha1-qLE/1r/SSJUZZ0zN5VujaTtwbQk= - dependencies: - punycode "^2.1.0" - -ts-invariant@^0.4.0: - version "0.4.4" - resolved "https://registry.npm.taobao.org/ts-invariant/download/ts-invariant-0.4.4.tgz#97a523518688f93aafad01b0e80eb803eb2abd86" - integrity sha1-l6UjUYaI+TqvrQGw6A64A+sqvYY= - dependencies: - tslib "^1.9.3" - -tslib@^1.10.0, tslib@^1.9.3: - version "1.13.0" - resolved "https://registry.npm.taobao.org/tslib/download/tslib-1.13.0.tgz#c881e13cc7015894ed914862d276436fa9a47043" - integrity sha1-yIHhPMcBWJTtkUhi0nZDb6mkcEM= - -tunnel-agent@^0.6.0: - version "0.6.0" - resolved "https://registry.npm.taobao.org/tunnel-agent/download/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" - integrity sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0= - dependencies: - safe-buffer "^5.0.1" - -tweetnacl@^0.14.3, tweetnacl@~0.14.0: - version "0.14.5" - resolved "https://registry.npm.taobao.org/tweetnacl/download/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" - integrity sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q= - -type-check@~0.3.2: - version "0.3.2" - resolved "https://registry.npm.taobao.org/type-check/download/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72" - integrity sha1-WITKtRLPHTVeP7eE8wgEsrUg23I= - dependencies: - prelude-ls "~1.1.2" - -type-detect@4.0.8: - version "4.0.8" - resolved "https://registry.npm.taobao.org/type-detect/download/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c" - integrity sha1-dkb7XxiHHPu3dJ5pvTmmOI63RQw= - -type-fest@^0.11.0: - version "0.11.0" - resolved "https://registry.npm.taobao.org/type-fest/download/type-fest-0.11.0.tgz#97abf0872310fed88a5c466b25681576145e33f1" - integrity sha1-l6vwhyMQ/tiKXEZrJWgVdhReM/E= - -type-fest@^0.6.0: - version "0.6.0" - resolved "https://registry.npm.taobao.org/type-fest/download/type-fest-0.6.0.tgz#8d2a2370d3df886eb5c90ada1c5bf6188acf838b" - integrity sha1-jSojcNPfiG61yQraHFv2GIrPg4s= - -type-fest@^0.8.1: - version "0.8.1" - resolved "https://registry.npm.taobao.org/type-fest/download/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d" - integrity sha1-CeJJ696FHTseSNJ8EFREZn8XuD0= - -type-is@^1.6.16, type-is@~1.6.17, type-is@~1.6.18: - version "1.6.18" - resolved "https://registry.npm.taobao.org/type-is/download/type-is-1.6.18.tgz#4e552cd05df09467dcbc4ef739de89f2cf37c131" - integrity sha1-TlUs0F3wlGfcvE73Od6J8s83wTE= - dependencies: - media-typer "0.3.0" - mime-types "~2.1.24" - -typedarray-to-buffer@^3.1.5: - version "3.1.5" - resolved "https://registry.npm.taobao.org/typedarray-to-buffer/download/typedarray-to-buffer-3.1.5.tgz#a97ee7a9ff42691b9f783ff1bc5112fe3fca9080" - integrity sha1-qX7nqf9CaRufeD/xvFES/j/KkIA= - dependencies: - is-typedarray "^1.0.0" - -union-value@^1.0.0: - version "1.0.1" - resolved "https://registry.npm.taobao.org/union-value/download/union-value-1.0.1.tgz#0b6fe7b835aecda61c6ea4d4f02c14221e109847" - integrity sha1-C2/nuDWuzaYcbqTU8CwUIh4QmEc= - dependencies: - arr-union "^3.1.0" - get-value "^2.0.6" - is-extendable "^0.1.1" - set-value "^2.0.1" - -unpipe@1.0.0, unpipe@~1.0.0: - version "1.0.0" - resolved "https://registry.npm.taobao.org/unpipe/download/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec" - integrity sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw= - -unset-value@^1.0.0: - version "1.0.0" - resolved "https://registry.npm.taobao.org/unset-value/download/unset-value-1.0.0.tgz#8376873f7d2335179ffb1e6fc3a8ed0dfc8ab559" - integrity sha1-g3aHP30jNRef+x5vw6jtDfyKtVk= - dependencies: - has-value "^0.3.1" - isobject "^3.0.0" - -uri-js@^4.2.2: - version "4.2.2" - resolved "https://registry.npm.taobao.org/uri-js/download/uri-js-4.2.2.tgz#94c540e1ff772956e2299507c010aea6c8838eb0" - integrity sha1-lMVA4f93KVbiKZUHwBCupsiDjrA= - dependencies: - punycode "^2.1.0" - -urix@^0.1.0: - version "0.1.0" - resolved "https://registry.npm.taobao.org/urix/download/urix-0.1.0.tgz#da937f7a62e21fec1fd18d49b35c2935067a6c72" - integrity sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI= - -use@^3.1.0: - version "3.1.1" - resolved "https://registry.npm.taobao.org/use/download/use-3.1.1.tgz#d50c8cac79a19fbc20f2911f56eb973f4e10070f" - integrity sha1-1QyMrHmhn7wg8pEfVuuXP04QBw8= - -util.promisify@^1.0.0: - version "1.0.1" - resolved "https://registry.npm.taobao.org/util.promisify/download/util.promisify-1.0.1.tgz#6baf7774b80eeb0f7520d8b81d07982a59abbaee" - integrity sha1-a693dLgO6w91INi4HQeYKlmruu4= - dependencies: - define-properties "^1.1.3" - es-abstract "^1.17.2" - has-symbols "^1.0.1" - object.getownpropertydescriptors "^2.1.0" - -utils-merge@1.0.1: - version "1.0.1" - resolved "https://registry.npm.taobao.org/utils-merge/download/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713" - integrity sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM= - -uuid@^3.1.0, uuid@^3.3.2: - version "3.4.0" - resolved "https://registry.npm.taobao.org/uuid/download/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" - integrity sha1-sj5DWK+oogL+ehAK8fX4g/AgB+4= - -uuid@^8.0.0: - version "8.1.0" - resolved "https://registry.npm.taobao.org/uuid/download/uuid-8.1.0.tgz#6f1536eb43249f473abc6bd58ff983da1ca30d8d" - integrity sha1-bxU260Mkn0c6vGvVj/mD2hyjDY0= - -v8-to-istanbul@^4.1.3: - version "4.1.4" - resolved "https://registry.npm.taobao.org/v8-to-istanbul/download/v8-to-istanbul-4.1.4.tgz#b97936f21c0e2d9996d4985e5c5156e9d4e49cd6" - integrity sha1-uXk28hwOLZmW1JheXFFW6dTknNY= - dependencies: - "@types/istanbul-lib-coverage" "^2.0.1" - convert-source-map "^1.6.0" - source-map "^0.7.3" - -validate-npm-package-license@^3.0.1: - version "3.0.4" - resolved "https://registry.npm.taobao.org/validate-npm-package-license/download/validate-npm-package-license-3.0.4.tgz#fc91f6b9c7ba15c857f4cb2c5defeec39d4f410a" - integrity sha1-/JH2uce6FchX9MssXe/uw51PQQo= - dependencies: - spdx-correct "^3.0.0" - spdx-expression-parse "^3.0.0" - -vary@^1, vary@~1.1.2: - version "1.1.2" - resolved "https://registry.npm.taobao.org/vary/download/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" - integrity sha1-IpnwLG3tMNSllhsLn3RSShj2NPw= - -verror@1.10.0: - version "1.10.0" - resolved "https://registry.npm.taobao.org/verror/download/verror-1.10.0.tgz#3a105ca17053af55d6e270c1f8288682e18da400" - integrity sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA= - dependencies: - assert-plus "^1.0.0" - core-util-is "1.0.2" - extsprintf "^1.2.0" - -w3c-hr-time@^1.0.1: - version "1.0.2" - resolved "https://registry.npm.taobao.org/w3c-hr-time/download/w3c-hr-time-1.0.2.tgz?cache=0&sync_timestamp=1583455806135&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fw3c-hr-time%2Fdownload%2Fw3c-hr-time-1.0.2.tgz#0a89cdf5cc15822df9c360543676963e0cc308cd" - integrity sha1-ConN9cwVgi35w2BUNnaWPgzDCM0= - dependencies: - browser-process-hrtime "^1.0.0" - -w3c-xmlserializer@^1.1.2: - version "1.1.2" - resolved "https://registry.npm.taobao.org/w3c-xmlserializer/download/w3c-xmlserializer-1.1.2.tgz#30485ca7d70a6fd052420a3d12fd90e6339ce794" - integrity sha1-MEhcp9cKb9BSQgo9Ev2Q5jOc55Q= - dependencies: - domexception "^1.0.1" - webidl-conversions "^4.0.2" - xml-name-validator "^3.0.0" - -walker@^1.0.7, walker@~1.0.5: - version "1.0.7" - resolved "https://registry.npm.taobao.org/walker/download/walker-1.0.7.tgz#2f7f9b8fd10d677262b18a884e28d19618e028fb" - integrity sha1-L3+bj9ENZ3JisYqITijRlhjgKPs= - dependencies: - makeerror "1.0.x" - -webidl-conversions@^4.0.2: - version "4.0.2" - resolved "https://registry.npm.taobao.org/webidl-conversions/download/webidl-conversions-4.0.2.tgz#a855980b1f0b6b359ba1d5d9fb39ae941faa63ad" - integrity sha1-qFWYCx8LazWbodXZ+zmulB+qY60= - -whatwg-encoding@^1.0.1, whatwg-encoding@^1.0.5: - version "1.0.5" - resolved "https://registry.npm.taobao.org/whatwg-encoding/download/whatwg-encoding-1.0.5.tgz#5abacf777c32166a51d085d6b4f3e7d27113ddb0" - integrity sha1-WrrPd3wyFmpR0IXWtPPn0nET3bA= - dependencies: - iconv-lite "0.4.24" - -whatwg-mimetype@^2.2.0, whatwg-mimetype@^2.3.0: - version "2.3.0" - resolved "https://registry.npm.taobao.org/whatwg-mimetype/download/whatwg-mimetype-2.3.0.tgz#3d4b1e0312d2079879f826aff18dbeeca5960fbf" - integrity sha1-PUseAxLSB5h5+Cav8Y2+7KWWD78= - -whatwg-url@^7.0.0: - version "7.1.0" - resolved "https://registry.npm.taobao.org/whatwg-url/download/whatwg-url-7.1.0.tgz#c2c492f1eca612988efd3d2266be1b9fc6170d06" - integrity sha1-wsSS8eymEpiO/T0iZr4bn8YXDQY= - dependencies: - lodash.sortby "^4.7.0" - tr46 "^1.0.1" - webidl-conversions "^4.0.2" - -which-module@^2.0.0: - version "2.0.0" - resolved "https://registry.npm.taobao.org/which-module/download/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" - integrity sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho= - -which@^1.2.9, which@^1.3.1: - version "1.3.1" - resolved "https://registry.npm.taobao.org/which/download/which-1.3.1.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fwhich%2Fdownload%2Fwhich-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" - integrity sha1-pFBD1U9YBTFtqNYvn1CRjT2nCwo= - dependencies: - isexe "^2.0.0" - -which@^2.0.1, which@^2.0.2: - version "2.0.2" - resolved "https://registry.npm.taobao.org/which/download/which-2.0.2.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fwhich%2Fdownload%2Fwhich-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" - integrity sha1-fGqN0KY2oDJ+ELWckobu6T8/UbE= - dependencies: - isexe "^2.0.0" - -word-wrap@~1.2.3: - version "1.2.3" - resolved "https://registry.npm.taobao.org/word-wrap/download/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c" - integrity sha1-YQY29rH3A4kb00dxzLF/uTtHB5w= - -wrap-ansi@^6.2.0: - version "6.2.0" - resolved "https://registry.npm.taobao.org/wrap-ansi/download/wrap-ansi-6.2.0.tgz#e9393ba07102e6c91a3b221478f0257cd2856e53" - integrity sha1-6Tk7oHEC5skaOyIUePAlfNKFblM= - dependencies: - ansi-styles "^4.0.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" - -wrappy@1: - version "1.0.2" - resolved "https://registry.npm.taobao.org/wrappy/download/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" - integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= - -write-file-atomic@^3.0.0: - version "3.0.3" - resolved "https://registry.npm.taobao.org/write-file-atomic/download/write-file-atomic-3.0.3.tgz#56bd5c5a5c70481cd19c571bd39ab965a5de56e8" - integrity sha1-Vr1cWlxwSBzRnFcb05q5ZaXeVug= - dependencies: - imurmurhash "^0.1.4" - is-typedarray "^1.0.0" - signal-exit "^3.0.2" - typedarray-to-buffer "^3.1.5" - -ws@^5.2.0: - version "5.2.2" - resolved "https://registry.npm.taobao.org/ws/download/ws-5.2.2.tgz#dffef14866b8e8dc9133582514d1befaf96e980f" - integrity sha1-3/7xSGa46NyRM1glFNG++vlumA8= - dependencies: - async-limiter "~1.0.0" - -ws@^6.0.0: - version "6.2.1" - resolved "https://registry.npm.taobao.org/ws/download/ws-6.2.1.tgz#442fdf0a47ed64f59b6a5d8ff130f4748ed524fb" - integrity sha1-RC/fCkftZPWbal2P8TD0dI7VJPs= - dependencies: - async-limiter "~1.0.0" - -ws@^7.0.0: - version "7.3.0" - resolved "https://registry.npm.taobao.org/ws/download/ws-7.3.0.tgz#4b2f7f219b3d3737bc1a2fbf145d825b94d38ffd" - integrity sha1-Sy9/IZs9Nze8Gi+/FF2CW5TTj/0= - -xml-name-validator@^3.0.0: - version "3.0.0" - resolved "https://registry.npm.taobao.org/xml-name-validator/download/xml-name-validator-3.0.0.tgz#6ae73e06de4d8c6e47f9fb181f78d648ad457c6a" - integrity sha1-auc+Bt5NjG5H+fsYH3jWSK1FfGo= - -xmlchars@^2.1.1: - version "2.2.0" - resolved "https://registry.npm.taobao.org/xmlchars/download/xmlchars-2.2.0.tgz#060fe1bcb7f9c76fe2a17db86a9bc3ab894210cb" - integrity sha1-Bg/hvLf5x2/ioX24apvDq4lCEMs= - -y18n@^4.0.0: - version "4.0.0" - resolved "https://registry.npm.taobao.org/y18n/download/y18n-4.0.0.tgz#95ef94f85ecc81d007c264e190a120f0a3c8566b" - integrity sha1-le+U+F7MgdAHwmThkKEg8KPIVms= - -yallist@^3.0.2: - version "3.1.1" - resolved "https://registry.npm.taobao.org/yallist/download/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd" - integrity sha1-27fa+b/YusmrRev2ArjLrQ1dCP0= - -yargs-parser@^18.1.1: - version "18.1.3" - resolved "https://registry.npm.taobao.org/yargs-parser/download/yargs-parser-18.1.3.tgz?cache=0&sync_timestamp=1590107599564&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fyargs-parser%2Fdownload%2Fyargs-parser-18.1.3.tgz#be68c4975c6b2abf469236b0c870362fab09a7b0" - integrity sha1-vmjEl1xrKr9GkjawyHA2L6sJp7A= - dependencies: - camelcase "^5.0.0" - decamelize "^1.2.0" - -yargs@^15.3.1: - version "15.3.1" - resolved "https://registry.npm.taobao.org/yargs/download/yargs-15.3.1.tgz#9505b472763963e54afe60148ad27a330818e98b" - integrity sha1-lQW0cnY5Y+VK/mAUitJ6MwgY6Ys= - dependencies: - cliui "^6.0.0" - decamelize "^1.2.0" - find-up "^4.1.0" - get-caller-file "^2.0.1" - require-directory "^2.1.1" - require-main-filename "^2.0.0" - set-blocking "^2.0.0" - string-width "^4.2.0" - which-module "^2.0.0" - y18n "^4.0.0" - yargs-parser "^18.1.1" - -zen-observable-ts@^0.8.21: - version "0.8.21" - resolved "https://registry.npm.taobao.org/zen-observable-ts/download/zen-observable-ts-0.8.21.tgz#85d0031fbbde1eba3cd07d3ba90da241215f421d" - integrity sha1-hdADH7veHro80H07qQ2iQSFfQh0= - dependencies: - tslib "^1.9.3" - zen-observable "^0.8.0" - -zen-observable@^0.8.0: - version "0.8.15" - resolved "https://registry.npm.taobao.org/zen-observable/download/zen-observable-0.8.15.tgz#96415c512d8e3ffd920afd3889604e30b9eaac15" - integrity sha1-lkFcUS2OP/2SCv04iWBOMLnqrBU= diff --git a/federation/gateway/start.sh b/federation/start.sh similarity index 57% rename from federation/gateway/start.sh rename to federation/start.sh index 7451a2f..35c3a04 100755 --- a/federation/gateway/start.sh +++ b/federation/start.sh @@ -1,6 +1,10 @@ #!/bin/bash +set -eumo pipefail + function cleanup { + kill "$PRODUCTS_ROVER_PID" + kill "$REVIEWS_ROVER_PID" kill "$ACCOUNTS_PID" kill "$PRODUCTS_PID" kill "$REVIEWS_PID" @@ -22,4 +26,11 @@ REVIEWS_PID=$! sleep 3 -node index.js +rover dev --url http://localhost:4001 --name accounts & +sleep 1 +rover dev --url http://localhost:4002 --name products & +PRODUCTS_ROVER_PID=$! +sleep 1 +rover dev --url http://localhost:4003 --name reviews & +REVIEWS_ROVER_PID=$! +fg %4 \ No newline at end of file From 7d0be7f2379c2ff492ce5cb0ca712a05d92596d9 Mon Sep 17 00:00:00 2001 From: Dylan Anthony Date: Thu, 22 Sep 2022 17:57:33 -0600 Subject: [PATCH 039/102] docs: Fill in Apollo Studio link --- federation/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/federation/README.md b/federation/README.md index 4098873..332fdd6 100644 --- a/federation/README.md +++ b/federation/README.md @@ -4,7 +4,7 @@ An example of using [Apollo Federation](https://www.apollographql.com/docs/feder ## The schema -You can view the full schema in [Apollo Studio]() without needing to run the example (you will need to run the example in order to query it). +You can view the full schema in [Apollo Studio](https://studio.apollographql.com/public/async-graphql-Examples/home?variant=current) without needing to run the example (you will need to run the example in order to query it). ## How to run From f54b6729f61d8b16c1ad9fdad8f9b25a927e1031 Mon Sep 17 00:00:00 2001 From: Jeffrey Rooks Date: Fri, 23 Sep 2022 14:05:24 -0400 Subject: [PATCH 040/102] (poem) remove token from header in ws --- poem/token-from-header/src/main.rs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/poem/token-from-header/src/main.rs b/poem/token-from-header/src/main.rs index 8d8cab0..8f40f24 100644 --- a/poem/token-from-header/src/main.rs +++ b/poem/token-from-header/src/main.rs @@ -48,17 +48,11 @@ async fn ws( protocol: GraphQLProtocol, websocket: WebSocket, ) -> impl IntoResponse { - let mut data = async_graphql::Data::default(); - if let Some(token) = get_token_from_headers(headers) { - data.insert(token); - } - let schema = schema.0.clone(); websocket .protocols(ALL_WEBSOCKET_PROTOCOLS) .on_upgrade(move |stream| { GraphQLWebSocket::new(stream, schema, protocol) - .with_data(data) .on_connection_init(on_connection_init) .serve() }) From cdc09c4746ab09f03952aeea453a660676bba6fa Mon Sep 17 00:00:00 2001 From: Jeffrey Rooks Date: Fri, 23 Sep 2022 14:12:00 -0400 Subject: [PATCH 041/102] add some notes --- models/token/src/lib.rs | 2 ++ poem/token-from-header/src/main.rs | 1 + 2 files changed, 3 insertions(+) diff --git a/models/token/src/lib.rs b/models/token/src/lib.rs index 8e10a28..2adc0ea 100644 --- a/models/token/src/lib.rs +++ b/models/token/src/lib.rs @@ -33,6 +33,8 @@ pub async fn on_connection_init(value: serde_json::Value) -> Result { token: String, } + // Coerce the connection params into our `Payload` struct so we can + // validate the token exists in the headers. if let Ok(payload) = serde_json::from_value::(value) { let mut data = Data::default(); data.insert(Token(payload.token)); diff --git a/poem/token-from-header/src/main.rs b/poem/token-from-header/src/main.rs index 8f40f24..bfb341a 100644 --- a/poem/token-from-header/src/main.rs +++ b/poem/token-from-header/src/main.rs @@ -53,6 +53,7 @@ async fn ws( .protocols(ALL_WEBSOCKET_PROTOCOLS) .on_upgrade(move |stream| { GraphQLWebSocket::new(stream, schema, protocol) + // connection params are used to extract the token in this fn .on_connection_init(on_connection_init) .serve() }) From 69b5c0bd5ebd4b686add2af0058cbe89e25ad800 Mon Sep 17 00:00:00 2001 From: Jeffrey Rooks Date: Fri, 23 Sep 2022 14:13:20 -0400 Subject: [PATCH 042/102] add link to docs --- models/token/src/lib.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/models/token/src/lib.rs b/models/token/src/lib.rs index 2adc0ea..53611e9 100644 --- a/models/token/src/lib.rs +++ b/models/token/src/lib.rs @@ -27,6 +27,8 @@ impl SubscriptionRoot { } } +// For more details see: +// https://github.com/enisdenjo/graphql-ws/blob/master/PROTOCOL.md#connectioninit pub async fn on_connection_init(value: serde_json::Value) -> Result { #[derive(Deserialize)] struct Payload { From 5d299149f6880428830f3e10d387c145113c5af5 Mon Sep 17 00:00:00 2001 From: Sunli Date: Sat, 24 Sep 2022 17:09:03 +0800 Subject: [PATCH 043/102] Update examples --- actix-web/token-from-header/src/main.rs | 8 +------- axum/token-from-header/src/main.rs | 9 +-------- poem/token-from-header/src/main.rs | 1 - 3 files changed, 2 insertions(+), 16 deletions(-) diff --git a/actix-web/token-from-header/src/main.rs b/actix-web/token-from-header/src/main.rs index c3c1544..8bcb639 100644 --- a/actix-web/token-from-header/src/main.rs +++ b/actix-web/token-from-header/src/main.rs @@ -1,7 +1,7 @@ use actix_web::{ guard, http::header::HeaderMap, web, App, HttpRequest, HttpResponse, HttpServer, Result, }; -use async_graphql::{http::GraphiQLSource, Data, EmptyMutation, Schema}; +use async_graphql::{http::GraphiQLSource, EmptyMutation, Schema}; use async_graphql_actix_web::{GraphQLRequest, GraphQLResponse, GraphQLSubscription}; use token::{on_connection_init, QueryRoot, SubscriptionRoot, Token, TokenSchema}; @@ -39,13 +39,7 @@ async fn index_ws( req: HttpRequest, payload: web::Payload, ) -> Result { - let mut data = Data::default(); - if let Some(token) = get_token_from_headers(req.headers()) { - data.insert(token); - } - GraphQLSubscription::new(Schema::clone(&*schema)) - .with_data(data) .on_connection_init(on_connection_init) .start(&req, payload) } diff --git a/axum/token-from-header/src/main.rs b/axum/token-from-header/src/main.rs index a3fa327..cc7ed6e 100644 --- a/axum/token-from-header/src/main.rs +++ b/axum/token-from-header/src/main.rs @@ -1,6 +1,6 @@ use async_graphql::{ http::{playground_source, GraphQLPlaygroundConfig, ALL_WEBSOCKET_PROTOCOLS}, - Data, EmptyMutation, Schema, + EmptyMutation, Schema, }; use async_graphql_axum::{GraphQLProtocol, GraphQLRequest, GraphQLResponse, GraphQLWebSocket}; use axum::{ @@ -40,18 +40,11 @@ async fn graphql_ws_handler( Extension(schema): Extension, protocol: GraphQLProtocol, websocket: WebSocketUpgrade, - headers: HeaderMap, ) -> Response { - let mut data = Data::default(); - if let Some(token) = get_token_from_headers(&headers) { - data.insert(token); - } - websocket .protocols(ALL_WEBSOCKET_PROTOCOLS) .on_upgrade(move |stream| { GraphQLWebSocket::new(stream, schema.clone(), protocol) - .with_data(data) .on_connection_init(on_connection_init) .serve() }) diff --git a/poem/token-from-header/src/main.rs b/poem/token-from-header/src/main.rs index bfb341a..a1a262d 100644 --- a/poem/token-from-header/src/main.rs +++ b/poem/token-from-header/src/main.rs @@ -44,7 +44,6 @@ async fn index( #[handler] async fn ws( schema: Data<&TokenSchema>, - headers: &HeaderMap, protocol: GraphQLProtocol, websocket: WebSocket, ) -> impl IntoResponse { From e7f936e6b675b6b237c137eb8690ca49742f2b5b Mon Sep 17 00:00:00 2001 From: Sunli Date: Sun, 25 Sep 2022 13:57:09 +0800 Subject: [PATCH 044/102] Use Poem for Federation examples --- federation/federation-accounts/Cargo.toml | 4 ++-- federation/federation-accounts/src/main.rs | 22 ++++++---------------- federation/federation-products/Cargo.toml | 4 ++-- federation/federation-products/src/main.rs | 21 ++++++--------------- federation/federation-reviews/Cargo.toml | 4 ++-- federation/federation-reviews/src/main.rs | 21 ++++++--------------- 6 files changed, 24 insertions(+), 52 deletions(-) diff --git a/federation/federation-accounts/Cargo.toml b/federation/federation-accounts/Cargo.toml index 3cf5671..64f09ee 100644 --- a/federation/federation-accounts/Cargo.toml +++ b/federation/federation-accounts/Cargo.toml @@ -6,6 +6,6 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } -async-graphql-warp = { path = "../../../integrations/warp" } +async-graphql-poem = { path = "../../../integrations/poem" } tokio = { version = "1.0.2", features = ["macros", "rt-multi-thread"] } -warp = "0.3" +poem = { version = "1.3.43" } diff --git a/federation/federation-accounts/src/main.rs b/federation/federation-accounts/src/main.rs index d703a04..3f6f036 100644 --- a/federation/federation-accounts/src/main.rs +++ b/federation/federation-accounts/src/main.rs @@ -1,8 +1,6 @@ -use std::convert::Infallible; - use async_graphql::{EmptyMutation, EmptySubscription, Object, Schema, SimpleObject, ID}; -use async_graphql_warp::graphql; -use warp::{Filter, Reply}; +use async_graphql_poem::GraphQL; +use poem::{listener::TcpListener, Route, Server}; #[derive(SimpleObject)] struct User { @@ -65,17 +63,9 @@ impl Query { } #[tokio::main] -async fn main() { +async fn main() -> std::io::Result<()> { let schema = Schema::new(Query, EmptyMutation, EmptySubscription); - - warp::serve(graphql(schema).and_then( - |(schema, request): ( - Schema, - async_graphql::Request, - )| async move { - Ok::<_, Infallible>(warp::reply::json(&schema.execute(request).await).into_response()) - }, - )) - .run(([0, 0, 0, 0], 4001)) - .await; + Server::new(TcpListener::bind("0.0.0.0:4001")) + .run(Route::new().at("/", GraphQL::new(schema))) + .await } diff --git a/federation/federation-products/Cargo.toml b/federation/federation-products/Cargo.toml index bc321e0..279c2c2 100644 --- a/federation/federation-products/Cargo.toml +++ b/federation/federation-products/Cargo.toml @@ -6,6 +6,6 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } -async-graphql-warp = { path = "../../../integrations/warp" } +async-graphql-poem = { path = "../../../integrations/poem" } tokio = { version = "1.0.2", features = ["macros", "rt-multi-thread"] } -warp = "0.3" +poem = { version = "1.3.43" } diff --git a/federation/federation-products/src/main.rs b/federation/federation-products/src/main.rs index d034fd3..472cb84 100644 --- a/federation/federation-products/src/main.rs +++ b/federation/federation-products/src/main.rs @@ -1,8 +1,6 @@ -use std::convert::Infallible; - use async_graphql::{Context, EmptyMutation, EmptySubscription, Object, Schema, SimpleObject}; -use async_graphql_warp::graphql; -use warp::{Filter, Reply}; +use async_graphql_poem::GraphQL; +use poem::{listener::TcpListener, Route, Server}; #[derive(SimpleObject)] struct Product { @@ -32,7 +30,7 @@ impl Query { } #[tokio::main] -async fn main() { +async fn main() -> std::io::Result<()> { let hats = vec![ Product { upc: "top-1".to_string(), @@ -55,14 +53,7 @@ async fn main() { .data(hats) .finish(); - warp::serve(graphql(schema).and_then( - |(schema, request): ( - Schema, - async_graphql::Request, - )| async move { - Ok::<_, Infallible>(warp::reply::json(&schema.execute(request).await).into_response()) - }, - )) - .run(([0, 0, 0, 0], 4002)) - .await; + Server::new(TcpListener::bind("0.0.0.0:4002")) + .run(Route::new().at("/", GraphQL::new(schema))) + .await } diff --git a/federation/federation-reviews/Cargo.toml b/federation/federation-reviews/Cargo.toml index 201a9bc..6bfe00e 100644 --- a/federation/federation-reviews/Cargo.toml +++ b/federation/federation-reviews/Cargo.toml @@ -6,6 +6,6 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } -async-graphql-warp = { path = "../../../integrations/warp" } +async-graphql-poem = { path = "../../../integrations/poem" } tokio = { version = "1.0.2", features = ["macros", "rt-multi-thread"] } -warp = "0.3" \ No newline at end of file +poem = { version = "1.3.43" } diff --git a/federation/federation-reviews/src/main.rs b/federation/federation-reviews/src/main.rs index a462cf9..a580d16 100644 --- a/federation/federation-reviews/src/main.rs +++ b/federation/federation-reviews/src/main.rs @@ -1,11 +1,9 @@ -use std::convert::Infallible; - use async_graphql::{ ComplexObject, Context, EmptyMutation, EmptySubscription, Enum, Object, Schema, SimpleObject, ID, }; -use async_graphql_warp::graphql; -use warp::{Filter, Reply}; +use async_graphql_poem::GraphQL; +use poem::{listener::TcpListener, Route, Server}; #[derive(SimpleObject)] #[graphql(complex)] @@ -157,7 +155,7 @@ fn user_by_id(id: ID, joined_timestamp: Option) -> User { } #[tokio::main] -async fn main() { +async fn main() -> std::io::Result<()> { let reviews = vec![ Review { id: "review-1".into(), @@ -193,14 +191,7 @@ async fn main() { .data(reviews) .finish(); - warp::serve(graphql(schema).and_then( - |(schema, request): ( - Schema, - async_graphql::Request, - )| async move { - Ok::<_, Infallible>(warp::reply::json(&schema.execute(request).await).into_response()) - }, - )) - .run(([0, 0, 0, 0], 4003)) - .await; + Server::new(TcpListener::bind("0.0.0.0:4003")) + .run(Route::new().at("/", GraphQL::new(schema))) + .await } From bb0fa782053271096cf8c61eaf6e670b9d08ae15 Mon Sep 17 00:00:00 2001 From: Sunli Date: Sat, 1 Oct 2022 16:15:12 +0800 Subject: [PATCH 045/102] Bump opentelemetry from `0.17.0` to `0.18.0` --- poem/opentelemetry-basic/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/poem/opentelemetry-basic/Cargo.toml b/poem/opentelemetry-basic/Cargo.toml index 1e7b98d..b7ae51e 100644 --- a/poem/opentelemetry-basic/Cargo.toml +++ b/poem/opentelemetry-basic/Cargo.toml @@ -10,4 +10,4 @@ async-graphql = { path = "../../..", features = ["opentelemetry"] } async-graphql-poem = { path = "../../../integrations/poem" } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } poem = "1.3.42" -opentelemetry = { version = "0.17.0", features = ["rt-tokio"] } \ No newline at end of file +opentelemetry = { version = "0.18.0", features = ["rt-tokio"] } From 16139cc792fae045f1cf2da9fadd930992e2ffa4 Mon Sep 17 00:00:00 2001 From: Sunli Date: Tue, 8 Nov 2022 08:38:18 +0800 Subject: [PATCH 046/102] Add examples for dynamic-schema --- Cargo.toml | 1 + axum/starwars/src/main.rs | 2 +- axum/subscription/src/main.rs | 2 +- axum/token-from-header/src/main.rs | 2 +- axum/upload/src/main.rs | 2 +- federation/federation-accounts/src/main.rs | 2 +- federation/federation-products/src/main.rs | 2 +- federation/federation-reviews/src/main.rs | 2 +- poem/dynamic-schema/Cargo.toml | 10 +++++++ poem/dynamic-schema/src/main.rs | 32 ++++++++++++++++++++++ poem/opentelemetry-basic/src/main.rs | 4 +-- poem/starwars/Cargo.toml | 2 +- poem/starwars/src/main.rs | 2 +- poem/subscription-redis/Cargo.toml | 2 +- poem/subscription-redis/src/main.rs | 2 +- poem/subscription/Cargo.toml | 2 +- poem/subscription/src/main.rs | 2 +- poem/token-from-header/Cargo.toml | 2 +- poem/token-from-header/src/main.rs | 2 +- poem/upload/Cargo.toml | 2 +- poem/upload/src/main.rs | 2 +- rocket/starwars/src/main.rs | 4 +-- rocket/upload/src/main.rs | 6 ++-- warp/starwars/src/main.rs | 2 +- warp/subscription/src/main.rs | 2 +- warp/token-from-header/src/main.rs | 2 +- 26 files changed, 70 insertions(+), 27 deletions(-) create mode 100644 poem/dynamic-schema/Cargo.toml create mode 100644 poem/dynamic-schema/src/main.rs diff --git a/Cargo.toml b/Cargo.toml index dc0ed93..70ba245 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,6 +11,7 @@ members = [ "poem/subscription-redis", "poem/token-from-header", "poem/upload", + "poem/dynamic-schema", "actix-web/token-from-header", "actix-web/subscription", diff --git a/axum/starwars/src/main.rs b/axum/starwars/src/main.rs index 262ec91..8ee1607 100644 --- a/axum/starwars/src/main.rs +++ b/axum/starwars/src/main.rs @@ -35,7 +35,7 @@ async fn main() { println!("GraphiQL IDE: http://localhost:8000"); - Server::bind(&"0.0.0.0:8000".parse().unwrap()) + Server::bind(&"127.0.0.1:8000".parse().unwrap()) .serve(app.into_make_service()) .await .unwrap(); diff --git a/axum/subscription/src/main.rs b/axum/subscription/src/main.rs index 175dfda..011ae47 100644 --- a/axum/subscription/src/main.rs +++ b/axum/subscription/src/main.rs @@ -34,7 +34,7 @@ async fn main() { println!("GraphiQL IDE: http://localhost:8000"); - Server::bind(&"0.0.0.0:8000".parse().unwrap()) + Server::bind(&"127.0.0.1:8000".parse().unwrap()) .serve(app.into_make_service()) .await .unwrap(); diff --git a/axum/token-from-header/src/main.rs b/axum/token-from-header/src/main.rs index cc7ed6e..eb63eb9 100644 --- a/axum/token-from-header/src/main.rs +++ b/axum/token-from-header/src/main.rs @@ -61,7 +61,7 @@ async fn main() { println!("Playground: http://localhost:8000"); - Server::bind(&"0.0.0.0:8000".parse().unwrap()) + Server::bind(&"127.0.0.1:8000".parse().unwrap()) .serve(app.into_make_service()) .await .unwrap(); diff --git a/axum/upload/src/main.rs b/axum/upload/src/main.rs index 791a0e8..f758a1c 100644 --- a/axum/upload/src/main.rs +++ b/axum/upload/src/main.rs @@ -39,7 +39,7 @@ async fn main() { .allow_methods(vec![Method::GET, Method::POST]), ); - Server::bind(&"0.0.0.0:8000".parse().unwrap()) + Server::bind(&"127.0.0.1:8000".parse().unwrap()) .serve(app.into_make_service()) .await .unwrap(); diff --git a/federation/federation-accounts/src/main.rs b/federation/federation-accounts/src/main.rs index 3f6f036..c1eb085 100644 --- a/federation/federation-accounts/src/main.rs +++ b/federation/federation-accounts/src/main.rs @@ -65,7 +65,7 @@ impl Query { #[tokio::main] async fn main() -> std::io::Result<()> { let schema = Schema::new(Query, EmptyMutation, EmptySubscription); - Server::new(TcpListener::bind("0.0.0.0:4001")) + Server::new(TcpListener::bind("127.0.0.1:4001")) .run(Route::new().at("/", GraphQL::new(schema))) .await } diff --git a/federation/federation-products/src/main.rs b/federation/federation-products/src/main.rs index 472cb84..cf4cd36 100644 --- a/federation/federation-products/src/main.rs +++ b/federation/federation-products/src/main.rs @@ -53,7 +53,7 @@ async fn main() -> std::io::Result<()> { .data(hats) .finish(); - Server::new(TcpListener::bind("0.0.0.0:4002")) + Server::new(TcpListener::bind("127.0.0.1:4002")) .run(Route::new().at("/", GraphQL::new(schema))) .await } diff --git a/federation/federation-reviews/src/main.rs b/federation/federation-reviews/src/main.rs index a580d16..8f874a4 100644 --- a/federation/federation-reviews/src/main.rs +++ b/federation/federation-reviews/src/main.rs @@ -191,7 +191,7 @@ async fn main() -> std::io::Result<()> { .data(reviews) .finish(); - Server::new(TcpListener::bind("0.0.0.0:4003")) + Server::new(TcpListener::bind("127.0.0.1:4003")) .run(Route::new().at("/", GraphQL::new(schema))) .await } diff --git a/poem/dynamic-schema/Cargo.toml b/poem/dynamic-schema/Cargo.toml new file mode 100644 index 0000000..4060a9e --- /dev/null +++ b/poem/dynamic-schema/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "poem-dynamic-schema" +version = "0.1.0" +edition = "2021" + +[dependencies] +async-graphql = { path = "../../..", features = ["dynamic-schema"] } +async-graphql-poem = { path = "../../../integrations/poem" } +tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } +poem = "1.3.48" diff --git a/poem/dynamic-schema/src/main.rs b/poem/dynamic-schema/src/main.rs new file mode 100644 index 0000000..22d983c --- /dev/null +++ b/poem/dynamic-schema/src/main.rs @@ -0,0 +1,32 @@ +use std::error::Error; + +use async_graphql::{ + dynamic::*, + http::{playground_source, GraphQLPlaygroundConfig}, + Value, +}; +use async_graphql_poem::GraphQL; +use poem::{get, handler, listener::TcpListener, web::Html, IntoResponse, Route, Server}; + +#[handler] +async fn graphql_playground() -> impl IntoResponse { + Html(playground_source(GraphQLPlaygroundConfig::new("/"))) +} + +#[tokio::main] +async fn main() -> Result<(), Box> { + let query = Object::new("Query").field(Field::new("value", TypeRef::INT, |_| { + FieldFuture::new(async { Ok(Some(Value::from(100))) }) + })); + let schema = Schema::build(query.type_name(), None, None) + .register(query) + .finish()?; + + let app = Route::new().at("/", get(graphql_playground).post(GraphQL::new(schema))); + + println!("Playground: http://localhost:8000"); + Server::new(TcpListener::bind("127.0.0.1:8000")) + .run(app) + .await?; + Ok(()) +} diff --git a/poem/opentelemetry-basic/src/main.rs b/poem/opentelemetry-basic/src/main.rs index 625e12b..6647856 100644 --- a/poem/opentelemetry-basic/src/main.rs +++ b/poem/opentelemetry-basic/src/main.rs @@ -28,14 +28,14 @@ async fn main() { .data(schema); let example_curl = "\ - curl '0.0.0.0:8000' \ + curl '127.0.0.1:8000' \ -X POST \ -H 'content-type: application/json' \ --data '{ \"query\": \"{ hello }\" }'"; println!("Run this curl command from another terminal window to see opentelemetry output in this terminal.\n\n{example_curl}\n\n"); - Server::new(TcpListener::bind("0.0.0.0:8000")) + Server::new(TcpListener::bind("127.0.0.1:8000")) .run(app) .await .unwrap(); diff --git a/poem/starwars/Cargo.toml b/poem/starwars/Cargo.toml index c522fa2..06567d1 100644 --- a/poem/starwars/Cargo.toml +++ b/poem/starwars/Cargo.toml @@ -8,4 +8,4 @@ async-graphql = { path = "../../.." } async-graphql-poem = { path = "../../../integrations/poem" } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } starwars = { path = "../../models/starwars" } -poem = "1.2.25" +poem = "1.3.48" diff --git a/poem/starwars/src/main.rs b/poem/starwars/src/main.rs index 936e278..3519cdb 100644 --- a/poem/starwars/src/main.rs +++ b/poem/starwars/src/main.rs @@ -21,7 +21,7 @@ async fn main() { let app = Route::new().at("/", get(graphiql).post(GraphQL::new(schema))); println!("GraphiQL IDE: http://localhost:8000"); - Server::new(TcpListener::bind("0.0.0.0:8000")) + Server::new(TcpListener::bind("127.0.0.1:8000")) .run(app) .await .unwrap(); diff --git a/poem/subscription-redis/Cargo.toml b/poem/subscription-redis/Cargo.toml index 76ecdba..ee2913a 100644 --- a/poem/subscription-redis/Cargo.toml +++ b/poem/subscription-redis/Cargo.toml @@ -7,6 +7,6 @@ edition = "2021" async-graphql = { path = "../../.." } async-graphql-poem = { path = "../../../integrations/poem" } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } -poem = { version = "1.2.25", features = ["websocket"] } +poem = { version = "1.3.48", features = ["websocket"] } redis = { version = "0.21.4", features = ["aio", "tokio-comp"] } futures-util = "0.3.19" diff --git a/poem/subscription-redis/src/main.rs b/poem/subscription-redis/src/main.rs index fbdd130..a66fade 100644 --- a/poem/subscription-redis/src/main.rs +++ b/poem/subscription-redis/src/main.rs @@ -62,7 +62,7 @@ async fn main() { .at("/ws", get(GraphQLSubscription::new(schema))); println!("GraphiQL IDE: http://localhost:8000"); - Server::new(TcpListener::bind("0.0.0.0:8000")) + Server::new(TcpListener::bind("127.0.0.1:8000")) .run(app) .await .unwrap(); diff --git a/poem/subscription/Cargo.toml b/poem/subscription/Cargo.toml index fb3e0d7..b80dda2 100644 --- a/poem/subscription/Cargo.toml +++ b/poem/subscription/Cargo.toml @@ -8,4 +8,4 @@ async-graphql = { path = "../../.." } async-graphql-poem = { path = "../../../integrations/poem" } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } books = { path = "../../models/books" } -poem = { version = "1.2.25", features = ["websocket"] } +poem = { version = "1.3.48", features = ["websocket"] } diff --git a/poem/subscription/src/main.rs b/poem/subscription/src/main.rs index 91d00b9..05e00ed 100644 --- a/poem/subscription/src/main.rs +++ b/poem/subscription/src/main.rs @@ -24,7 +24,7 @@ async fn main() { .at("/ws", get(GraphQLSubscription::new(schema))); println!("GraphiQL IDE: http://localhost:8000"); - Server::new(TcpListener::bind("0.0.0.0:8000")) + Server::new(TcpListener::bind("127.0.0.1:8000")) .run(app) .await .unwrap(); diff --git a/poem/token-from-header/Cargo.toml b/poem/token-from-header/Cargo.toml index d439a79..bb9a52a 100644 --- a/poem/token-from-header/Cargo.toml +++ b/poem/token-from-header/Cargo.toml @@ -7,5 +7,5 @@ edition = "2021" async-graphql = { path = "../../.." } async-graphql-poem = { path = "../../../integrations/poem" } token = { path = "../../models/token" } -poem = { version = "1.2.25", features = ["websocket"] } +poem = { version = "1.3.48", features = ["websocket"] } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } diff --git a/poem/token-from-header/src/main.rs b/poem/token-from-header/src/main.rs index a1a262d..bb9d9ae 100644 --- a/poem/token-from-header/src/main.rs +++ b/poem/token-from-header/src/main.rs @@ -68,7 +68,7 @@ async fn main() { .data(schema); println!("GraphiQL IDE: http://localhost:8000"); - Server::new(TcpListener::bind("0.0.0.0:8000")) + Server::new(TcpListener::bind("127.0.0.1:8000")) .run(app) .await .unwrap(); diff --git a/poem/upload/Cargo.toml b/poem/upload/Cargo.toml index 912534b..c52f2c3 100644 --- a/poem/upload/Cargo.toml +++ b/poem/upload/Cargo.toml @@ -7,6 +7,6 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-poem = { path = "../../../integrations/poem" } -poem = { version = "1.2.25", features = ["websocket"] } +poem = { version = "1.3.48", features = ["websocket"] } files = { path = "../../models/files" } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } diff --git a/poem/upload/src/main.rs b/poem/upload/src/main.rs index c596df6..35c3c70 100644 --- a/poem/upload/src/main.rs +++ b/poem/upload/src/main.rs @@ -35,7 +35,7 @@ async fn main() -> std::io::Result<()> { .at("/", get(graphiql).post(index)) .with(Cors::new()) .data(schema); - Server::new(TcpListener::bind("0.0.0.0:8000")) + Server::new(TcpListener::bind("127.0.0.1:8000")) .run(app) .await } diff --git a/rocket/starwars/src/main.rs b/rocket/starwars/src/main.rs index e401363..07fed6b 100644 --- a/rocket/starwars/src/main.rs +++ b/rocket/starwars/src/main.rs @@ -12,7 +12,7 @@ fn graphiql() -> content::RawHtml { #[rocket::get("/graphql?")] async fn graphql_query(schema: &State, query: GraphQLQuery) -> GraphQLResponse { - query.execute(schema).await + query.execute(schema.inner()).await } #[rocket::post("/graphql", data = "", format = "application/json")] @@ -20,7 +20,7 @@ async fn graphql_request( schema: &State, request: GraphQLRequest, ) -> GraphQLResponse { - request.execute(schema).await + request.execute(schema.inner()).await } #[rocket::launch] diff --git a/rocket/upload/src/main.rs b/rocket/upload/src/main.rs index 5e4aab7..501cca5 100644 --- a/rocket/upload/src/main.rs +++ b/rocket/upload/src/main.rs @@ -12,12 +12,12 @@ fn graphiql() -> content::RawHtml { #[rocket::get("/graphql?")] async fn graphql_query(schema: &State, query: GraphQLQuery) -> GraphQLResponse { - query.execute(schema).await + query.execute(schema.inner()).await } #[rocket::post("/graphql", data = "", format = "application/json", rank = 1)] async fn graphql_request(schema: &State, request: GraphQLRequest) -> GraphQLResponse { - request.execute(schema).await + request.execute(schema.inner()).await } #[rocket::post( @@ -30,7 +30,7 @@ async fn graphql_request_multipart( schema: &State, request: GraphQLRequest, ) -> GraphQLResponse { - request.execute(schema).await + request.execute(schema.inner()).await } #[rocket::launch] diff --git a/warp/starwars/src/main.rs b/warp/starwars/src/main.rs index e2910e6..b8ff5b2 100644 --- a/warp/starwars/src/main.rs +++ b/warp/starwars/src/main.rs @@ -49,5 +49,5 @@ async fn main() { )) }); - warp::serve(routes).run(([0, 0, 0, 0], 8000)).await; + warp::serve(routes).run(([127, 0, 0, 1], 8000)).await; } diff --git a/warp/subscription/src/main.rs b/warp/subscription/src/main.rs index b74985f..54b6d79 100644 --- a/warp/subscription/src/main.rs +++ b/warp/subscription/src/main.rs @@ -34,5 +34,5 @@ async fn main() { }); let routes = graphql_subscription(schema).or(graphiql).or(graphql_post); - warp::serve(routes).run(([0, 0, 0, 0], 8000)).await; + warp::serve(routes).run(([127, 0, 0, 1], 8000)).await; } diff --git a/warp/token-from-header/src/main.rs b/warp/token-from-header/src/main.rs index c568833..2daf706 100644 --- a/warp/token-from-header/src/main.rs +++ b/warp/token-from-header/src/main.rs @@ -69,5 +69,5 @@ async fn main() { ); let routes = subscription.or(graphiql).or(graphql_post); - warp::serve(routes).run(([0, 0, 0, 0], 8000)).await; + warp::serve(routes).run(([127, 0, 0, 1], 8000)).await; } From 930cba4e685627e1b10c6ea5c0d20d82222a11da Mon Sep 17 00:00:00 2001 From: Sunli Date: Fri, 11 Nov 2022 23:44:38 +0800 Subject: [PATCH 047/102] add dynamic-starwars example --- Cargo.toml | 2 + models/dynamic-starwars/Cargo.toml | 8 + models/dynamic-starwars/src/lib.rs | 169 +++++++++++++++++ models/dynamic-starwars/src/model.rs | 267 +++++++++++++++++++++++++++ models/starwars/src/model.rs | 6 +- poem/dynamic-schema/src/main.rs | 7 +- poem/dynamic-starwars/Cargo.toml | 11 ++ poem/dynamic-starwars/src/main.rs | 26 +++ 8 files changed, 490 insertions(+), 6 deletions(-) create mode 100644 models/dynamic-starwars/Cargo.toml create mode 100644 models/dynamic-starwars/src/lib.rs create mode 100644 models/dynamic-starwars/src/model.rs create mode 100644 poem/dynamic-starwars/Cargo.toml create mode 100644 poem/dynamic-starwars/src/main.rs diff --git a/Cargo.toml b/Cargo.toml index 70ba245..0e055e7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,7 @@ [workspace] members = [ "models/starwars", + "models/dynamic-starwars", "models/books", "models/files", "models/token", @@ -12,6 +13,7 @@ members = [ "poem/token-from-header", "poem/upload", "poem/dynamic-schema", + "poem/dynamic-starwars", "actix-web/token-from-header", "actix-web/subscription", diff --git a/models/dynamic-starwars/Cargo.toml b/models/dynamic-starwars/Cargo.toml new file mode 100644 index 0000000..b6738bc --- /dev/null +++ b/models/dynamic-starwars/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "dynamic-starwars" +version = "0.1.0" +edition = "2021" + +[dependencies] +async-graphql = { path = "../../..", features = ["dynamic-schema"] } +slab = "0.4.2" diff --git a/models/dynamic-starwars/src/lib.rs b/models/dynamic-starwars/src/lib.rs new file mode 100644 index 0000000..43c0fc3 --- /dev/null +++ b/models/dynamic-starwars/src/lib.rs @@ -0,0 +1,169 @@ +mod model; + +use std::collections::HashMap; + +pub use model::schema; +use slab::Slab; + +/// One of the films in the Star Wars Trilogy +#[derive(Copy, Clone, Eq, PartialEq)] +pub enum Episode { + /// Released in 1977. + NewHope, + + /// Released in 1980. + Empire, + + /// Released in 1983. + Jedi, +} + +pub struct StarWarsChar { + id: &'static str, + name: &'static str, + is_human: bool, + friends: Vec, + appears_in: Vec, + home_planet: Option<&'static str>, + primary_function: Option<&'static str>, +} + +pub struct StarWars { + luke: usize, + artoo: usize, + chars: Slab, + chars_by_id: HashMap<&'static str, usize>, +} + +impl StarWars { + #[allow(clippy::new_without_default)] + pub fn new() -> Self { + let mut chars = Slab::new(); + + let luke = chars.insert(StarWarsChar { + id: "1000", + name: "Luke Skywalker", + is_human: true, + friends: vec![], + appears_in: vec![], + home_planet: Some("Tatooine"), + primary_function: None, + }); + + let vader = chars.insert(StarWarsChar { + id: "1001", + name: "Anakin Skywalker", + is_human: true, + friends: vec![], + appears_in: vec![], + home_planet: Some("Tatooine"), + primary_function: None, + }); + + let han = chars.insert(StarWarsChar { + id: "1002", + name: "Han Solo", + is_human: true, + friends: vec![], + appears_in: vec![Episode::Empire, Episode::NewHope, Episode::Jedi], + home_planet: None, + primary_function: None, + }); + + let leia = chars.insert(StarWarsChar { + id: "1003", + name: "Leia Organa", + is_human: true, + friends: vec![], + appears_in: vec![Episode::Empire, Episode::NewHope, Episode::Jedi], + home_planet: Some("Alderaa"), + primary_function: None, + }); + + let tarkin = chars.insert(StarWarsChar { + id: "1004", + name: "Wilhuff Tarkin", + is_human: true, + friends: vec![], + appears_in: vec![Episode::Empire, Episode::NewHope, Episode::Jedi], + home_planet: None, + primary_function: None, + }); + + let threepio = chars.insert(StarWarsChar { + id: "2000", + name: "C-3PO", + is_human: false, + friends: vec![], + appears_in: vec![Episode::Empire, Episode::NewHope, Episode::Jedi], + home_planet: None, + primary_function: Some("Protocol"), + }); + + let artoo = chars.insert(StarWarsChar { + id: "2001", + name: "R2-D2", + is_human: false, + friends: vec![], + appears_in: vec![Episode::Empire, Episode::NewHope, Episode::Jedi], + home_planet: None, + primary_function: Some("Astromech"), + }); + + chars[luke].friends = vec![han, leia, threepio, artoo]; + chars[vader].friends = vec![tarkin]; + chars[han].friends = vec![luke, leia, artoo]; + chars[leia].friends = vec![luke, han, threepio, artoo]; + chars[tarkin].friends = vec![vader]; + chars[threepio].friends = vec![luke, han, leia, artoo]; + chars[artoo].friends = vec![luke, han, leia]; + + let chars_by_id = chars.iter().map(|(idx, ch)| (ch.id, idx)).collect(); + Self { + luke, + artoo, + chars, + chars_by_id, + } + } + + pub fn human(&self, id: &str) -> Option<&StarWarsChar> { + self.chars_by_id + .get(id) + .copied() + .map(|idx| self.chars.get(idx).unwrap()) + .filter(|ch| ch.is_human) + } + + pub fn droid(&self, id: &str) -> Option<&StarWarsChar> { + self.chars_by_id + .get(id) + .copied() + .map(|idx| self.chars.get(idx).unwrap()) + .filter(|ch| !ch.is_human) + } + + pub fn humans(&self) -> Vec<&StarWarsChar> { + self.chars + .iter() + .filter(|(_, ch)| ch.is_human) + .map(|(_, ch)| ch) + .collect() + } + + pub fn droids(&self) -> Vec<&StarWarsChar> { + self.chars + .iter() + .filter(|(_, ch)| !ch.is_human) + .map(|(_, ch)| ch) + .collect() + } + + pub fn friends(&self, ch: &StarWarsChar) -> Vec<&StarWarsChar> { + ch.friends + .iter() + .copied() + .filter_map(|id| self.chars.get(id)) + .collect() + } +} diff --git a/models/dynamic-starwars/src/model.rs b/models/dynamic-starwars/src/model.rs new file mode 100644 index 0000000..9ecaaf8 --- /dev/null +++ b/models/dynamic-starwars/src/model.rs @@ -0,0 +1,267 @@ +use async_graphql::{dynamic::*, Value}; + +use crate::{Episode, StarWars, StarWarsChar}; + +impl<'a> From for FieldValue<'a> { + fn from(value: Episode) -> Self { + match value { + Episode::NewHope => FieldValue::value("NEW_HOPE"), + Episode::Empire => FieldValue::value("EMPIRE"), + Episode::Jedi => FieldValue::value("JEDI"), + } + } +} + +pub fn schema() -> Result { + let episode = Enum::new("Episode") + .item(EnumItem::new("NEW_HOPE").description("Released in 1977.")) + .item(EnumItem::new("EMPIRE").description("Released in 1980.")) + .item(EnumItem::new("JEDI").description("Released in 1983.")); + + let character = Interface::new("Character") + .field(InterfaceField::new( + "id", + TypeRef::named_nn(TypeRef::STRING), + )) + .field(InterfaceField::new( + "name", + TypeRef::named_nn(TypeRef::STRING), + )) + .field(InterfaceField::new( + "friends", + TypeRef::named_nn_list_nn("Character"), + )) + .field(InterfaceField::new( + "appearsIn", + TypeRef::named_nn_list_nn(episode.type_name()), + )); + + let human = Object::new("Human") + .description("A humanoid creature in the Star Wars universe.") + .implement(character.type_name()) + .field( + Field::new("id", TypeRef::named_nn(TypeRef::STRING), |ctx| { + FieldFuture::new(async move { + let char = ctx.parent_value.try_downcast_ref::()?; + Ok(Some(Value::from(char.id))) + }) + }) + .description("The id of the human."), + ) + .field( + Field::new("name", TypeRef::named_nn(TypeRef::STRING), |ctx| { + FieldFuture::new(async move { + let char = ctx.parent_value.try_downcast_ref::()?; + Ok(Some(Value::from(char.name))) + }) + }) + .description("The name of the human."), + ) + .field( + Field::new( + "friends", + TypeRef::named_nn_list_nn(character.type_name()), + |ctx| { + FieldFuture::new(async move { + let char = ctx.parent_value.try_downcast_ref::()?; + let starwars = ctx.data::()?; + let friends = starwars.friends(char); + Ok(Some(FieldValue::list(friends.into_iter().map(|friend| { + FieldValue::borrowed_any(friend).with_type(if friend.is_human { + "Human" + } else { + "Droid" + }) + })))) + }) + }, + ) + .description("The friends of the human, or an empty list if they have none."), + ) + .field( + Field::new( + "appearsIn", + TypeRef::named_nn_list_nn(episode.type_name()), + |ctx| { + FieldFuture::new(async move { + let char = ctx.parent_value.try_downcast_ref::()?; + Ok(Some(FieldValue::list( + char.appears_in.iter().copied().map(FieldValue::from), + ))) + }) + }, + ) + .description("Which movies they appear in."), + ) + .field( + Field::new("homePlanet", TypeRef::named(TypeRef::STRING), |ctx| { + FieldFuture::new(async move { + let char = ctx.parent_value.try_downcast_ref::()?; + Ok(char.home_planet.map(Value::from)) + }) + }) + .description("The home planet of the human, or null if unknown."), + ); + + let droid = Object::new("Droid") + .description("A mechanical creature in the Star Wars universe.") + .implement(character.type_name()) + .field( + Field::new("id", TypeRef::named_nn(TypeRef::STRING), |ctx| { + FieldFuture::new(async move { + let char = ctx.parent_value.try_downcast_ref::()?; + Ok(Some(Value::from(char.id))) + }) + }) + .description("The id of the droid."), + ) + .field( + Field::new("name", TypeRef::named_nn(TypeRef::STRING), |ctx| { + FieldFuture::new(async move { + let char = ctx.parent_value.try_downcast_ref::()?; + Ok(Some(Value::from(char.name))) + }) + }) + .description("The name of the droid."), + ) + .field( + Field::new( + "friends", + TypeRef::named_nn_list_nn(character.type_name()), + |ctx| { + FieldFuture::new(async move { + let char = ctx.parent_value.try_downcast_ref::()?; + let starwars = ctx.data::()?; + let friends = starwars.friends(char); + Ok(Some(FieldValue::list(friends.into_iter().map(|friend| { + FieldValue::borrowed_any(friend).with_type(if friend.is_human { + "Human" + } else { + "Droid" + }) + })))) + }) + }, + ) + .description("The friends of the droid, or an empty list if they have none."), + ) + .field( + Field::new( + "appearsIn", + TypeRef::named_nn_list_nn(episode.type_name()), + |ctx| { + FieldFuture::new(async move { + let char = ctx.parent_value.try_downcast_ref::()?; + Ok(Some(FieldValue::list( + char.appears_in.iter().copied().map(FieldValue::from), + ))) + }) + }, + ) + .description("Which movies they appear in."), + ) + .field( + Field::new("primaryFunction", TypeRef::named(TypeRef::STRING), |ctx| { + FieldFuture::new(async move { + let char = ctx.parent_value.try_downcast_ref::()?; + Ok(char.primary_function.map(Value::from)) + }) + }) + .description("The primary function of the droid."), + ); + + let query = Object::new("Qurey") + .field( + Field::new("hero", TypeRef::named_nn(character.type_name()), |ctx| { + FieldFuture::new(async move { + let starwars = ctx.data::()?; + let episode = match ctx.args.get("episode") { + Some(episode) => Some(match episode.enum_name()? { + "NEW_HOPE" => Episode::NewHope, + "EMPIRE" => Episode::Empire, + "JEDI" => Episode::Jedi, + _ => unreachable!(), + }), + None => None, + }; + let value = match episode { + Some(episode) => { + if episode == Episode::Empire { + FieldValue::borrowed_any(starwars.chars.get(starwars.luke).unwrap()) + .with_type("Human") + } else { + FieldValue::borrowed_any( + starwars.chars.get(starwars.artoo).unwrap(), + ) + .with_type("Droid") + } + } + None => { + FieldValue::borrowed_any(starwars.chars.get(starwars.luke).unwrap()) + .with_type("Human") + } + }; + Ok(Some(value)) + }) + }) + .argument(InputValue::new( + "episode", + TypeRef::named(episode.type_name()), + )), + ) + .field( + Field::new("human", TypeRef::named(human.type_name()), |ctx| { + FieldFuture::new(async move { + let starwars = ctx.data::()?; + let id = ctx.args.try_get("id")?; + Ok(starwars.human(id.string()?).map(FieldValue::borrowed_any)) + }) + }) + .argument(InputValue::new("id", TypeRef::named_nn(TypeRef::STRING))), + ) + .field(Field::new( + "humans", + TypeRef::named_nn_list_nn(human.type_name()), + |ctx| { + FieldFuture::new(async move { + let starwars = ctx.data::()?; + let humans = starwars.humans(); + Ok(Some(FieldValue::list( + humans.into_iter().map(FieldValue::borrowed_any), + ))) + }) + }, + )) + .field( + Field::new("droid", TypeRef::named(human.type_name()), |ctx| { + FieldFuture::new(async move { + let starwars = ctx.data::()?; + let id = ctx.args.try_get("id")?; + Ok(starwars.droid(id.string()?).map(FieldValue::borrowed_any)) + }) + }) + .argument(InputValue::new("id", TypeRef::named_nn(TypeRef::STRING))), + ) + .field(Field::new( + "droids", + TypeRef::named_nn_list_nn(human.type_name()), + |ctx| { + FieldFuture::new(async move { + let starwars = ctx.data::()?; + let droids = starwars.droids(); + Ok(Some(FieldValue::list( + droids.into_iter().map(FieldValue::borrowed_any), + ))) + }) + }, + )); + + Schema::build(query.type_name(), None, None) + .register(episode) + .register(character) + .register(human) + .register(droid) + .register(query) + .data(StarWars::new()) + .finish() +} diff --git a/models/starwars/src/model.rs b/models/starwars/src/model.rs index 160bd72..60b89be 100644 --- a/models/starwars/src/model.rs +++ b/models/starwars/src/model.rs @@ -119,8 +119,8 @@ impl QueryRoot { ) -> Character<'a> { let star_wars = ctx.data_unchecked::(); match episode { - Some(episode_name) => { - if episode_name == Episode::Empire { + Some(episode) => { + if episode == Episode::Empire { Human(star_wars.chars.get(star_wars.luke).unwrap()).into() } else { Droid(star_wars.chars.get(star_wars.artoo).unwrap()).into() @@ -233,7 +233,7 @@ where slice .iter() .enumerate() - .map(|(idx, item)| Edge::new(start + idx, (map_to)(*item))), + .map(|(idx, item)| Edge::new(start + idx, (map_to)(item))), ); Ok::<_, Error>(connection) }, diff --git a/poem/dynamic-schema/src/main.rs b/poem/dynamic-schema/src/main.rs index 22d983c..3c8298a 100644 --- a/poem/dynamic-schema/src/main.rs +++ b/poem/dynamic-schema/src/main.rs @@ -15,9 +15,10 @@ async fn graphql_playground() -> impl IntoResponse { #[tokio::main] async fn main() -> Result<(), Box> { - let query = Object::new("Query").field(Field::new("value", TypeRef::INT, |_| { - FieldFuture::new(async { Ok(Some(Value::from(100))) }) - })); + let query = + Object::new("Query").field(Field::new("value", TypeRef::named_nn(TypeRef::INT), |_| { + FieldFuture::new(async { Ok(Some(Value::from(100))) }) + })); let schema = Schema::build(query.type_name(), None, None) .register(query) .finish()?; diff --git a/poem/dynamic-starwars/Cargo.toml b/poem/dynamic-starwars/Cargo.toml new file mode 100644 index 0000000..ecf98e3 --- /dev/null +++ b/poem/dynamic-starwars/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "poem-dynamic-starwars" +version = "0.1.0" +edition = "2021" + +[dependencies] +async-graphql = { path = "../../..", features = ["dynamic-schema"] } +async-graphql-poem = { path = "../../../integrations/poem" } +tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } +dynamic-starwars = { path = "../../models/dynamic-starwars" } +poem = "1.3.48" diff --git a/poem/dynamic-starwars/src/main.rs b/poem/dynamic-starwars/src/main.rs new file mode 100644 index 0000000..c07b777 --- /dev/null +++ b/poem/dynamic-starwars/src/main.rs @@ -0,0 +1,26 @@ +use async_graphql::http::GraphiQLSource; +use async_graphql_poem::GraphQL; +use poem::{get, handler, listener::TcpListener, web::Html, IntoResponse, Route, Server}; + +#[handler] +async fn graphiql() -> impl IntoResponse { + Html( + GraphiQLSource::build() + .endpoint("http://localhost:8000") + .finish(), + ) +} + +#[tokio::main] +async fn main() { + let app = Route::new().at( + "/", + get(graphiql).post(GraphQL::new(dynamic_starwars::schema().unwrap())), + ); + + println!("GraphiQL IDE: http://localhost:8000"); + Server::new(TcpListener::bind("127.0.0.1:8000")) + .run(app) + .await + .unwrap(); +} From 4765773e690ff1633b6222d91e8f81baf700739d Mon Sep 17 00:00:00 2001 From: Sunli Date: Mon, 28 Nov 2022 11:54:46 +0800 Subject: [PATCH 048/102] update examples for axum 0.6.0 --- axum/starwars/Cargo.toml | 2 +- axum/subscription/Cargo.toml | 2 +- axum/subscription/src/main.rs | 2 +- axum/token-from-header/Cargo.toml | 2 +- axum/token-from-header/src/main.rs | 2 +- axum/upload/Cargo.toml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/axum/starwars/Cargo.toml b/axum/starwars/Cargo.toml index 123936f..ea26bb2 100644 --- a/axum/starwars/Cargo.toml +++ b/axum/starwars/Cargo.toml @@ -9,4 +9,4 @@ async-graphql-axum = { path = "../../../integrations/axum" } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } starwars = { path = "../../models/starwars" } hyper = "0.14" -axum = { version = "0.5.1", features = ["headers"] } +axum = { version = "0.6.0", features = ["headers"] } diff --git a/axum/subscription/Cargo.toml b/axum/subscription/Cargo.toml index f2dc3dc..6a13791 100644 --- a/axum/subscription/Cargo.toml +++ b/axum/subscription/Cargo.toml @@ -9,4 +9,4 @@ async-graphql-axum = { path = "../../../integrations/axum" } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } books = { path = "../../models/books" } hyper = "0.14" -axum = { version = "0.5.1", features = ["ws", "headers"] } +axum = { version = "0.6.0", features = ["ws", "headers"] } diff --git a/axum/subscription/src/main.rs b/axum/subscription/src/main.rs index 011ae47..f8f5776 100644 --- a/axum/subscription/src/main.rs +++ b/axum/subscription/src/main.rs @@ -29,7 +29,7 @@ async fn main() { let app = Router::new() .route("/", get(graphiql).post(graphql_handler)) - .route("/ws", GraphQLSubscription::new(schema.clone())) + .route_service("/ws", GraphQLSubscription::new(schema.clone())) .layer(Extension(schema)); println!("GraphiQL IDE: http://localhost:8000"); diff --git a/axum/token-from-header/Cargo.toml b/axum/token-from-header/Cargo.toml index 5f490a7..612b3de 100644 --- a/axum/token-from-header/Cargo.toml +++ b/axum/token-from-header/Cargo.toml @@ -9,4 +9,4 @@ async-graphql-axum = { path = "../../../integrations/axum" } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } token = { path = "../../models/token" } hyper = "0.14" -axum = { version = "0.5.1", features = ["ws", "headers"] } +axum = { version = "0.6.0", features = ["ws", "headers"] } diff --git a/axum/token-from-header/src/main.rs b/axum/token-from-header/src/main.rs index eb63eb9..2e02298 100644 --- a/axum/token-from-header/src/main.rs +++ b/axum/token-from-header/src/main.rs @@ -25,9 +25,9 @@ fn get_token_from_headers(headers: &HeaderMap) -> Option { } async fn graphql_handler( - req: GraphQLRequest, Extension(schema): Extension, headers: HeaderMap, + req: GraphQLRequest, ) -> GraphQLResponse { let mut req = req.into_inner(); if let Some(token) = get_token_from_headers(&headers) { diff --git a/axum/upload/Cargo.toml b/axum/upload/Cargo.toml index 3f821e3..e074bd4 100644 --- a/axum/upload/Cargo.toml +++ b/axum/upload/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-axum = { path = "../../../integrations/axum" } -axum = "0.5.1" +axum = "0.6.0" files = { path = "../../models/files" } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } hyper = "0.14" From a1a9ca521cfb4e11b7bdd7673137d01e3985827a Mon Sep 17 00:00:00 2001 From: Seyyed Morteza Moosavi Date: Tue, 20 Dec 2022 20:34:11 +0330 Subject: [PATCH 049/102] fix example for boxed-any --- models/dynamic-starwars/src/model.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/models/dynamic-starwars/src/model.rs b/models/dynamic-starwars/src/model.rs index 9ecaaf8..f9f6a3a 100644 --- a/models/dynamic-starwars/src/model.rs +++ b/models/dynamic-starwars/src/model.rs @@ -214,7 +214,9 @@ pub fn schema() -> Result { FieldFuture::new(async move { let starwars = ctx.data::()?; let id = ctx.args.try_get("id")?; - Ok(starwars.human(id.string()?).map(FieldValue::borrowed_any)) + Ok(starwars + .human(id.string()?) + .map(|v| FieldValue::borrowed_any(v))) }) }) .argument(InputValue::new("id", TypeRef::named_nn(TypeRef::STRING))), @@ -227,7 +229,7 @@ pub fn schema() -> Result { let starwars = ctx.data::()?; let humans = starwars.humans(); Ok(Some(FieldValue::list( - humans.into_iter().map(FieldValue::borrowed_any), + humans.into_iter().map(|v| FieldValue::borrowed_any(v)), ))) }) }, @@ -237,7 +239,9 @@ pub fn schema() -> Result { FieldFuture::new(async move { let starwars = ctx.data::()?; let id = ctx.args.try_get("id")?; - Ok(starwars.droid(id.string()?).map(FieldValue::borrowed_any)) + Ok(starwars + .droid(id.string()?) + .map(|v| FieldValue::borrowed_any(v))) }) }) .argument(InputValue::new("id", TypeRef::named_nn(TypeRef::STRING))), @@ -250,7 +254,7 @@ pub fn schema() -> Result { let starwars = ctx.data::()?; let droids = starwars.droids(); Ok(Some(FieldValue::list( - droids.into_iter().map(FieldValue::borrowed_any), + droids.into_iter().map(|v| FieldValue::borrowed_any(v)), ))) }) }, From 9e81fa96a503e55429a61f4f59a78754c5b72da0 Mon Sep 17 00:00:00 2001 From: Bram van Neerven Date: Thu, 22 Dec 2022 23:52:39 +0100 Subject: [PATCH 050/102] updated examples to relative paths --- actix-web/error-extensions/src/main.rs | 6 +----- actix-web/starwars/src/main.rs | 6 +----- actix-web/subscription/src/main.rs | 4 ++-- actix-web/token-from-header/src/main.rs | 4 ++-- actix-web/upload/src/main.rs | 6 +----- axum/starwars/src/main.rs | 6 +----- axum/subscription/src/main.rs | 4 ++-- axum/upload/src/main.rs | 6 +----- poem/dynamic-starwars/src/main.rs | 6 +----- poem/starwars/src/main.rs | 6 +----- poem/subscription-redis/src/main.rs | 4 ++-- poem/subscription/src/main.rs | 4 ++-- poem/token-from-header/src/main.rs | 4 ++-- poem/upload/src/main.rs | 6 +----- tide/dataloader-postgres/src/main.rs | 4 +--- tide/dataloader/src/main.rs | 4 +--- tide/subscription/src/main.rs | 4 ++-- warp/starwars/src/main.rs | 6 +----- warp/subscription/src/main.rs | 4 ++-- warp/token-from-header/src/main.rs | 4 ++-- 20 files changed, 29 insertions(+), 69 deletions(-) diff --git a/actix-web/error-extensions/src/main.rs b/actix-web/error-extensions/src/main.rs index 703041c..fb24e0b 100644 --- a/actix-web/error-extensions/src/main.rs +++ b/actix-web/error-extensions/src/main.rs @@ -101,11 +101,7 @@ async fn index( async fn gql_playgound() -> HttpResponse { HttpResponse::Ok() .content_type("text/html; charset=utf-8") - .body( - GraphiQLSource::build() - .endpoint("http://localhost:8000") - .finish(), - ) + .body(GraphiQLSource::build().endpoint("/").finish()) } #[actix_web::main] diff --git a/actix-web/starwars/src/main.rs b/actix-web/starwars/src/main.rs index a9d7e79..543bd23 100644 --- a/actix-web/starwars/src/main.rs +++ b/actix-web/starwars/src/main.rs @@ -10,11 +10,7 @@ async fn index(schema: web::Data, req: GraphQLRequest) -> GraphQ async fn index_graphiql() -> Result { Ok(HttpResponse::Ok() .content_type("text/html; charset=utf-8") - .body( - GraphiQLSource::build() - .endpoint("http://localhost:8000") - .finish(), - )) + .body(GraphiQLSource::build().endpoint("/").finish())) } #[actix_web::main] diff --git a/actix-web/subscription/src/main.rs b/actix-web/subscription/src/main.rs index e561b57..fc4e7bc 100644 --- a/actix-web/subscription/src/main.rs +++ b/actix-web/subscription/src/main.rs @@ -12,8 +12,8 @@ async fn index_graphiql() -> Result { .content_type("text/html; charset=utf-8") .body( GraphiQLSource::build() - .endpoint("http://localhost:8000") - .subscription_endpoint("ws://localhost:8000") + .endpoint("/") + .subscription_endpoint("/") .finish(), )) } diff --git a/actix-web/token-from-header/src/main.rs b/actix-web/token-from-header/src/main.rs index 8bcb639..859ff12 100644 --- a/actix-web/token-from-header/src/main.rs +++ b/actix-web/token-from-header/src/main.rs @@ -10,8 +10,8 @@ async fn graphiql() -> HttpResponse { .content_type("text/html; charset=utf-8") .body( GraphiQLSource::build() - .endpoint("http://localhost:8000") - .subscription_endpoint("ws://localhost:8000/ws") + .endpoint("/") + .subscription_endpoint("/ws") .finish(), ) } diff --git a/actix-web/upload/src/main.rs b/actix-web/upload/src/main.rs index 50d9b47..7a5291c 100644 --- a/actix-web/upload/src/main.rs +++ b/actix-web/upload/src/main.rs @@ -13,11 +13,7 @@ async fn index(schema: web::Data, req: GraphQLRequest) -> GraphQLRe async fn gql_playgound() -> HttpResponse { HttpResponse::Ok() .content_type("text/html; charset=utf-8") - .body( - GraphiQLSource::build() - .endpoint("http://localhost:8000") - .finish(), - ) + .body(GraphiQLSource::build().endpoint("/").finish()) } #[actix_web::main] diff --git a/axum/starwars/src/main.rs b/axum/starwars/src/main.rs index 8ee1607..e49e9b5 100644 --- a/axum/starwars/src/main.rs +++ b/axum/starwars/src/main.rs @@ -16,11 +16,7 @@ async fn graphql_handler( } async fn graphiql() -> impl IntoResponse { - response::Html( - GraphiQLSource::build() - .endpoint("http://localhost:8000") - .finish(), - ) + response::Html(GraphiQLSource::build().endpoint("/").finish()) } #[tokio::main] diff --git a/axum/subscription/src/main.rs b/axum/subscription/src/main.rs index f8f5776..dcf5176 100644 --- a/axum/subscription/src/main.rs +++ b/axum/subscription/src/main.rs @@ -15,8 +15,8 @@ async fn graphql_handler(schema: Extension, req: GraphQLRequest) -> async fn graphiql() -> impl IntoResponse { response::Html( GraphiQLSource::build() - .endpoint("http://localhost:8000") - .subscription_endpoint("ws://localhost:8000/ws") + .endpoint("/") + .subscription_endpoint("/ws") .finish(), ) } diff --git a/axum/upload/src/main.rs b/axum/upload/src/main.rs index f758a1c..e2b50cd 100644 --- a/axum/upload/src/main.rs +++ b/axum/upload/src/main.rs @@ -15,11 +15,7 @@ async fn graphql_handler(schema: Extension, req: GraphQLRequest) -> } async fn graphiql() -> impl IntoResponse { - Html( - GraphiQLSource::build() - .endpoint("http://localhost:8000") - .finish(), - ) + Html(GraphiQLSource::build().endpoint("/").finish()) } #[tokio::main] diff --git a/poem/dynamic-starwars/src/main.rs b/poem/dynamic-starwars/src/main.rs index c07b777..7781822 100644 --- a/poem/dynamic-starwars/src/main.rs +++ b/poem/dynamic-starwars/src/main.rs @@ -4,11 +4,7 @@ use poem::{get, handler, listener::TcpListener, web::Html, IntoResponse, Route, #[handler] async fn graphiql() -> impl IntoResponse { - Html( - GraphiQLSource::build() - .endpoint("http://localhost:8000") - .finish(), - ) + Html(GraphiQLSource::build().endpoint("/").finish()) } #[tokio::main] diff --git a/poem/starwars/src/main.rs b/poem/starwars/src/main.rs index 3519cdb..619ce9a 100644 --- a/poem/starwars/src/main.rs +++ b/poem/starwars/src/main.rs @@ -5,11 +5,7 @@ use starwars::{QueryRoot, StarWars}; #[handler] async fn graphiql() -> impl IntoResponse { - Html( - GraphiQLSource::build() - .endpoint("http://localhost:8000") - .finish(), - ) + Html(GraphiQLSource::build().endpoint("/").finish()) } #[tokio::main] diff --git a/poem/subscription-redis/src/main.rs b/poem/subscription-redis/src/main.rs index a66fade..7ad4e99 100644 --- a/poem/subscription-redis/src/main.rs +++ b/poem/subscription-redis/src/main.rs @@ -43,8 +43,8 @@ impl SubscriptionRoot { async fn graphiql() -> impl IntoResponse { Html( GraphiQLSource::build() - .endpoint("http://localhost:8000") - .subscription_endpoint("ws://localhost:8000/ws") + .endpoint("/") + .subscription_endpoint("/ws") .finish(), ) } diff --git a/poem/subscription/src/main.rs b/poem/subscription/src/main.rs index 05e00ed..5082d51 100644 --- a/poem/subscription/src/main.rs +++ b/poem/subscription/src/main.rs @@ -7,8 +7,8 @@ use poem::{get, handler, listener::TcpListener, web::Html, IntoResponse, Route, async fn graphiql() -> impl IntoResponse { Html( GraphiQLSource::build() - .endpoint("http://localhost:8000") - .subscription_endpoint("ws://localhost:8000/ws") + .endpoint("/") + .subscription_endpoint("/ws") .finish(), ) } diff --git a/poem/token-from-header/src/main.rs b/poem/token-from-header/src/main.rs index bb9d9ae..c731aa3 100644 --- a/poem/token-from-header/src/main.rs +++ b/poem/token-from-header/src/main.rs @@ -22,8 +22,8 @@ fn get_token_from_headers(headers: &HeaderMap) -> Option { async fn graphiql() -> impl IntoResponse { Html( GraphiQLSource::build() - .endpoint("http://localhost:8000") - .subscription_endpoint("ws://localhost:8000/ws") + .endpoint("/") + .subscription_endpoint("/ws") .finish(), ) } diff --git a/poem/upload/src/main.rs b/poem/upload/src/main.rs index 35c3c70..f8353b7 100644 --- a/poem/upload/src/main.rs +++ b/poem/upload/src/main.rs @@ -16,11 +16,7 @@ async fn index(schema: Data<&FilesSchema>, req: GraphQLRequest) -> GraphQLRespon #[handler] async fn graphiql() -> impl IntoResponse { - Html( - GraphiQLSource::build() - .endpoint("http://localhost:8000") - .finish(), - ) + Html(GraphiQLSource::build().endpoint("/").finish()) } #[tokio::main] diff --git a/tide/dataloader-postgres/src/main.rs b/tide/dataloader-postgres/src/main.rs index c3f9f15..a65aeb9 100644 --- a/tide/dataloader-postgres/src/main.rs +++ b/tide/dataloader-postgres/src/main.rs @@ -106,9 +106,7 @@ async fn run() -> Result<()> { app.at("/").get(|_| async move { let mut resp = Response::new(StatusCode::Ok); resp.set_body(Body::from_string( - GraphiQLSource::build() - .endpoint("http://localhost:8000/graphql") - .finish(), + GraphiQLSource::build().endpoint("/graphql").finish(), )); resp.set_content_type(mime::HTML); Ok(resp) diff --git a/tide/dataloader/src/main.rs b/tide/dataloader/src/main.rs index 7c0c862..11615c6 100644 --- a/tide/dataloader/src/main.rs +++ b/tide/dataloader/src/main.rs @@ -105,9 +105,7 @@ async fn run() -> Result<()> { app.at("/").get(|_| async move { let mut resp = Response::new(StatusCode::Ok); resp.set_body(Body::from_string( - GraphiQLSource::build() - .endpoint("http://localhost:8000/graphql") - .finish(), + GraphiQLSource::build().endpoint("/graphql").finish(), )); resp.set_content_type(mime::HTML); Ok(resp) diff --git a/tide/subscription/src/main.rs b/tide/subscription/src/main.rs index 84a8410..cae16ed 100644 --- a/tide/subscription/src/main.rs +++ b/tide/subscription/src/main.rs @@ -26,8 +26,8 @@ async fn run() -> Result<()> { let mut resp = Response::new(StatusCode::Ok); resp.set_body(Body::from_string( GraphiQLSource::build() - .endpoint("http://localhost:8000/graphql") - .subscription_endpoint("ws://localhost:8000/graphql") + .endpoint("/graphql") + .subscription_endpoint("/graphql") .finish(), )); resp.set_content_type(mime::HTML); diff --git a/warp/starwars/src/main.rs b/warp/starwars/src/main.rs index b8ff5b2..745773f 100644 --- a/warp/starwars/src/main.rs +++ b/warp/starwars/src/main.rs @@ -26,11 +26,7 @@ async fn main() { let graphiql = warp::path::end().and(warp::get()).map(|| { HttpResponse::builder() .header("content-type", "text/html") - .body( - GraphiQLSource::build() - .endpoint("http://localhost:8000") - .finish(), - ) + .body(GraphiQLSource::build().endpoint("/").finish()) }); let routes = graphiql diff --git a/warp/subscription/src/main.rs b/warp/subscription/src/main.rs index 54b6d79..559e4b3 100644 --- a/warp/subscription/src/main.rs +++ b/warp/subscription/src/main.rs @@ -27,8 +27,8 @@ async fn main() { .header("content-type", "text/html") .body( GraphiQLSource::build() - .endpoint("http://localhost:8000") - .subscription_endpoint("ws://localhost:8000") + .endpoint("/") + .subscription_endpoint("/") .finish(), ) }); diff --git a/warp/token-from-header/src/main.rs b/warp/token-from-header/src/main.rs index 2daf706..f14cc71 100644 --- a/warp/token-from-header/src/main.rs +++ b/warp/token-from-header/src/main.rs @@ -16,8 +16,8 @@ async fn main() { .header("content-type", "text/html") .body( GraphiQLSource::build() - .endpoint("http://localhost:8000") - .subscription_endpoint("ws://localhost:8000/ws") + .endpoint("/") + .subscription_endpoint("/ws") .finish(), ) }); From 06b688a9d1c7d76b4930a19f304dd93ff639733e Mon Sep 17 00:00:00 2001 From: Dylan Anthony Date: Wed, 4 Jan 2023 13:55:23 -0700 Subject: [PATCH 051/102] Tweak some sqlx syntax to be more idiomatic --- tide/dataloader-postgres/Cargo.toml | 2 +- tide/dataloader-postgres/src/main.rs | 16 ++++++---------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/tide/dataloader-postgres/Cargo.toml b/tide/dataloader-postgres/Cargo.toml index e4881ee..4a95873 100644 --- a/tide/dataloader-postgres/Cargo.toml +++ b/tide/dataloader-postgres/Cargo.toml @@ -10,7 +10,7 @@ async-graphql-tide = { path = "../../../integrations/tide" } async-std = "1.9.0" async-trait = "0.1.42" itertools = "0.10.0" -sqlx = { version = "0.5.5", features = ["runtime-async-std-rustls", "postgres"] } +sqlx = { version = "0.6.2", features = ["runtime-async-std-rustls", "postgres"] } tide = "0.16.0" [dev-dependencies] diff --git a/tide/dataloader-postgres/src/main.rs b/tide/dataloader-postgres/src/main.rs index a65aeb9..8239bbb 100644 --- a/tide/dataloader-postgres/src/main.rs +++ b/tide/dataloader-postgres/src/main.rs @@ -8,8 +8,7 @@ use async_graphql::{ }; use async_std::task; use async_trait::async_trait; -use itertools::Itertools; -use sqlx::{Pool, Postgres}; +use sqlx::PgPool; use tide::{http::mime, Body, Response, StatusCode}; #[derive(sqlx::FromRow, Clone, SimpleObject)] @@ -19,10 +18,10 @@ pub struct Book { author: String, } -pub struct BookLoader(Pool); +pub struct BookLoader(PgPool); impl BookLoader { - fn new(postgres_pool: Pool) -> Self { + fn new(postgres_pool: PgPool) -> Self { Self(postgres_pool) } } @@ -39,11 +38,8 @@ impl Loader for BookLoader { return Err("MOCK DBError".into()); } - let query = format!( - "SELECT id, name, author FROM books WHERE id IN ({})", - keys.iter().join(",") - ); - Ok(sqlx::query_as(&query) + Ok(sqlx::query_as("SELECT id, name, author FROM books WHERE id = ANY($1)") + .bind(keys) .fetch(&self.0) .map_ok(|book: Book| (book.id, book)) .try_collect() @@ -68,7 +64,7 @@ fn main() -> Result<()> { } async fn run() -> Result<()> { - let postgres_pool: Pool = Pool::connect(&env::var("DATABASE_URL")?).await?; + let postgres_pool = PgPool::connect(&env::var("DATABASE_URL")?).await?; sqlx::query( r#" From 6ccaafbad3d2f38ce6347c6699466fbbc017f910 Mon Sep 17 00:00:00 2001 From: Dylan Anthony Date: Thu, 12 Jan 2023 16:35:37 -0700 Subject: [PATCH 052/102] fix: Export directives to federation SDL so they can be composed. Add example of this feature. --- federation/README.md | 1 + federation/directives/Cargo.toml | 9 ++++++++ federation/directives/src/lib.rs | 24 ++++++++++++++++++++++ federation/federation-accounts/Cargo.toml | 1 + federation/federation-accounts/src/main.rs | 4 +++- federation/federation-products/Cargo.toml | 1 + federation/federation-products/src/main.rs | 1 + federation/federation-reviews/Cargo.toml | 1 + federation/federation-reviews/src/main.rs | 1 + federation/query.graphql | 19 +++++++++++++++++ 10 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 federation/directives/Cargo.toml create mode 100644 federation/directives/src/lib.rs create mode 100644 federation/query.graphql diff --git a/federation/README.md b/federation/README.md index 332fdd6..ceb95a4 100644 --- a/federation/README.md +++ b/federation/README.md @@ -13,3 +13,4 @@ You can view the full schema in [Apollo Studio](https://studio.apollographql.com 1. Start each subgraph with `cargo run --bin {subgraph_name}` 2. Add each subgraph to `rover dev` with `rover dev --url http://localhost:{port} --name {subgraph_name}` 3. Visit `http://localhost:3000` in a browser. +4. You can now run queries like the one in `query.graphql` against the router. diff --git a/federation/directives/Cargo.toml b/federation/directives/Cargo.toml new file mode 100644 index 0000000..77417e5 --- /dev/null +++ b/federation/directives/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "directives" +version = "0.1.0" +authors = ["sunli "] +edition = "2021" + +[dependencies] +async-graphql = { path = "../../.." } +async-trait = "0.1.61" diff --git a/federation/directives/src/lib.rs b/federation/directives/src/lib.rs new file mode 100644 index 0000000..493007b --- /dev/null +++ b/federation/directives/src/lib.rs @@ -0,0 +1,24 @@ +use async_graphql::{Context, CustomDirective, Directive, ResolveFut, ServerResult, Value}; + +struct LowercaseDirective; + +#[async_trait::async_trait] +impl CustomDirective for LowercaseDirective { + async fn resolve_field( + &self, + _ctx: &Context<'_>, + resolve: ResolveFut<'_>, + ) -> ServerResult> { + resolve.await.map(|value| { + value.map(|value| match value { + Value::String(str) => Value::String(str.to_ascii_lowercase()), + _ => value, + }) + }) + } +} + +#[Directive(location = "field")] +pub fn lowercase() -> impl CustomDirective { + LowercaseDirective +} diff --git a/federation/federation-accounts/Cargo.toml b/federation/federation-accounts/Cargo.toml index 64f09ee..376dfe7 100644 --- a/federation/federation-accounts/Cargo.toml +++ b/federation/federation-accounts/Cargo.toml @@ -7,5 +7,6 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-poem = { path = "../../../integrations/poem" } +directives = { path = "../directives" } tokio = { version = "1.0.2", features = ["macros", "rt-multi-thread"] } poem = { version = "1.3.43" } diff --git a/federation/federation-accounts/src/main.rs b/federation/federation-accounts/src/main.rs index c1eb085..d736ee6 100644 --- a/federation/federation-accounts/src/main.rs +++ b/federation/federation-accounts/src/main.rs @@ -64,7 +64,9 @@ impl Query { #[tokio::main] async fn main() -> std::io::Result<()> { - let schema = Schema::new(Query, EmptyMutation, EmptySubscription); + let schema = Schema::build(Query, EmptyMutation, EmptySubscription) + .directive(directives::lowercase) + .finish(); Server::new(TcpListener::bind("127.0.0.1:4001")) .run(Route::new().at("/", GraphQL::new(schema))) .await diff --git a/federation/federation-products/Cargo.toml b/federation/federation-products/Cargo.toml index 279c2c2..1277849 100644 --- a/federation/federation-products/Cargo.toml +++ b/federation/federation-products/Cargo.toml @@ -7,5 +7,6 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-poem = { path = "../../../integrations/poem" } +directives = { path = "../directives" } tokio = { version = "1.0.2", features = ["macros", "rt-multi-thread"] } poem = { version = "1.3.43" } diff --git a/federation/federation-products/src/main.rs b/federation/federation-products/src/main.rs index cf4cd36..b033c9d 100644 --- a/federation/federation-products/src/main.rs +++ b/federation/federation-products/src/main.rs @@ -51,6 +51,7 @@ async fn main() -> std::io::Result<()> { let schema = Schema::build(Query, EmptyMutation, EmptySubscription) .data(hats) + .directive(directives::lowercase) .finish(); Server::new(TcpListener::bind("127.0.0.1:4002")) diff --git a/federation/federation-reviews/Cargo.toml b/federation/federation-reviews/Cargo.toml index 6bfe00e..8fbffb5 100644 --- a/federation/federation-reviews/Cargo.toml +++ b/federation/federation-reviews/Cargo.toml @@ -7,5 +7,6 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-poem = { path = "../../../integrations/poem" } +directives = { path = "../directives" } tokio = { version = "1.0.2", features = ["macros", "rt-multi-thread"] } poem = { version = "1.3.43" } diff --git a/federation/federation-reviews/src/main.rs b/federation/federation-reviews/src/main.rs index 8f874a4..a53be54 100644 --- a/federation/federation-reviews/src/main.rs +++ b/federation/federation-reviews/src/main.rs @@ -189,6 +189,7 @@ async fn main() -> std::io::Result<()> { let schema = Schema::build(Query, EmptyMutation, EmptySubscription) .data(reviews) + .directive(directives::lowercase) .finish(); Server::new(TcpListener::bind("127.0.0.1:4003")) diff --git a/federation/query.graphql b/federation/query.graphql new file mode 100644 index 0000000..35c656a --- /dev/null +++ b/federation/query.graphql @@ -0,0 +1,19 @@ +query ExampleQuery { + me { + id + username @lowercase + reviews { + body + ... @defer { + product { + reviews { + author { + username + } + body + } + } + } + } + } +} \ No newline at end of file From f50e3eb69883ff0be11445196558c06528af772e Mon Sep 17 00:00:00 2001 From: Dylan Anthony Date: Thu, 12 Jan 2023 16:50:36 -0700 Subject: [PATCH 053/102] chore: Reformat --- tide/dataloader-postgres/src/main.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tide/dataloader-postgres/src/main.rs b/tide/dataloader-postgres/src/main.rs index 8239bbb..59f384b 100644 --- a/tide/dataloader-postgres/src/main.rs +++ b/tide/dataloader-postgres/src/main.rs @@ -38,12 +38,14 @@ impl Loader for BookLoader { return Err("MOCK DBError".into()); } - Ok(sqlx::query_as("SELECT id, name, author FROM books WHERE id = ANY($1)") - .bind(keys) - .fetch(&self.0) - .map_ok(|book: Book| (book.id, book)) - .try_collect() - .await?) + Ok( + sqlx::query_as("SELECT id, name, author FROM books WHERE id = ANY($1)") + .bind(keys) + .fetch(&self.0) + .map_ok(|book: Book| (book.id, book)) + .try_collect() + .await?, + ) } } From a3677c0227393f6a319c139a18ec4ee2643e4897 Mon Sep 17 00:00:00 2001 From: Sunli Date: Wed, 7 Jun 2023 13:08:37 +0800 Subject: [PATCH 054/102] bump opentelemetry from `0.18.0` to `0.19.0` --- poem/opentelemetry-basic/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/poem/opentelemetry-basic/Cargo.toml b/poem/opentelemetry-basic/Cargo.toml index b7ae51e..d207fe5 100644 --- a/poem/opentelemetry-basic/Cargo.toml +++ b/poem/opentelemetry-basic/Cargo.toml @@ -10,4 +10,4 @@ async-graphql = { path = "../../..", features = ["opentelemetry"] } async-graphql-poem = { path = "../../../integrations/poem" } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } poem = "1.3.42" -opentelemetry = { version = "0.18.0", features = ["rt-tokio"] } +opentelemetry = { version = "0.19.0", features = ["rt-tokio"] } From dabe90db19b6fbb908efea2d31eb8615303602d6 Mon Sep 17 00:00:00 2001 From: Sunli Date: Sun, 11 Jun 2023 10:33:38 +0800 Subject: [PATCH 055/102] Update model.rs --- models/starwars/src/model.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/models/starwars/src/model.rs b/models/starwars/src/model.rs index 60b89be..ee19c58 100644 --- a/models/starwars/src/model.rs +++ b/models/starwars/src/model.rs @@ -173,10 +173,10 @@ impl QueryRoot { #[derive(Interface)] #[graphql( - field(name = "id", type = "&str"), - field(name = "name", type = "&str"), - field(name = "friends", type = "Vec>"), - field(name = "appears_in", type = "&[Episode]") + field(name = "id", ty = "&str"), + field(name = "name", ty = "&str"), + field(name = "friends", ty = "Vec>"), + field(name = "appears_in", ty = "&[Episode]") )] pub enum Character<'a> { Human(Human<'a>), From 8390fe5842c8fbb76a9f85f6ac3c0b66ecd68411 Mon Sep 17 00:00:00 2001 From: Sunli Date: Thu, 29 Jun 2023 22:21:17 +0800 Subject: [PATCH 056/102] Update lib.rs --- federation/directives/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/federation/directives/src/lib.rs b/federation/directives/src/lib.rs index 493007b..773c262 100644 --- a/federation/directives/src/lib.rs +++ b/federation/directives/src/lib.rs @@ -18,7 +18,7 @@ impl CustomDirective for LowercaseDirective { } } -#[Directive(location = "field")] +#[Directive(location = "Field")] pub fn lowercase() -> impl CustomDirective { LowercaseDirective } From b433457d3bea5ce91b4ad63aaef769206a6ca814 Mon Sep 17 00:00:00 2001 From: Sunli Date: Sat, 29 Jul 2023 15:38:50 +0800 Subject: [PATCH 057/102] clippy clean --- federation/federation-reviews/src/main.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/federation/federation-reviews/src/main.rs b/federation/federation-reviews/src/main.rs index a53be54..bb2a84b 100644 --- a/federation/federation-reviews/src/main.rs +++ b/federation/federation-reviews/src/main.rs @@ -16,6 +16,7 @@ struct User { } #[derive(Enum, Eq, PartialEq, Copy, Clone)] +#[allow(clippy::enum_variant_names)] enum Trustworthiness { ReallyTrusted, KindaTrusted, From 9a3496179e3973b288c91a9baf450efaa37a35f4 Mon Sep 17 00:00:00 2001 From: gianmarcoalarcon Date: Sun, 6 Aug 2023 20:50:07 +0800 Subject: [PATCH 058/102] Feat: Add basic dynamic schema(query, subscription) --- Cargo.toml | 85 ++++++++++++++++--------------- models/dynamic-books/Cargo.toml | 13 +++++ models/dynamic-books/src/lib.rs | 65 +++++++++++++++++++++++ models/dynamic-books/src/model.rs | 82 +++++++++++++++++++++++++++++ poem/dynamic-books/Cargo.toml | 11 ++++ poem/dynamic-books/src/main.rs | 27 ++++++++++ 6 files changed, 242 insertions(+), 41 deletions(-) create mode 100644 models/dynamic-books/Cargo.toml create mode 100644 models/dynamic-books/src/lib.rs create mode 100644 models/dynamic-books/src/model.rs create mode 100644 poem/dynamic-books/Cargo.toml create mode 100644 poem/dynamic-books/src/main.rs diff --git a/Cargo.toml b/Cargo.toml index 0e055e7..d1698d9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,44 +1,47 @@ [workspace] members = [ - "models/starwars", - "models/dynamic-starwars", - "models/books", - "models/files", - "models/token", - - "poem/opentelemetry-basic", - "poem/starwars", - "poem/subscription", - "poem/subscription-redis", - "poem/token-from-header", - "poem/upload", - "poem/dynamic-schema", - "poem/dynamic-starwars", - - "actix-web/token-from-header", - "actix-web/subscription", - "actix-web/upload", - "actix-web/starwars", - "actix-web/error-extensions", - - "warp/starwars", - "warp/subscription", - "warp/token-from-header", - - "federation/federation-accounts", - "federation/federation-products", - "federation/federation-reviews", - - "rocket/starwars", - "rocket/upload", - - "axum/starwars", - "axum/subscription", - "axum/upload", - "axum/token-from-header", - - "tide/starwars", - "tide/dataloader", - "tide/dataloader-postgres", - "tide/subscription", + "models/starwars", + "models/dynamic-starwars", + "models/dynamic-books", + "models/books", + "models/files", + "models/token", + + "poem/opentelemetry-basic", + "poem/starwars", + "poem/subscription", + "poem/subscription-redis", + "poem/token-from-header", + "poem/upload", + "poem/dynamic-schema", + "poem/dynamic-starwars", + "poem/dynamic-books", + + + "actix-web/token-from-header", + "actix-web/subscription", + "actix-web/upload", + "actix-web/starwars", + "actix-web/error-extensions", + + "warp/starwars", + "warp/subscription", + "warp/token-from-header", + + "federation/federation-accounts", + "federation/federation-products", + "federation/federation-reviews", + + "rocket/starwars", + "rocket/upload", + + "axum/starwars", + "axum/subscription", + "axum/upload", + "axum/token-from-header", + + "tide/starwars", + "tide/dataloader", + "tide/dataloader-postgres", + "tide/subscription", ] diff --git a/models/dynamic-books/Cargo.toml b/models/dynamic-books/Cargo.toml new file mode 100644 index 0000000..10585c7 --- /dev/null +++ b/models/dynamic-books/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "dynamic-books" +version = "0.1.0" +edition = "2021" + +[dependencies] +async-graphql = { path = "../../..", features = ["dynamic-schema"] } +slab = "0.4.2" +futures-util = "0.3.0" +futures-channel = "0.3.0" +once_cell = "1.0" +futures-timer = "3.0.2" +async-stream = "0.3.0" diff --git a/models/dynamic-books/src/lib.rs b/models/dynamic-books/src/lib.rs new file mode 100644 index 0000000..ac0e4b0 --- /dev/null +++ b/models/dynamic-books/src/lib.rs @@ -0,0 +1,65 @@ +mod model; +use async_graphql::ID; + +pub use model::schema; +use slab::Slab; +use std::collections::HashMap; + +type Storage = Slab; + +#[derive(Clone)] +pub struct Book { + id: ID, + name: &'static str, + author: &'static str, +} + +pub struct BookStore { + store: Storage, + books_by_id: HashMap, + value: usize, +} +impl BookStore { + #[allow(clippy::new_without_default)] + pub fn new() -> Self { + let mut store = Slab::new(); + let key_1 = store.insert(Book { + id: "10".into(), + name: "Luke Skywalker", + author: "Tatooine", + }); + let key_2 = store.insert(Book { + id: 1001.into(), + name: "Anakin Skywalker", + author: "Tatooine", + }); + + let mut books_by_id = HashMap::new(); + books_by_id.insert("10".to_string(), key_1); + books_by_id.insert("1001".to_string(), key_2); + + Self { + store, + books_by_id, + value: 10, + } + } + + pub fn get_book(&self, id: &str) -> Option<&Book> { + self.books_by_id + .get(id) + .and_then(|idx| self.store.get(*idx)) + } + + pub fn get_books(&self) -> Vec<&Book> { + self.store.iter().map(|(_, book)| book).collect() + } + + pub fn create_book(&mut self, id: ID, name: &'static str, author: &'static str) -> &Book { + let id_str = id.to_string(); + let book = Book { id, name, author }; + let key = self.store.insert(book.clone()); + self.books_by_id.insert(id_str, key); + self.store.get(key).unwrap() + } +} diff --git a/models/dynamic-books/src/model.rs b/models/dynamic-books/src/model.rs new file mode 100644 index 0000000..59211d0 --- /dev/null +++ b/models/dynamic-books/src/model.rs @@ -0,0 +1,82 @@ +use async_graphql::{dynamic::*, Value}; +use futures_util::StreamExt; + +use crate::{Book, BookStore}; + +pub fn schema() -> Result { + let book = Object::new("Book") + .description("A book that will be stored.") + .field( + Field::new("id", TypeRef::named_nn(TypeRef::ID), |ctx| { + FieldFuture::new(async move { + let book = ctx.parent_value.try_downcast_ref::()?; + Ok(Some(Value::from(book.id.to_owned()))) + }) + }) + .description("The id of the book."), + ) + .field( + Field::new("name", TypeRef::named_nn(TypeRef::STRING), |ctx| { + FieldFuture::new(async move { + let book = ctx.parent_value.try_downcast_ref::()?; + Ok(Some(Value::from(book.name))) + }) + }) + .description("The name of the book."), + ) + .field( + Field::new("author", TypeRef::named_nn(TypeRef::STRING), |ctx| { + FieldFuture::new(async move { + let book = ctx.parent_value.try_downcast_ref::()?; + Ok(Some(Value::from(book.author))) + }) + }) + .description("The author of the book."), + ); + + let query = Object::new("Query") + .field( + Field::new("getBook", TypeRef::named(book.type_name()), |ctx| { + FieldFuture::new(async move { + let store = ctx.data::().unwrap(); + let id = ctx.args.try_get("id")?; + Ok(store + .get_book(id.string()?) + .map(|b| FieldValue::borrowed_any(b))) + }) + }) + .argument(InputValue::new("id", TypeRef::named_nn(TypeRef::STRING))), + ) + .field(Field::new( + "getBooks", + TypeRef::named_nn_list_nn(book.type_name()), + |ctx| { + FieldFuture::new(async move { + let store = ctx.data::().unwrap(); + let books = store.get_books(); + Ok(Some(FieldValue::list( + books.into_iter().map(|b| FieldValue::borrowed_any(b)), + ))) + }) + }, + )); + + // Todo:Show book.value + let subscription = Subscription::new("Subscription").field(SubscriptionField::new( + "value", + TypeRef::named_nn(TypeRef::INT), + |ctx| { + SubscriptionFieldFuture::new(async move { + let value_1 = ctx.data_unchecked::().value; + Ok(futures_util::stream::repeat(value_1).map(|value| Ok(Value::from(value)))) + }) + }, + )); + + Schema::build(query.type_name(), None, Some(subscription.type_name())) + .register(book) + .register(query) + .register(subscription) + .data(BookStore::new()) + .finish() +} diff --git a/poem/dynamic-books/Cargo.toml b/poem/dynamic-books/Cargo.toml new file mode 100644 index 0000000..a755e8b --- /dev/null +++ b/poem/dynamic-books/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "poem-dynamic-books" +version = "0.1.0" +edition = "2021" + +[dependencies] +async-graphql = { path = "../../..", features = ["dynamic-schema"] } +async-graphql-poem = { path = "../../../integrations/poem" } +tokio = { version = "1.29", features = ["macros", "rt-multi-thread"] } +dynamic-books = { path = "../../models/dynamic-books" } +poem = "1.3.57" diff --git a/poem/dynamic-books/src/main.rs b/poem/dynamic-books/src/main.rs new file mode 100644 index 0000000..c02b219 --- /dev/null +++ b/poem/dynamic-books/src/main.rs @@ -0,0 +1,27 @@ +use async_graphql::http::GraphiQLSource; +use async_graphql_poem::{GraphQL, GraphQLSubscription}; +use poem::{get, handler, listener::TcpListener, web::Html, IntoResponse, Route, Server}; + +#[handler] +async fn graphiql() -> impl IntoResponse { + Html( + GraphiQLSource::build() + .endpoint("/") + .subscription_endpoint("/ws") + .finish(), + ) +} + +#[tokio::main] +async fn main() { + let schema = dynamic_books::schema().unwrap(); + let app = Route::new() + .at("/", get(graphiql).post(GraphQL::new(schema.clone()))) + .at("/ws", get(GraphQLSubscription::new(schema))); + + println!("GraphiQL IDE: http://localhost:8000"); + Server::new(TcpListener::bind("127.0.0.1:8000")) + .run(app) + .await + .unwrap(); +} From 6929011fb44a23f0c7f22cf88b9efffbe75e0698 Mon Sep 17 00:00:00 2001 From: gianmarcoalarcon Date: Mon, 14 Aug 2023 21:29:48 +0800 Subject: [PATCH 059/102] Refactor model, add Arc> --- models/dynamic-books/src/lib.rs | 45 ++++++++++++------------------- models/dynamic-books/src/model.rs | 19 ++++++------- 2 files changed, 27 insertions(+), 37 deletions(-) diff --git a/models/dynamic-books/src/lib.rs b/models/dynamic-books/src/lib.rs index ac0e4b0..34e3658 100644 --- a/models/dynamic-books/src/lib.rs +++ b/models/dynamic-books/src/lib.rs @@ -1,22 +1,25 @@ mod model; use async_graphql::ID; +use futures_util::lock::Mutex; pub use model::schema; use slab::Slab; -use std::collections::HashMap; +use std::{collections::HashMap, sync::Arc}; -type Storage = Slab; +type Storage = Arc>>; +type Mapping = Arc>>; #[derive(Clone)] pub struct Book { id: ID, - name: &'static str, - author: &'static str, + name: String, + author: String, } +#[derive(Clone)] pub struct BookStore { store: Storage, - books_by_id: HashMap, + books_by_id: Mapping, value: usize, } impl BookStore { @@ -25,13 +28,13 @@ impl BookStore { let mut store = Slab::new(); let key_1 = store.insert(Book { id: "10".into(), - name: "Luke Skywalker", - author: "Tatooine", + name: "Luke Skywalker".to_string(), + author: "Tatooine".to_string(), }); let key_2 = store.insert(Book { id: 1001.into(), - name: "Anakin Skywalker", - author: "Tatooine", + name: "Anakin Skywalker".to_string(), + author: "Tatooine".to_string(), }); let mut books_by_id = HashMap::new(); @@ -39,27 +42,13 @@ impl BookStore { books_by_id.insert("1001".to_string(), key_2); Self { - store, - books_by_id, + store: Arc::new(Mutex::new(store)), + books_by_id: Arc::new(Mutex::new(books_by_id)), value: 10, } } - pub fn get_book(&self, id: &str) -> Option<&Book> { - self.books_by_id - .get(id) - .and_then(|idx| self.store.get(*idx)) - } - - pub fn get_books(&self) -> Vec<&Book> { - self.store.iter().map(|(_, book)| book).collect() - } - - pub fn create_book(&mut self, id: ID, name: &'static str, author: &'static str) -> &Book { - let id_str = id.to_string(); - let book = Book { id, name, author }; - let key = self.store.insert(book.clone()); - self.books_by_id.insert(id_str, key); - self.store.get(key).unwrap() - } + // pub fn get_book_id(&self, id: &str) -> Option { + // self.books_by_id.get(id).copied() + // } } diff --git a/models/dynamic-books/src/model.rs b/models/dynamic-books/src/model.rs index 59211d0..a4a5844 100644 --- a/models/dynamic-books/src/model.rs +++ b/models/dynamic-books/src/model.rs @@ -19,7 +19,7 @@ pub fn schema() -> Result { Field::new("name", TypeRef::named_nn(TypeRef::STRING), |ctx| { FieldFuture::new(async move { let book = ctx.parent_value.try_downcast_ref::()?; - Ok(Some(Value::from(book.name))) + Ok(Some(Value::from(book.name.to_owned()))) }) }) .description("The name of the book."), @@ -28,7 +28,7 @@ pub fn schema() -> Result { Field::new("author", TypeRef::named_nn(TypeRef::STRING), |ctx| { FieldFuture::new(async move { let book = ctx.parent_value.try_downcast_ref::()?; - Ok(Some(Value::from(book.author))) + Ok(Some(Value::from(book.author.to_owned()))) }) }) .description("The author of the book."), @@ -38,11 +38,12 @@ pub fn schema() -> Result { .field( Field::new("getBook", TypeRef::named(book.type_name()), |ctx| { FieldFuture::new(async move { - let store = ctx.data::().unwrap(); let id = ctx.args.try_get("id")?; - Ok(store - .get_book(id.string()?) - .map(|b| FieldValue::borrowed_any(b))) + let book_by_id = &ctx.data_unchecked::().books_by_id.lock().await; + let book_id = book_by_id.get(id.string()?).unwrap(); + let store = ctx.data_unchecked::().store.lock().await; + let book = store.get(*book_id).cloned(); + Ok(book.map(FieldValue::owned_any)) }) }) .argument(InputValue::new("id", TypeRef::named_nn(TypeRef::STRING))), @@ -52,10 +53,10 @@ pub fn schema() -> Result { TypeRef::named_nn_list_nn(book.type_name()), |ctx| { FieldFuture::new(async move { - let store = ctx.data::().unwrap(); - let books = store.get_books(); + let store = ctx.data_unchecked::().store.lock().await; + let books: Vec = store.iter().map(|(_, book)| book.clone()).collect(); Ok(Some(FieldValue::list( - books.into_iter().map(|b| FieldValue::borrowed_any(b)), + books.into_iter().map(FieldValue::owned_any), ))) }) }, From d06148d268645de5df0c64dc740ba755cf536c49 Mon Sep 17 00:00:00 2001 From: gianmarcoalarcon Date: Mon, 14 Aug 2023 21:39:55 +0800 Subject: [PATCH 060/102] Feat: Add createBook mutation operation --- models/dynamic-books/src/lib.rs | 4 --- models/dynamic-books/src/model.rs | 42 ++++++++++++++++++++++++++----- 2 files changed, 36 insertions(+), 10 deletions(-) diff --git a/models/dynamic-books/src/lib.rs b/models/dynamic-books/src/lib.rs index 34e3658..496abc2 100644 --- a/models/dynamic-books/src/lib.rs +++ b/models/dynamic-books/src/lib.rs @@ -47,8 +47,4 @@ impl BookStore { value: 10, } } - - // pub fn get_book_id(&self, id: &str) -> Option { - // self.books_by_id.get(id).copied() - // } } diff --git a/models/dynamic-books/src/model.rs b/models/dynamic-books/src/model.rs index a4a5844..5bd4612 100644 --- a/models/dynamic-books/src/model.rs +++ b/models/dynamic-books/src/model.rs @@ -62,6 +62,31 @@ pub fn schema() -> Result { }, )); + let mutatation = Object::new("Mutation").field( + Field::new("createBook", TypeRef::named(book.type_name()), |ctx| { + FieldFuture::new(async move { + let mut book_by_id = ctx.data_unchecked::().books_by_id.lock().await; + let mut store = ctx.data_unchecked::().store.lock().await; + let id = ctx.args.try_get("id")?; + let name = ctx.args.try_get("name")?; + let author = ctx.args.try_get("author")?; + let book = Book { + id: id.string()?.into(), + name: name.string()?.to_string(), + author: author.string()?.to_string(), + }; + let key = store.insert(book); + book_by_id.insert(id.string()?.to_string(), key); + Ok(Some(FieldValue::owned_any(store.get(key).unwrap().clone()))) + }) + }) + .argument(InputValue::new("id", TypeRef::named_nn(TypeRef::STRING))) + .argument(InputValue::new("name", TypeRef::named_nn(TypeRef::STRING))) + .argument(InputValue::new( + "author", + TypeRef::named_nn(TypeRef::STRING), + )), + ); // Todo:Show book.value let subscription = Subscription::new("Subscription").field(SubscriptionField::new( "value", @@ -74,10 +99,15 @@ pub fn schema() -> Result { }, )); - Schema::build(query.type_name(), None, Some(subscription.type_name())) - .register(book) - .register(query) - .register(subscription) - .data(BookStore::new()) - .finish() + Schema::build( + query.type_name(), + Some(mutatation.type_name()), + Some(subscription.type_name()), + ) + .register(book) + .register(query) + .register(subscription) + .register(mutatation) + .data(BookStore::new()) + .finish() } From 5c6b6e6d88f8073fd33d7f5f356a40b88a93e55a Mon Sep 17 00:00:00 2001 From: gianmarcoalarcon Date: Mon, 14 Aug 2023 22:46:45 +0800 Subject: [PATCH 061/102] Update subscription --- models/dynamic-books/src/lib.rs | 5 +-- models/dynamic-books/src/model.rs | 63 +++++++++++++++++++------------ poem/dynamic-books/src/main.rs | 4 +- 3 files changed, 42 insertions(+), 30 deletions(-) diff --git a/models/dynamic-books/src/lib.rs b/models/dynamic-books/src/lib.rs index 496abc2..f8a0252 100644 --- a/models/dynamic-books/src/lib.rs +++ b/models/dynamic-books/src/lib.rs @@ -16,11 +16,10 @@ pub struct Book { author: String, } -#[derive(Clone)] pub struct BookStore { store: Storage, books_by_id: Mapping, - value: usize, + value: Arc>, } impl BookStore { #[allow(clippy::new_without_default)] @@ -44,7 +43,7 @@ impl BookStore { Self { store: Arc::new(Mutex::new(store)), books_by_id: Arc::new(Mutex::new(books_by_id)), - value: 10, + value: Arc::new(Mutex::new(10)), } } } diff --git a/models/dynamic-books/src/model.rs b/models/dynamic-books/src/model.rs index 5bd4612..6945c41 100644 --- a/models/dynamic-books/src/model.rs +++ b/models/dynamic-books/src/model.rs @@ -62,38 +62,51 @@ pub fn schema() -> Result { }, )); - let mutatation = Object::new("Mutation").field( - Field::new("createBook", TypeRef::named(book.type_name()), |ctx| { - FieldFuture::new(async move { - let mut book_by_id = ctx.data_unchecked::().books_by_id.lock().await; - let mut store = ctx.data_unchecked::().store.lock().await; - let id = ctx.args.try_get("id")?; - let name = ctx.args.try_get("name")?; - let author = ctx.args.try_get("author")?; - let book = Book { - id: id.string()?.into(), - name: name.string()?.to_string(), - author: author.string()?.to_string(), - }; - let key = store.insert(book); - book_by_id.insert(id.string()?.to_string(), key); - Ok(Some(FieldValue::owned_any(store.get(key).unwrap().clone()))) + let mutatation = Object::new("Mutation") + .field( + Field::new("createBook", TypeRef::named(book.type_name()), |ctx| { + FieldFuture::new(async move { + let mut book_by_id = ctx.data_unchecked::().books_by_id.lock().await; + let mut store = ctx.data_unchecked::().store.lock().await; + let id = ctx.args.try_get("id")?; + let name = ctx.args.try_get("name")?; + let author = ctx.args.try_get("author")?; + let book = Book { + id: id.string()?.into(), + name: name.string()?.to_string(), + author: author.string()?.to_string(), + }; + let key = store.insert(book); + book_by_id.insert(id.string()?.to_string(), key); + Ok(Some(FieldValue::owned_any(store.get(key).unwrap().clone()))) + }) + }) + .argument(InputValue::new("id", TypeRef::named_nn(TypeRef::STRING))) + .argument(InputValue::new("name", TypeRef::named_nn(TypeRef::STRING))) + .argument(InputValue::new( + "author", + TypeRef::named_nn(TypeRef::STRING), + )), + ) + .field( + Field::new("updateValue", TypeRef::named_nn(TypeRef::INT), |ctx| { + FieldFuture::new(async move { + let mut store_value = ctx.data_unchecked::().value.lock().await; + let new_value = ctx.args.try_get("value")?; + let value = new_value.u64()?; + *store_value = value; + Ok(Some(Value::from(*store_value))) + }) }) - }) - .argument(InputValue::new("id", TypeRef::named_nn(TypeRef::STRING))) - .argument(InputValue::new("name", TypeRef::named_nn(TypeRef::STRING))) - .argument(InputValue::new( - "author", - TypeRef::named_nn(TypeRef::STRING), - )), - ); + .argument(InputValue::new("value", TypeRef::named_nn(TypeRef::INT))), + ); // Todo:Show book.value let subscription = Subscription::new("Subscription").field(SubscriptionField::new( "value", TypeRef::named_nn(TypeRef::INT), |ctx| { SubscriptionFieldFuture::new(async move { - let value_1 = ctx.data_unchecked::().value; + let value_1: u64 = *ctx.data_unchecked::().value.lock().await; Ok(futures_util::stream::repeat(value_1).map(|value| Ok(Value::from(value)))) }) }, diff --git a/poem/dynamic-books/src/main.rs b/poem/dynamic-books/src/main.rs index c02b219..de2040d 100644 --- a/poem/dynamic-books/src/main.rs +++ b/poem/dynamic-books/src/main.rs @@ -19,8 +19,8 @@ async fn main() { .at("/", get(graphiql).post(GraphQL::new(schema.clone()))) .at("/ws", get(GraphQLSubscription::new(schema))); - println!("GraphiQL IDE: http://localhost:8000"); - Server::new(TcpListener::bind("127.0.0.1:8000")) + println!("GraphiQL IDE: http://localhost:8080"); + Server::new(TcpListener::bind("127.0.0.1:8080")) .run(app) .await .unwrap(); From 2d21325566bf07a14ca6b3727354f1ba838438ab Mon Sep 17 00:00:00 2001 From: Sunli Date: Tue, 15 Aug 2023 16:30:33 +0800 Subject: [PATCH 062/102] add dynamic schema examples for federaion --- Cargo.toml | 12 +- federation/{ => dynamic-schema}/README.md | 0 .../federation-accounts/Cargo.toml | 10 + .../federation-accounts/src/main.rs | 172 +++++++++ .../federation-products/Cargo.toml | 10 + .../federation-products/src/main.rs | 114 ++++++ .../federation-reviews/Cargo.toml | 10 + .../federation-reviews/src/main.rs | 349 ++++++++++++++++++ federation/{ => dynamic-schema}/query.graphql | 0 federation/{ => dynamic-schema}/start.sh | 12 +- federation/static-schema/README.md | 16 + .../{ => static-schema}/directives/Cargo.toml | 2 +- .../{ => static-schema}/directives/src/lib.rs | 0 .../federation-accounts}/Cargo.toml | 6 +- .../federation-accounts/src/main.rs | 0 .../federation-products}/Cargo.toml | 6 +- .../federation-products/src/main.rs | 0 .../federation-reviews}/Cargo.toml | 6 +- .../federation-reviews/src/main.rs | 0 federation/static-schema/query.graphql | 19 + federation/static-schema/start.sh | 36 ++ 21 files changed, 760 insertions(+), 20 deletions(-) rename federation/{ => dynamic-schema}/README.md (100%) create mode 100644 federation/dynamic-schema/federation-accounts/Cargo.toml create mode 100644 federation/dynamic-schema/federation-accounts/src/main.rs create mode 100644 federation/dynamic-schema/federation-products/Cargo.toml create mode 100644 federation/dynamic-schema/federation-products/src/main.rs create mode 100644 federation/dynamic-schema/federation-reviews/Cargo.toml create mode 100644 federation/dynamic-schema/federation-reviews/src/main.rs rename federation/{ => dynamic-schema}/query.graphql (100%) rename federation/{ => dynamic-schema}/start.sh (64%) mode change 100755 => 100644 create mode 100644 federation/static-schema/README.md rename federation/{ => static-schema}/directives/Cargo.toml (77%) rename federation/{ => static-schema}/directives/src/lib.rs (100%) rename federation/{federation-products => static-schema/federation-accounts}/Cargo.toml (63%) rename federation/{ => static-schema}/federation-accounts/src/main.rs (100%) rename federation/{federation-reviews => static-schema/federation-products}/Cargo.toml (63%) rename federation/{ => static-schema}/federation-products/src/main.rs (100%) rename federation/{federation-accounts => static-schema/federation-reviews}/Cargo.toml (63%) rename federation/{ => static-schema}/federation-reviews/src/main.rs (100%) create mode 100644 federation/static-schema/query.graphql create mode 100644 federation/static-schema/start.sh diff --git a/Cargo.toml b/Cargo.toml index 0e055e7..4018390 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,10 +25,6 @@ members = [ "warp/subscription", "warp/token-from-header", - "federation/federation-accounts", - "federation/federation-products", - "federation/federation-reviews", - "rocket/starwars", "rocket/upload", @@ -41,4 +37,12 @@ members = [ "tide/dataloader", "tide/dataloader-postgres", "tide/subscription", + + "federation/static-schema/federation-accounts", + "federation/static-schema/federation-products", + "federation/static-schema/federation-reviews", + + "federation/dynamic-schema/federation-accounts", + "federation/dynamic-schema/federation-products", + "federation/dynamic-schema/federation-reviews", ] diff --git a/federation/README.md b/federation/dynamic-schema/README.md similarity index 100% rename from federation/README.md rename to federation/dynamic-schema/README.md diff --git a/federation/dynamic-schema/federation-accounts/Cargo.toml b/federation/dynamic-schema/federation-accounts/Cargo.toml new file mode 100644 index 0000000..85c905e --- /dev/null +++ b/federation/dynamic-schema/federation-accounts/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "dynamic-federation-accounts" +version = "0.1.0" +edition = "2021" + +[dependencies] +async-graphql = { path = "../../../..", features = ["dynamic-schema"] } +async-graphql-poem = { path = "../../../../integrations/poem" } +tokio = { version = "1.0.2", features = ["macros", "rt-multi-thread"] } +poem = { version = "1.3.43" } diff --git a/federation/dynamic-schema/federation-accounts/src/main.rs b/federation/dynamic-schema/federation-accounts/src/main.rs new file mode 100644 index 0000000..7da9a2f --- /dev/null +++ b/federation/dynamic-schema/federation-accounts/src/main.rs @@ -0,0 +1,172 @@ +use async_graphql::dynamic::{ + Field, FieldFuture, FieldValue, Object, Schema, SchemaError, TypeRef, +}; +use async_graphql_poem::GraphQL; +use poem::{listener::TcpListener, Route, Server}; + +struct Picture { + url: String, + width: u32, + height: u32, +} + +struct User { + id: String, + username: String, + profile_picture: Option, + review_count: u32, + joined_timestamp: u64, +} + +impl User { + fn me() -> User { + User { + id: "1234".into(), + username: "Me".to_string(), + profile_picture: Some(Picture { + url: "http://localhost:8080/me.jpg".to_string(), + width: 256, + height: 256, + }), + review_count: 0, + joined_timestamp: 1, + } + } +} + +fn schema() -> Result { + let picture = Object::new("Picture") + .field(Field::new( + "url", + TypeRef::named_nn(TypeRef::STRING), + |ctx| { + FieldFuture::new(async move { + let picture = ctx.parent_value.try_downcast_ref::()?; + Ok(Some(FieldValue::value(&picture.url))) + }) + }, + )) + .field(Field::new( + "width", + TypeRef::named_nn(TypeRef::INT), + |ctx| { + FieldFuture::new(async move { + let picture = ctx.parent_value.try_downcast_ref::()?; + Ok(Some(FieldValue::value(picture.width))) + }) + }, + )) + .field(Field::new( + "height", + TypeRef::named_nn(TypeRef::INT), + |ctx| { + FieldFuture::new(async move { + let picture = ctx.parent_value.try_downcast_ref::()?; + Ok(Some(FieldValue::value(picture.height))) + }) + }, + )); + + let user = Object::new("User") + .field(Field::new("id", TypeRef::named_nn(TypeRef::ID), |ctx| { + FieldFuture::new(async move { + let user = ctx.parent_value.try_downcast_ref::()?; + Ok(Some(FieldValue::value(&user.id))) + }) + })) + .field(Field::new( + "username", + TypeRef::named_nn(TypeRef::STRING), + |ctx| { + FieldFuture::new(async move { + let user = ctx.parent_value.try_downcast_ref::()?; + Ok(Some(FieldValue::value(&user.username))) + }) + }, + )) + .field(Field::new( + "profilePicture", + TypeRef::named_nn(TypeRef::STRING), + |ctx| { + FieldFuture::new(async move { + let user = ctx.parent_value.try_downcast_ref::()?; + Ok(user + .profile_picture + .as_ref() + .map(|profile_picture| FieldValue::borrowed_any(profile_picture))) + }) + }, + )) + .field(Field::new( + "reviewCount", + TypeRef::named_nn(TypeRef::INT), + |ctx| { + FieldFuture::new(async move { + let user = ctx.parent_value.try_downcast_ref::()?; + Ok(Some(FieldValue::value(user.review_count))) + }) + }, + )) + .field(Field::new( + "joinedTimestamp", + TypeRef::named_nn(TypeRef::STRING), + |ctx| { + FieldFuture::new(async move { + let user = ctx.parent_value.try_downcast_ref::()?; + Ok(Some(FieldValue::value(user.joined_timestamp.to_string()))) + }) + }, + )) + .key("id"); + + let query = Object::new("Query").field(Field::new( + "me", + TypeRef::named_nn(user.type_name()), + |_| FieldFuture::new(async move { Ok(Some(FieldValue::owned_any(User::me()))) }), + )); + + Schema::build("Query", None, None) + .register(picture) + .register(user) + .register(query) + .entity_resolver(|ctx| { + FieldFuture::new(async move { + let representations = ctx.args.try_get("representations")?.list()?; + let mut values = Vec::new(); + + for item in representations.iter() { + let item = item.object()?; + let typename = item + .try_get("__typename") + .and_then(|value| value.string())?; + + if typename == "User" { + let id = item.try_get("id")?.string()?; + if id == "1234" { + values.push(FieldValue::owned_any(User::me())); + } else { + let username = format!("User {}", id); + let user = User { + id: id.to_string(), + username, + profile_picture: None, + review_count: 0, + joined_timestamp: 1500, + }; + values.push(FieldValue::owned_any(user)); + } + } + } + + Ok(Some(FieldValue::list(values))) + }) + }) + .finish() +} + +#[tokio::main] +async fn main() -> std::io::Result<()> { + Server::new(TcpListener::bind("127.0.0.1:4001")) + .run(Route::new().at("/", GraphQL::new(schema().unwrap()))) + .await +} diff --git a/federation/dynamic-schema/federation-products/Cargo.toml b/federation/dynamic-schema/federation-products/Cargo.toml new file mode 100644 index 0000000..82cddc5 --- /dev/null +++ b/federation/dynamic-schema/federation-products/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "dynamic-federation-products" +version = "0.1.0" +edition = "2021" + +[dependencies] +async-graphql = { path = "../../../..", features = ["dynamic-schema"] } +async-graphql-poem = { path = "../../../../integrations/poem" } +tokio = { version = "1.0.2", features = ["macros", "rt-multi-thread"] } +poem = { version = "1.3.43" } diff --git a/federation/dynamic-schema/federation-products/src/main.rs b/federation/dynamic-schema/federation-products/src/main.rs new file mode 100644 index 0000000..d200bd7 --- /dev/null +++ b/federation/dynamic-schema/federation-products/src/main.rs @@ -0,0 +1,114 @@ +use async_graphql::dynamic::{ + Field, FieldFuture, FieldValue, Object, Schema, SchemaError, TypeRef, +}; +use async_graphql_poem::GraphQL; +use poem::{listener::TcpListener, Route, Server}; + +struct Product { + upc: String, + name: String, + price: i32, +} + +fn schema() -> Result { + let hats = vec![ + Product { + upc: "top-1".to_string(), + name: "Trilby".to_string(), + price: 11, + }, + Product { + upc: "top-2".to_string(), + name: "Fedora".to_string(), + price: 22, + }, + Product { + upc: "top-3".to_string(), + name: "Boater".to_string(), + price: 33, + }, + ]; + + let product = Object::new("Product") + .field(Field::new( + "upc", + TypeRef::named_nn(TypeRef::STRING), + |ctx| { + FieldFuture::new(async move { + let product = ctx.parent_value.try_downcast_ref::()?; + Ok(Some(FieldValue::value(&product.upc))) + }) + }, + )) + .field(Field::new( + "name", + TypeRef::named_nn(TypeRef::STRING), + |ctx| { + FieldFuture::new(async move { + let product = ctx.parent_value.try_downcast_ref::()?; + Ok(Some(FieldValue::value(&product.name))) + }) + }, + )) + .field( + Field::new("price", TypeRef::named_nn(TypeRef::INT), |ctx| { + FieldFuture::new(async move { + let product = ctx.parent_value.try_downcast_ref::()?; + Ok(Some(FieldValue::value(product.price))) + }) + }) + .shareable(), + ) + .key("upc"); + + let query = Object::new("Query").field(Field::new( + "topProducts", + TypeRef::named_nn_list_nn(product.type_name()), + |ctx| { + FieldFuture::new(async move { + let mut values = Vec::new(); + let products = ctx.data_unchecked::>(); + for product in products { + values.push(FieldValue::borrowed_any(product)); + } + Ok(Some(values)) + }) + }, + )); + + Schema::build("Query", None, None) + .data(hats) + .register(product) + .register(query) + .entity_resolver(|ctx| { + FieldFuture::new(async move { + let products = ctx.data_unchecked::>(); + let representations = ctx.args.try_get("representations")?.list()?; + let mut values = Vec::new(); + + for item in representations.iter() { + let item = item.object()?; + let typename = item + .try_get("__typename") + .and_then(|value| value.string())?; + + if typename == "Product" { + let upc = item.try_get("upc")?.string()?; + if let Some(product) = products.iter().find(|product| product.upc == upc) { + values.push(FieldValue::borrowed_any(product)); + } + } + } + + Ok(Some(FieldValue::list(values))) + }) + }) + .finish() +} + +#[tokio::main] +async fn main() -> std::io::Result<()> { + Server::new(TcpListener::bind("127.0.0.1:4002")) + .run(Route::new().at("/", GraphQL::new(schema().unwrap()))) + .await +} diff --git a/federation/dynamic-schema/federation-reviews/Cargo.toml b/federation/dynamic-schema/federation-reviews/Cargo.toml new file mode 100644 index 0000000..912ba03 --- /dev/null +++ b/federation/dynamic-schema/federation-reviews/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "dynamic-federation-reviews" +version = "0.1.0" +edition = "2021" + +[dependencies] +async-graphql = { path = "../../../..", features = ["dynamic-schema"] } +async-graphql-poem = { path = "../../../../integrations/poem" } +tokio = { version = "1.0.2", features = ["macros", "rt-multi-thread"] } +poem = { version = "1.3.43" } diff --git a/federation/dynamic-schema/federation-reviews/src/main.rs b/federation/dynamic-schema/federation-reviews/src/main.rs new file mode 100644 index 0000000..ccbbaa5 --- /dev/null +++ b/federation/dynamic-schema/federation-reviews/src/main.rs @@ -0,0 +1,349 @@ +use async_graphql::dynamic::{ + Enum, Field, FieldFuture, FieldValue, Object, Schema, SchemaError, TypeRef, +}; +use async_graphql_poem::GraphQL; +use poem::{listener::TcpListener, Route, Server}; + +struct Picture { + url: String, + width: u32, + height: u32, + alt_text: String, +} + +struct Review { + id: String, + body: String, + pictures: Vec, +} + +struct Product { + upc: String, + price: u32, +} + +impl Review { + fn get_product(&self) -> Product { + match self.id.as_str() { + "review-1" => Product { + upc: "top-1".to_string(), + price: 10, + }, + "review-2" => Product { + upc: "top-2".to_string(), + price: 20, + }, + "review-3" => Product { + upc: "top-3".to_string(), + price: 30, + }, + _ => panic!("Unknown review id"), + } + } + + fn get_author(&self) -> User { + let user_id = match self.id.as_str() { + "review-1" => "1234", + "review-2" => "1234", + "review-3" => "7777", + _ => panic!("Unknown review id"), + } + .to_string(); + user_by_id(user_id, None) + } +} + +struct User { + id: String, + review_count: u32, + joined_timestamp: u64, +} + +fn user_by_id(id: String, joined_timestamp: Option) -> User { + let review_count = match id.as_str() { + "1234" => 2, + "7777" => 1, + _ => 0, + }; + // This will be set if the user requested the fields that require it. + let joined_timestamp = joined_timestamp.unwrap_or(9001); + User { + id, + review_count, + joined_timestamp, + } +} + +fn schema() -> Result { + let picture = Object::new("Picture") + .shareable() + .field(Field::new( + "url", + TypeRef::named_nn(TypeRef::STRING), + |ctx| { + FieldFuture::new(async move { + let picture = ctx.parent_value.try_downcast_ref::()?; + Ok(Some(FieldValue::value(&picture.url))) + }) + }, + )) + .field(Field::new( + "width", + TypeRef::named_nn(TypeRef::INT), + |ctx| { + FieldFuture::new(async move { + let picture = ctx.parent_value.try_downcast_ref::()?; + Ok(Some(FieldValue::value(picture.width))) + }) + }, + )) + .field(Field::new( + "height", + TypeRef::named_nn(TypeRef::INT), + |ctx| { + FieldFuture::new(async move { + let picture = ctx.parent_value.try_downcast_ref::()?; + Ok(Some(FieldValue::value(picture.height))) + }) + }, + )) + .field( + Field::new("altText", TypeRef::named_nn(TypeRef::INT), |ctx| { + FieldFuture::new(async move { + let picture = ctx.parent_value.try_downcast_ref::()?; + Ok(Some(FieldValue::value(&picture.alt_text))) + }) + }) + .inaccessible(), + ); + + let review = Object::new("Review") + .field(Field::new("id", TypeRef::named_nn(TypeRef::ID), |ctx| { + FieldFuture::new(async move { + let review = ctx.parent_value.try_downcast_ref::()?; + Ok(Some(FieldValue::value(&review.id))) + }) + })) + .field(Field::new( + "body", + TypeRef::named_nn(TypeRef::STRING), + |ctx| { + FieldFuture::new(async move { + let review = ctx.parent_value.try_downcast_ref::()?; + Ok(Some(FieldValue::value(&review.body))) + }) + }, + )) + .field(Field::new( + "pictures", + TypeRef::named_nn_list_nn(picture.type_name()), + |ctx| { + FieldFuture::new(async move { + let review = ctx.parent_value.try_downcast_ref::()?; + Ok(Some(FieldValue::list( + review + .pictures + .iter() + .map(|picture| FieldValue::borrowed_any(picture)), + ))) + }) + }, + )) + .field( + Field::new("product", TypeRef::named_nn(TypeRef::STRING), |ctx| { + FieldFuture::new(async move { + let review = ctx.parent_value.try_downcast_ref::()?; + Ok(Some(FieldValue::owned_any(review.get_product()))) + }) + }) + .provides("price"), + ) + .field(Field::new("author", TypeRef::named_nn("User"), |ctx| { + FieldFuture::new(async move { + let review = ctx.parent_value.try_downcast_ref::()?; + let author = review.get_author(); + Ok(Some(FieldValue::owned_any(author))) + }) + })); + + let trust_worthiness = + Enum::new("Trustworthiness").items(["ReallyTrusted", "KindaTrusted", "NotTrusted"]); + + let user = Object::new("User") + .field(Field::new("id", TypeRef::named_nn(TypeRef::ID), |ctx| { + FieldFuture::new(async move { + let user = ctx.parent_value.try_downcast_ref::()?; + Ok(Some(FieldValue::value(&user.id))) + }) + })) + .field( + Field::new("reviewCount", TypeRef::named_nn(TypeRef::INT), |ctx| { + FieldFuture::new(async move { + let user = ctx.parent_value.try_downcast_ref::()?; + Ok(Some(FieldValue::value(user.review_count))) + }) + }) + .override_from("accounts"), + ) + .field( + Field::new("joinedTimestamp", TypeRef::named_nn(TypeRef::INT), |ctx| { + FieldFuture::new(async move { + let user = ctx.parent_value.try_downcast_ref::()?; + Ok(Some(FieldValue::value(user.joined_timestamp))) + }) + }) + .external(), + ) + .field(Field::new( + "reviews", + TypeRef::named_nn_list_nn(review.type_name()), + |ctx| { + FieldFuture::new(async move { + let reviews = ctx.data::>()?; + Ok(Some(FieldValue::list( + reviews + .iter() + .map(|review| FieldValue::borrowed_any(review)), + ))) + }) + }, + )) + .field( + Field::new( + "trustworthiness", + TypeRef::named_nn_list_nn(review.type_name()), + |ctx| { + FieldFuture::new(async move { + let user = ctx.parent_value.try_downcast_ref::()?; + Ok(Some( + if user.joined_timestamp < 1_000 && user.review_count > 1 { + FieldValue::value("ReallyTrusted") + } else if user.joined_timestamp < 2_000 { + FieldValue::value("KindaTrusted") + } else { + FieldValue::value("NotTrusted") + }, + )) + }) + }, + ) + .requires("joinedTimestamp"), + ) + .key("id"); + + let product = Object::new("Product") + .field(Field::new("upc", TypeRef::named_nn(TypeRef::ID), |ctx| { + FieldFuture::new(async move { + let product = ctx.parent_value.try_downcast_ref::()?; + Ok(Some(FieldValue::value(&product.upc))) + }) + })) + .field( + Field::new("price", TypeRef::named_nn(TypeRef::INT), |ctx| { + FieldFuture::new(async move { + let product = ctx.parent_value.try_downcast_ref::()?; + Ok(Some(FieldValue::value(product.price))) + }) + }) + .external(), + ) + .field(Field::new( + "reviews", + TypeRef::named_nn_list_nn(review.type_name()), + |ctx| { + FieldFuture::new(async move { + let user = ctx.parent_value.try_downcast_ref::()?; + let reviews = ctx.data::>()?; + Ok(Some(FieldValue::list( + reviews + .iter() + .filter(|review| review.get_author().id == user.id) + .map(|review| FieldValue::borrowed_any(review)), + ))) + }) + }, + )) + .key("upc"); + + let reviews = vec![ + Review { + id: "review-1".into(), + body: "A highly effective form of birth control.".into(), + pictures: vec![ + Picture { + url: "http://localhost:8080/ugly_hat.jpg".to_string(), + width: 100, + height: 100, + alt_text: "A Trilby".to_string(), + }, + Picture { + url: "http://localhost:8080/troll_face.jpg".to_string(), + width: 42, + height: 42, + alt_text: "The troll face meme".to_string(), + }, + ], + }, + Review { + id: "review-2".into(), + body: "Fedoras are one of the most fashionable hats around and can look great with a variety of outfits.".into(), + pictures: vec![], + }, + Review { + id: "review-3".into(), + body: "This is the last straw. Hat you will wear. 11/10".into(), + pictures: vec![], + }, + ]; + + let query = Object::new("Query"); + + Schema::build("Query", None, None) + .data(reviews) + .register(picture) + .register(review) + .register(trust_worthiness) + .register(user) + .register(product) + .register(query) + .entity_resolver(|ctx| { + FieldFuture::new(async move { + let representations = ctx.args.try_get("representations")?.list()?; + let mut values = Vec::new(); + + for item in representations.iter() { + let item = item.object()?; + let typename = item + .try_get("__typename") + .and_then(|value| value.string())?; + + if typename == "User" { + let id = item.try_get("id")?.string()?; + let joined_timestamp = item + .get("joinedTimestamp") + .and_then(|value| value.u64().ok()); + values.push(FieldValue::owned_any(user_by_id( + id.to_string(), + joined_timestamp, + ))); + } else if typename == "Product" { + let upc = item.try_get("upc")?.string()?; + values.push(FieldValue::owned_any(Product { + upc: upc.to_string(), + price: 0, + })); + } + } + + Ok(Some(FieldValue::list(values))) + }) + }) + .finish() +} + +#[tokio::main] +async fn main() -> std::io::Result<()> { + Server::new(TcpListener::bind("127.0.0.1:4003")) + .run(Route::new().at("/", GraphQL::new(schema().unwrap()))) + .await +} diff --git a/federation/query.graphql b/federation/dynamic-schema/query.graphql similarity index 100% rename from federation/query.graphql rename to federation/dynamic-schema/query.graphql diff --git a/federation/start.sh b/federation/dynamic-schema/start.sh old mode 100755 new mode 100644 similarity index 64% rename from federation/start.sh rename to federation/dynamic-schema/start.sh index 35c3a04..6bb75b1 --- a/federation/start.sh +++ b/federation/dynamic-schema/start.sh @@ -11,17 +11,17 @@ function cleanup { } trap cleanup EXIT -cargo build --bin federation-accounts -cargo build --bin federation-products -cargo build --bin federation-reviews +cargo build --bin static-federation-accounts +cargo build --bin static-federation-products +cargo build --bin static-federation-reviews -cargo run --bin federation-accounts & +cargo run --bin static-federation-accounts & ACCOUNTS_PID=$! -cargo run --bin federation-products & +cargo run --bin static-federation-products & PRODUCTS_PID=$! -cargo run --bin federation-reviews & +cargo run --bin static-federation-reviews & REVIEWS_PID=$! sleep 3 diff --git a/federation/static-schema/README.md b/federation/static-schema/README.md new file mode 100644 index 0000000..ceb95a4 --- /dev/null +++ b/federation/static-schema/README.md @@ -0,0 +1,16 @@ +# Federation Example + +An example of using [Apollo Federation](https://www.apollographql.com/docs/federation/) to compose GraphQL services into a single data graph. + +## The schema + +You can view the full schema in [Apollo Studio](https://studio.apollographql.com/public/async-graphql-Examples/home?variant=current) without needing to run the example (you will need to run the example in order to query it). + +## How to run + +1. Install [Rover](https://www.apollographql.com/docs/rover/) +2. Run `/start.sh` which will: + 1. Start each subgraph with `cargo run --bin {subgraph_name}` + 2. Add each subgraph to `rover dev` with `rover dev --url http://localhost:{port} --name {subgraph_name}` +3. Visit `http://localhost:3000` in a browser. +4. You can now run queries like the one in `query.graphql` against the router. diff --git a/federation/directives/Cargo.toml b/federation/static-schema/directives/Cargo.toml similarity index 77% rename from federation/directives/Cargo.toml rename to federation/static-schema/directives/Cargo.toml index 77417e5..b8014a8 100644 --- a/federation/directives/Cargo.toml +++ b/federation/static-schema/directives/Cargo.toml @@ -5,5 +5,5 @@ authors = ["sunli "] edition = "2021" [dependencies] -async-graphql = { path = "../../.." } +async-graphql = { path = "../../../.." } async-trait = "0.1.61" diff --git a/federation/directives/src/lib.rs b/federation/static-schema/directives/src/lib.rs similarity index 100% rename from federation/directives/src/lib.rs rename to federation/static-schema/directives/src/lib.rs diff --git a/federation/federation-products/Cargo.toml b/federation/static-schema/federation-accounts/Cargo.toml similarity index 63% rename from federation/federation-products/Cargo.toml rename to federation/static-schema/federation-accounts/Cargo.toml index 1277849..ba1ba79 100644 --- a/federation/federation-products/Cargo.toml +++ b/federation/static-schema/federation-accounts/Cargo.toml @@ -1,12 +1,12 @@ [package] -name = "federation-products" +name = "static-federation-accounts" version = "0.2.0" authors = ["sunli "] edition = "2021" [dependencies] -async-graphql = { path = "../../.." } -async-graphql-poem = { path = "../../../integrations/poem" } +async-graphql = { path = "../../../.." } +async-graphql-poem = { path = "../../../../integrations/poem" } directives = { path = "../directives" } tokio = { version = "1.0.2", features = ["macros", "rt-multi-thread"] } poem = { version = "1.3.43" } diff --git a/federation/federation-accounts/src/main.rs b/federation/static-schema/federation-accounts/src/main.rs similarity index 100% rename from federation/federation-accounts/src/main.rs rename to federation/static-schema/federation-accounts/src/main.rs diff --git a/federation/federation-reviews/Cargo.toml b/federation/static-schema/federation-products/Cargo.toml similarity index 63% rename from federation/federation-reviews/Cargo.toml rename to federation/static-schema/federation-products/Cargo.toml index 8fbffb5..c276979 100644 --- a/federation/federation-reviews/Cargo.toml +++ b/federation/static-schema/federation-products/Cargo.toml @@ -1,12 +1,12 @@ [package] -name = "federation-reviews" +name = "static-federation-products" version = "0.2.0" authors = ["sunli "] edition = "2021" [dependencies] -async-graphql = { path = "../../.." } -async-graphql-poem = { path = "../../../integrations/poem" } +async-graphql = { path = "../../../.." } +async-graphql-poem = { path = "../../../../integrations/poem" } directives = { path = "../directives" } tokio = { version = "1.0.2", features = ["macros", "rt-multi-thread"] } poem = { version = "1.3.43" } diff --git a/federation/federation-products/src/main.rs b/federation/static-schema/federation-products/src/main.rs similarity index 100% rename from federation/federation-products/src/main.rs rename to federation/static-schema/federation-products/src/main.rs diff --git a/federation/federation-accounts/Cargo.toml b/federation/static-schema/federation-reviews/Cargo.toml similarity index 63% rename from federation/federation-accounts/Cargo.toml rename to federation/static-schema/federation-reviews/Cargo.toml index 376dfe7..74b63a7 100644 --- a/federation/federation-accounts/Cargo.toml +++ b/federation/static-schema/federation-reviews/Cargo.toml @@ -1,12 +1,12 @@ [package] -name = "federation-accounts" +name = "static-federation-reviews" version = "0.2.0" authors = ["sunli "] edition = "2021" [dependencies] -async-graphql = { path = "../../.." } -async-graphql-poem = { path = "../../../integrations/poem" } +async-graphql = { path = "../../../.." } +async-graphql-poem = { path = "../../../../integrations/poem" } directives = { path = "../directives" } tokio = { version = "1.0.2", features = ["macros", "rt-multi-thread"] } poem = { version = "1.3.43" } diff --git a/federation/federation-reviews/src/main.rs b/federation/static-schema/federation-reviews/src/main.rs similarity index 100% rename from federation/federation-reviews/src/main.rs rename to federation/static-schema/federation-reviews/src/main.rs diff --git a/federation/static-schema/query.graphql b/federation/static-schema/query.graphql new file mode 100644 index 0000000..35c656a --- /dev/null +++ b/federation/static-schema/query.graphql @@ -0,0 +1,19 @@ +query ExampleQuery { + me { + id + username @lowercase + reviews { + body + ... @defer { + product { + reviews { + author { + username + } + body + } + } + } + } + } +} \ No newline at end of file diff --git a/federation/static-schema/start.sh b/federation/static-schema/start.sh new file mode 100644 index 0000000..0c931dd --- /dev/null +++ b/federation/static-schema/start.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +set -eumo pipefail + +function cleanup { + kill "$PRODUCTS_ROVER_PID" + kill "$REVIEWS_ROVER_PID" + kill "$ACCOUNTS_PID" + kill "$PRODUCTS_PID" + kill "$REVIEWS_PID" +} +trap cleanup EXIT + +cargo build --bin dynamic-federation-accounts +cargo build --bin dynamic-federation-products +cargo build --bin dynamic-federation-reviews + +cargo run --bin dynamic-federation-accounts & +ACCOUNTS_PID=$! + +cargo run --bin dynamic-federation-products & +PRODUCTS_PID=$! + +cargo run --bin dynamic-federation-reviews & +REVIEWS_PID=$! + +sleep 3 + +rover dev --url http://localhost:4001 --name accounts & +sleep 1 +rover dev --url http://localhost:4002 --name products & +PRODUCTS_ROVER_PID=$! +sleep 1 +rover dev --url http://localhost:4003 --name reviews & +REVIEWS_ROVER_PID=$! +fg %4 \ No newline at end of file From 26b836a092e4ba05cffe7823e1a5b23b276721e4 Mon Sep 17 00:00:00 2001 From: gianmarcoalarcon Date: Fri, 18 Aug 2023 19:07:48 +0800 Subject: [PATCH 063/102] Add bookAdded subscription operation --- models/dynamic-books/src/lib.rs | 1 + models/dynamic-books/src/model.rs | 19 ++++--- models/dynamic-books/src/simple_broker.rs | 68 +++++++++++++++++++++++ 3 files changed, 80 insertions(+), 8 deletions(-) create mode 100644 models/dynamic-books/src/simple_broker.rs diff --git a/models/dynamic-books/src/lib.rs b/models/dynamic-books/src/lib.rs index f8a0252..801e087 100644 --- a/models/dynamic-books/src/lib.rs +++ b/models/dynamic-books/src/lib.rs @@ -1,4 +1,5 @@ mod model; +mod simple_broker; use async_graphql::ID; use futures_util::lock::Mutex; diff --git a/models/dynamic-books/src/model.rs b/models/dynamic-books/src/model.rs index 6945c41..ba39e4e 100644 --- a/models/dynamic-books/src/model.rs +++ b/models/dynamic-books/src/model.rs @@ -1,7 +1,10 @@ use async_graphql::{dynamic::*, Value}; use futures_util::StreamExt; -use crate::{Book, BookStore}; +use crate::{ + simple_broker::{self, SimpleBroker}, + Book, BookStore, +}; pub fn schema() -> Result { let book = Object::new("Book") @@ -76,8 +79,9 @@ pub fn schema() -> Result { name: name.string()?.to_string(), author: author.string()?.to_string(), }; - let key = store.insert(book); + let key = store.insert(book.clone()); book_by_id.insert(id.string()?.to_string(), key); + SimpleBroker::publish(book); Ok(Some(FieldValue::owned_any(store.get(key).unwrap().clone()))) }) }) @@ -102,12 +106,11 @@ pub fn schema() -> Result { ); // Todo:Show book.value let subscription = Subscription::new("Subscription").field(SubscriptionField::new( - "value", - TypeRef::named_nn(TypeRef::INT), - |ctx| { - SubscriptionFieldFuture::new(async move { - let value_1: u64 = *ctx.data_unchecked::().value.lock().await; - Ok(futures_util::stream::repeat(value_1).map(|value| Ok(Value::from(value)))) + "bookAdded", + TypeRef::named_nn(book.type_name()), + |_| { + SubscriptionFieldFuture::new(async { + Ok(SimpleBroker::::subscribe().map(|book| Ok(FieldValue::owned_any(book)))) }) }, )); diff --git a/models/dynamic-books/src/simple_broker.rs b/models/dynamic-books/src/simple_broker.rs new file mode 100644 index 0000000..6b23e70 --- /dev/null +++ b/models/dynamic-books/src/simple_broker.rs @@ -0,0 +1,68 @@ +use std::{ + any::{Any, TypeId}, + collections::HashMap, + marker::PhantomData, + pin::Pin, + sync::Mutex, + task::{Context, Poll}, +}; + +use futures_channel::mpsc::{self, UnboundedReceiver, UnboundedSender}; +use futures_util::{Stream, StreamExt}; +use once_cell::sync::Lazy; +use slab::Slab; + +static SUBSCRIBERS: Lazy>>> = Lazy::new(Default::default); + +struct Senders(Slab>); + +struct BrokerStream(usize, UnboundedReceiver); + +fn with_senders(f: F) -> R +where + T: Sync + Send + Clone + 'static, + F: FnOnce(&mut Senders) -> R, +{ + let mut map = SUBSCRIBERS.lock().unwrap(); + let senders = map + .entry(TypeId::of::>()) + .or_insert_with(|| Box::new(Senders::(Default::default()))); + f(senders.downcast_mut::>().unwrap()) +} + +impl Drop for BrokerStream { + fn drop(&mut self) { + with_senders::(|senders| senders.0.remove(self.0)); + } +} + +impl Stream for BrokerStream { + type Item = T; + + fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { + self.1.poll_next_unpin(cx) + } +} + +/// A simple broker based on memory +pub struct SimpleBroker(PhantomData); + +impl SimpleBroker { + /// Publish a message that all subscription streams can receive. + pub fn publish(msg: T) { + with_senders::(|senders| { + for (_, sender) in senders.0.iter_mut() { + sender.start_send(msg.clone()).ok(); + } + }); + } + + /// Subscribe to the message of the specified type and returns a `Stream`. + pub fn subscribe() -> impl Stream { + with_senders::(|senders| { + let (tx, rx) = mpsc::unbounded(); + let id = senders.0.insert(tx); + BrokerStream(id, rx) + }) + } +} From 08e6376500206050f13bad817d66ea86d4a6bf98 Mon Sep 17 00:00:00 2001 From: Sunli Date: Sat, 19 Aug 2023 11:11:10 +0800 Subject: [PATCH 064/102] update examples --- actix-web/error-extensions/src/main.rs | 24 +++++++++--------------- actix-web/starwars/src/main.rs | 25 ++++++++++++------------- actix-web/subscription/src/main.rs | 23 +++++++++++------------ axum/starwars/src/main.rs | 16 +++------------- axum/subscription/src/main.rs | 17 +++++++---------- axum/token-from-header/src/main.rs | 8 ++++---- axum/upload/src/main.rs | 12 +++--------- tide/subscription/src/main.rs | 2 +- 8 files changed, 50 insertions(+), 77 deletions(-) diff --git a/actix-web/error-extensions/src/main.rs b/actix-web/error-extensions/src/main.rs index fb24e0b..c84c955 100644 --- a/actix-web/error-extensions/src/main.rs +++ b/actix-web/error-extensions/src/main.rs @@ -1,12 +1,12 @@ #[macro_use] extern crate thiserror; -use actix_web::{guard, web, web::Data, App, HttpResponse, HttpServer}; +use actix_web::{guard, web, App, HttpResponse, HttpServer}; use async_graphql::{ http::GraphiQLSource, EmptyMutation, EmptySubscription, ErrorExtensions, FieldError, FieldResult, Object, ResultExt, Schema, }; -use async_graphql_actix_web::{GraphQLRequest, GraphQLResponse}; +use async_graphql_actix_web::GraphQL; #[derive(Debug, Error)] pub enum MyError { @@ -91,13 +91,6 @@ impl QueryRoot { } } -async fn index( - schema: web::Data>, - req: GraphQLRequest, -) -> GraphQLResponse { - schema.execute(req.into_inner()).await.into() -} - async fn gql_playgound() -> HttpResponse { HttpResponse::Ok() .content_type("text/html; charset=utf-8") @@ -109,13 +102,14 @@ async fn main() -> std::io::Result<()> { println!("GraphiQL IDE: http://localhost:8000"); HttpServer::new(move || { + let schema = Schema::new(QueryRoot, EmptyMutation, EmptySubscription); + App::new() - .app_data(Data::new(Schema::new( - QueryRoot, - EmptyMutation, - EmptySubscription, - ))) - .service(web::resource("/").guard(guard::Post()).to(index)) + .service( + web::resource("/") + .guard(guard::Post()) + .to(GraphQL::new(schema)), + ) .service(web::resource("/").guard(guard::Get()).to(gql_playgound)) }) .bind("127.0.0.1:8000")? diff --git a/actix-web/starwars/src/main.rs b/actix-web/starwars/src/main.rs index 543bd23..20c8876 100644 --- a/actix-web/starwars/src/main.rs +++ b/actix-web/starwars/src/main.rs @@ -1,11 +1,7 @@ -use actix_web::{guard, web, web::Data, App, HttpResponse, HttpServer, Result}; +use actix_web::{guard, web, App, HttpResponse, HttpServer, Result}; use async_graphql::{http::GraphiQLSource, EmptyMutation, EmptySubscription, Schema}; -use async_graphql_actix_web::{GraphQLRequest, GraphQLResponse}; -use starwars::{QueryRoot, StarWars, StarWarsSchema}; - -async fn index(schema: web::Data, req: GraphQLRequest) -> GraphQLResponse { - schema.execute(req.into_inner()).await.into() -} +use async_graphql_actix_web::GraphQL; +use starwars::{QueryRoot, StarWars}; async fn index_graphiql() -> Result { Ok(HttpResponse::Ok() @@ -15,16 +11,19 @@ async fn index_graphiql() -> Result { #[actix_web::main] async fn main() -> std::io::Result<()> { - let schema = Schema::build(QueryRoot, EmptyMutation, EmptySubscription) - .data(StarWars::new()) - .finish(); - println!("GraphiQL IDE: http://localhost:8000"); HttpServer::new(move || { + let schema = Schema::build(QueryRoot, EmptyMutation, EmptySubscription) + .data(StarWars::new()) + .finish(); + App::new() - .app_data(Data::new(schema.clone())) - .service(web::resource("/").guard(guard::Post()).to(index)) + .service( + web::resource("/") + .guard(guard::Post()) + .to(GraphQL::new(schema)), + ) .service(web::resource("/").guard(guard::Get()).to(index_graphiql)) }) .bind("127.0.0.1:8000")? diff --git a/actix-web/subscription/src/main.rs b/actix-web/subscription/src/main.rs index fc4e7bc..d226d4d 100644 --- a/actix-web/subscription/src/main.rs +++ b/actix-web/subscription/src/main.rs @@ -1,12 +1,8 @@ -use actix_web::{guard, web, web::Data, App, HttpRequest, HttpResponse, HttpServer, Result}; +use actix_web::{guard, web, App, HttpRequest, HttpResponse, HttpServer, Result}; use async_graphql::{http::GraphiQLSource, Schema}; -use async_graphql_actix_web::{GraphQLRequest, GraphQLResponse, GraphQLSubscription}; +use async_graphql_actix_web::{GraphQL, GraphQLSubscription}; use books::{BooksSchema, MutationRoot, QueryRoot, Storage, SubscriptionRoot}; -async fn index(schema: web::Data, req: GraphQLRequest) -> GraphQLResponse { - schema.execute(req.into_inner()).await.into() -} - async fn index_graphiql() -> Result { Ok(HttpResponse::Ok() .content_type("text/html; charset=utf-8") @@ -28,16 +24,19 @@ async fn index_ws( #[actix_web::main] async fn main() -> std::io::Result<()> { - let schema = Schema::build(QueryRoot, MutationRoot, SubscriptionRoot) - .data(Storage::default()) - .finish(); - println!("GraphiQL IDE: http://localhost:8000"); HttpServer::new(move || { + let schema = Schema::build(QueryRoot, MutationRoot, SubscriptionRoot) + .data(Storage::default()) + .finish(); + App::new() - .app_data(Data::new(schema.clone())) - .service(web::resource("/").guard(guard::Post()).to(index)) + .service( + web::resource("/") + .guard(guard::Post()) + .to(GraphQL::new(schema)), + ) .service( web::resource("/") .guard(guard::Get()) diff --git a/axum/starwars/src/main.rs b/axum/starwars/src/main.rs index e49e9b5..dea53f9 100644 --- a/axum/starwars/src/main.rs +++ b/axum/starwars/src/main.rs @@ -1,19 +1,11 @@ use async_graphql::{http::GraphiQLSource, EmptyMutation, EmptySubscription, Schema}; -use async_graphql_axum::{GraphQLRequest, GraphQLResponse}; +use async_graphql_axum::GraphQL; use axum::{ - extract::Extension, response::{self, IntoResponse}, routing::get, Router, Server, }; -use starwars::{QueryRoot, StarWars, StarWarsSchema}; - -async fn graphql_handler( - schema: Extension, - req: GraphQLRequest, -) -> GraphQLResponse { - schema.execute(req.into_inner()).await.into() -} +use starwars::{QueryRoot, StarWars}; async fn graphiql() -> impl IntoResponse { response::Html(GraphiQLSource::build().endpoint("/").finish()) @@ -25,9 +17,7 @@ async fn main() { .data(StarWars::new()) .finish(); - let app = Router::new() - .route("/", get(graphiql).post(graphql_handler)) - .layer(Extension(schema)); + let app = Router::new().route("/", get(graphiql).post_service(GraphQL::new(schema))); println!("GraphiQL IDE: http://localhost:8000"); diff --git a/axum/subscription/src/main.rs b/axum/subscription/src/main.rs index dcf5176..46cee97 100644 --- a/axum/subscription/src/main.rs +++ b/axum/subscription/src/main.rs @@ -1,16 +1,11 @@ use async_graphql::{http::GraphiQLSource, Schema}; -use async_graphql_axum::{GraphQLRequest, GraphQLResponse, GraphQLSubscription}; +use async_graphql_axum::{GraphQL, GraphQLSubscription}; use axum::{ - extract::Extension, response::{self, IntoResponse}, routing::get, Router, Server, }; -use books::{BooksSchema, MutationRoot, QueryRoot, Storage, SubscriptionRoot}; - -async fn graphql_handler(schema: Extension, req: GraphQLRequest) -> GraphQLResponse { - schema.execute(req.into_inner()).await.into() -} +use books::{MutationRoot, QueryRoot, Storage, SubscriptionRoot}; async fn graphiql() -> impl IntoResponse { response::Html( @@ -28,9 +23,11 @@ async fn main() { .finish(); let app = Router::new() - .route("/", get(graphiql).post(graphql_handler)) - .route_service("/ws", GraphQLSubscription::new(schema.clone())) - .layer(Extension(schema)); + .route( + "/", + get(graphiql).post_service(GraphQL::new(schema.clone())), + ) + .route_service("/ws", GraphQLSubscription::new(schema)); println!("GraphiQL IDE: http://localhost:8000"); diff --git a/axum/token-from-header/src/main.rs b/axum/token-from-header/src/main.rs index 2e02298..44a886c 100644 --- a/axum/token-from-header/src/main.rs +++ b/axum/token-from-header/src/main.rs @@ -4,7 +4,7 @@ use async_graphql::{ }; use async_graphql_axum::{GraphQLProtocol, GraphQLRequest, GraphQLResponse, GraphQLWebSocket}; use axum::{ - extract::{ws::WebSocketUpgrade, Extension}, + extract::{ws::WebSocketUpgrade, State}, http::header::HeaderMap, response::{Html, IntoResponse, Response}, routing::get, @@ -25,7 +25,7 @@ fn get_token_from_headers(headers: &HeaderMap) -> Option { } async fn graphql_handler( - Extension(schema): Extension, + State(schema): State, headers: HeaderMap, req: GraphQLRequest, ) -> GraphQLResponse { @@ -37,7 +37,7 @@ async fn graphql_handler( } async fn graphql_ws_handler( - Extension(schema): Extension, + State(schema): State, protocol: GraphQLProtocol, websocket: WebSocketUpgrade, ) -> Response { @@ -57,7 +57,7 @@ async fn main() { let app = Router::new() .route("/", get(graphql_playground).post(graphql_handler)) .route("/ws", get(graphql_ws_handler)) - .layer(Extension(schema)); + .with_state(schema); println!("Playground: http://localhost:8000"); diff --git a/axum/upload/src/main.rs b/axum/upload/src/main.rs index e2b50cd..a334cc6 100644 --- a/axum/upload/src/main.rs +++ b/axum/upload/src/main.rs @@ -1,19 +1,14 @@ use async_graphql::{http::GraphiQLSource, EmptySubscription, Schema}; -use async_graphql_axum::{GraphQLRequest, GraphQLResponse}; +use async_graphql_axum::GraphQL; use axum::{ - extract::Extension, response::{Html, IntoResponse}, routing::get, Router, }; -use files::{FilesSchema, MutationRoot, QueryRoot, Storage}; +use files::{MutationRoot, QueryRoot, Storage}; use hyper::{Method, Server}; use tower_http::cors::{CorsLayer, Origin}; -async fn graphql_handler(schema: Extension, req: GraphQLRequest) -> GraphQLResponse { - schema.execute(req.0).await.into() -} - async fn graphiql() -> impl IntoResponse { Html(GraphiQLSource::build().endpoint("/").finish()) } @@ -27,8 +22,7 @@ async fn main() { println!("GraphiQL IDE: http://localhost:8000"); let app = Router::new() - .route("/", get(graphiql).post(graphql_handler)) - .layer(Extension(schema)) + .route("/", get(graphiql).post_service(GraphQL::new(schema))) .layer( CorsLayer::new() .allow_origin(Origin::predicate(|_, _| true)) diff --git a/tide/subscription/src/main.rs b/tide/subscription/src/main.rs index cae16ed..a95559f 100644 --- a/tide/subscription/src/main.rs +++ b/tide/subscription/src/main.rs @@ -34,7 +34,7 @@ async fn run() -> Result<()> { Ok(resp) }); - app.listen("127.0.0.1:8000").await?; + app.listen("0.0.0.0:8000").await?; Ok(()) } From 58581763810909dcb5392b099a80aa4a116efae4 Mon Sep 17 00:00:00 2001 From: gianmarcoalarcon Date: Mon, 28 Aug 2023 18:35:23 +0800 Subject: [PATCH 065/102] Refactor storage --- models/dynamic-books/src/lib.rs | 62 ++++++++++---------- models/dynamic-books/src/model.rs | 97 +++++++++++++++---------------- 2 files changed, 77 insertions(+), 82 deletions(-) diff --git a/models/dynamic-books/src/lib.rs b/models/dynamic-books/src/lib.rs index 801e087..3e014bd 100644 --- a/models/dynamic-books/src/lib.rs +++ b/models/dynamic-books/src/lib.rs @@ -5,10 +5,9 @@ use async_graphql::ID; use futures_util::lock::Mutex; pub use model::schema; use slab::Slab; -use std::{collections::HashMap, sync::Arc}; +use std::sync::Arc; type Storage = Arc>>; -type Mapping = Arc>>; #[derive(Clone)] pub struct Book { @@ -16,35 +15,34 @@ pub struct Book { name: String, author: String, } +//#[derive(Default)] +//pub struct BookStore { +// store: Storage, +//value: Arc>, +//} +// impl BookStore { +// #[allow(clippy::new_without_default)] +// pub fn new() -> Self { +// let mut store = Slab::new(); +// let key_1 = store.insert(Book { +// id: "10".into(), +// name: "Luke Skywalker".to_string(), +// author: "Tatooine".to_string(), +// }); +// let key_2 = store.insert(Book { +// id: 1001.into(), +// name: "Anakin Skywalker".to_string(), +// author: "Tatooine".to_string(), +// }); -pub struct BookStore { - store: Storage, - books_by_id: Mapping, - value: Arc>, -} -impl BookStore { - #[allow(clippy::new_without_default)] - pub fn new() -> Self { - let mut store = Slab::new(); - let key_1 = store.insert(Book { - id: "10".into(), - name: "Luke Skywalker".to_string(), - author: "Tatooine".to_string(), - }); - let key_2 = store.insert(Book { - id: 1001.into(), - name: "Anakin Skywalker".to_string(), - author: "Tatooine".to_string(), - }); - - let mut books_by_id = HashMap::new(); - books_by_id.insert("10".to_string(), key_1); - books_by_id.insert("1001".to_string(), key_2); +// let mut books_by_id = HashMap::new(); +// books_by_id.insert("10".to_string(), key_1); +// books_by_id.insert("1001".to_string(), key_2); - Self { - store: Arc::new(Mutex::new(store)), - books_by_id: Arc::new(Mutex::new(books_by_id)), - value: Arc::new(Mutex::new(10)), - } - } -} +// Self { +// store: Arc::new(Mutex::new(store)), +// books_by_id: Arc::new(Mutex::new(books_by_id)), +// value: Arc::new(Mutex::new(10)), +// } +// } +// } diff --git a/models/dynamic-books/src/model.rs b/models/dynamic-books/src/model.rs index ba39e4e..8c1783f 100644 --- a/models/dynamic-books/src/model.rs +++ b/models/dynamic-books/src/model.rs @@ -1,10 +1,7 @@ -use async_graphql::{dynamic::*, Value}; +use async_graphql::{dynamic::*, Value, ID}; use futures_util::StreamExt; -use crate::{ - simple_broker::{self, SimpleBroker}, - Book, BookStore, -}; +use crate::{simple_broker::SimpleBroker, Book, Storage}; pub fn schema() -> Result { let book = Object::new("Book") @@ -42,21 +39,24 @@ pub fn schema() -> Result { Field::new("getBook", TypeRef::named(book.type_name()), |ctx| { FieldFuture::new(async move { let id = ctx.args.try_get("id")?; - let book_by_id = &ctx.data_unchecked::().books_by_id.lock().await; - let book_id = book_by_id.get(id.string()?).unwrap(); - let store = ctx.data_unchecked::().store.lock().await; - let book = store.get(*book_id).cloned(); + let book_id = match id.string() { + Ok(id) => id.to_string(), + Err(_) => id.u64()?.to_string(), + }; + let book_id = book_id.parse::()?; + let store = ctx.data_unchecked::().lock().await; + let book = store.get(book_id).cloned(); Ok(book.map(FieldValue::owned_any)) }) }) - .argument(InputValue::new("id", TypeRef::named_nn(TypeRef::STRING))), + .argument(InputValue::new("id", TypeRef::named_nn(TypeRef::ID))), ) .field(Field::new( "getBooks", TypeRef::named_nn_list_nn(book.type_name()), |ctx| { FieldFuture::new(async move { - let store = ctx.data_unchecked::().store.lock().await; + let store = ctx.data_unchecked::().lock().await; let books: Vec = store.iter().map(|(_, book)| book.clone()).collect(); Ok(Some(FieldValue::list( books.into_iter().map(FieldValue::owned_any), @@ -65,45 +65,42 @@ pub fn schema() -> Result { }, )); - let mutatation = Object::new("Mutation") - .field( - Field::new("createBook", TypeRef::named(book.type_name()), |ctx| { - FieldFuture::new(async move { - let mut book_by_id = ctx.data_unchecked::().books_by_id.lock().await; - let mut store = ctx.data_unchecked::().store.lock().await; - let id = ctx.args.try_get("id")?; - let name = ctx.args.try_get("name")?; - let author = ctx.args.try_get("author")?; - let book = Book { - id: id.string()?.into(), - name: name.string()?.to_string(), - author: author.string()?.to_string(), - }; - let key = store.insert(book.clone()); - book_by_id.insert(id.string()?.to_string(), key); - SimpleBroker::publish(book); - Ok(Some(FieldValue::owned_any(store.get(key).unwrap().clone()))) - }) + let mutatation = Object::new("Mutation").field( + Field::new("createBook", TypeRef::named(TypeRef::ID), |ctx| { + FieldFuture::new(async move { + let mut store = ctx.data_unchecked::().lock().await; + let name = ctx.args.try_get("name")?; + let author = ctx.args.try_get("author")?; + let entry = store.vacant_entry(); + let id: ID = entry.key().into(); + let book = Book { + id: id.clone(), + name: name.string()?.to_string(), + author: author.string()?.to_string(), + }; + entry.insert(book.clone()); + SimpleBroker::publish(book.clone()); + Ok(Some(Value::from(id))) }) - .argument(InputValue::new("id", TypeRef::named_nn(TypeRef::STRING))) - .argument(InputValue::new("name", TypeRef::named_nn(TypeRef::STRING))) - .argument(InputValue::new( - "author", - TypeRef::named_nn(TypeRef::STRING), - )), - ) - .field( - Field::new("updateValue", TypeRef::named_nn(TypeRef::INT), |ctx| { - FieldFuture::new(async move { - let mut store_value = ctx.data_unchecked::().value.lock().await; - let new_value = ctx.args.try_get("value")?; - let value = new_value.u64()?; - *store_value = value; - Ok(Some(Value::from(*store_value))) - }) - }) - .argument(InputValue::new("value", TypeRef::named_nn(TypeRef::INT))), - ); + }) + .argument(InputValue::new("name", TypeRef::named_nn(TypeRef::STRING))) + .argument(InputValue::new( + "author", + TypeRef::named_nn(TypeRef::STRING), + )), + ); + // .field( + // Field::new("updateValue", TypeRef::named_nn(TypeRef::INT), |ctx| { + // FieldFuture::new(async move { + // let mut store_value = ctx.data_unchecked::().value.lock().await; + // let new_value = ctx.args.try_get("value")?; + // let value = new_value.u64()?; + // *store_value = value; + // Ok(Some(Value::from(*store_value))) + // }) + // }) + // .argument(InputValue::new("value", TypeRef::named_nn(TypeRef::INT))), + // ); // Todo:Show book.value let subscription = Subscription::new("Subscription").field(SubscriptionField::new( "bookAdded", @@ -124,6 +121,6 @@ pub fn schema() -> Result { .register(query) .register(subscription) .register(mutatation) - .data(BookStore::new()) + .data(Storage::default()) .finish() } From 5ab6754eade3ed659cf49bba9374b0dce6387fd7 Mon Sep 17 00:00:00 2001 From: gianmarcoalarcon Date: Tue, 29 Aug 2023 16:55:58 +0800 Subject: [PATCH 066/102] Feat: Add enum MutationType and struct BookChanged --- models/dynamic-books/src/lib.rs | 39 ++++-------- models/dynamic-books/src/model.rs | 98 ++++++++++++++++++++++--------- 2 files changed, 81 insertions(+), 56 deletions(-) diff --git a/models/dynamic-books/src/lib.rs b/models/dynamic-books/src/lib.rs index 3e014bd..40aedd2 100644 --- a/models/dynamic-books/src/lib.rs +++ b/models/dynamic-books/src/lib.rs @@ -15,34 +15,15 @@ pub struct Book { name: String, author: String, } -//#[derive(Default)] -//pub struct BookStore { -// store: Storage, -//value: Arc>, -//} -// impl BookStore { -// #[allow(clippy::new_without_default)] -// pub fn new() -> Self { -// let mut store = Slab::new(); -// let key_1 = store.insert(Book { -// id: "10".into(), -// name: "Luke Skywalker".to_string(), -// author: "Tatooine".to_string(), -// }); -// let key_2 = store.insert(Book { -// id: 1001.into(), -// name: "Anakin Skywalker".to_string(), -// author: "Tatooine".to_string(), -// }); -// let mut books_by_id = HashMap::new(); -// books_by_id.insert("10".to_string(), key_1); -// books_by_id.insert("1001".to_string(), key_2); +#[derive(Eq, PartialEq, Copy, Clone)] +pub enum MutationType { + Created, + Deleted, +} -// Self { -// store: Arc::new(Mutex::new(store)), -// books_by_id: Arc::new(Mutex::new(books_by_id)), -// value: Arc::new(Mutex::new(10)), -// } -// } -// } +#[derive(Clone)] +struct BookChanged { + mutation_type: MutationType, + id: ID, +} diff --git a/models/dynamic-books/src/model.rs b/models/dynamic-books/src/model.rs index 8c1783f..68a15ea 100644 --- a/models/dynamic-books/src/model.rs +++ b/models/dynamic-books/src/model.rs @@ -1,9 +1,22 @@ use async_graphql::{dynamic::*, Value, ID}; use futures_util::StreamExt; -use crate::{simple_broker::SimpleBroker, Book, Storage}; +use crate::{simple_broker::SimpleBroker, Book, BookChanged, MutationType, Storage}; + +impl<'a> From for FieldValue<'a> { + fn from(value: MutationType) -> Self { + match value { + MutationType::Created => FieldValue::value("CREATED"), + MutationType::Deleted => FieldValue::value("DELETED"), + } + } +} pub fn schema() -> Result { + let mutation_type = Enum::new("MutationType") + .item(EnumItem::new("CREATED").description("New book created.")) + .item(EnumItem::new("DELETED").description("Current book deleted.")); + let book = Object::new("Book") .description("A book that will be stored.") .field( @@ -33,8 +46,45 @@ pub fn schema() -> Result { }) .description("The author of the book."), ); + let book_changed = Object::new("BookChanged") + .field( + Field::new( + "mutation_type", + TypeRef::named_nn(mutation_type.type_name()), + |ctx| { + FieldFuture::new(async move { + let book_changed = ctx.parent_value.try_downcast_ref::()?; + Ok(Some(FieldValue::from(book_changed.mutation_type))) + }) + }, + ) + .description("The type of mutation."), + ) + .field( + Field::new("id", TypeRef::named_nn(TypeRef::ID), |ctx| { + FieldFuture::new(async move { + let book_changed = ctx.parent_value.try_downcast_ref::()?; + Ok(Some(Value::from(book_changed.id.to_owned()))) + }) + }) + .description("The id of the book."), + ) + .field(Field::new( + "book", + TypeRef::named(book.type_name()), + |ctx| { + FieldFuture::new(async move { + let book_changed = ctx.parent_value.try_downcast_ref::()?; + let id = book_changed.id.to_owned(); + let book_id = id.parse::()?; + let store = ctx.data_unchecked::().lock().await; + let book = store.get(book_id).cloned(); + Ok(book.map(FieldValue::owned_any)) + }) + }, + )); - let query = Object::new("Query") + let query_root = Object::new("Query") .field( Field::new("getBook", TypeRef::named(book.type_name()), |ctx| { FieldFuture::new(async move { @@ -65,7 +115,7 @@ pub fn schema() -> Result { }, )); - let mutatation = Object::new("Mutation").field( + let mutatation_root = Object::new("Mutation").field( Field::new("createBook", TypeRef::named(TypeRef::ID), |ctx| { FieldFuture::new(async move { let mut store = ctx.data_unchecked::().lock().await; @@ -78,8 +128,12 @@ pub fn schema() -> Result { name: name.string()?.to_string(), author: author.string()?.to_string(), }; - entry.insert(book.clone()); - SimpleBroker::publish(book.clone()); + entry.insert(book); + let book_mutated = BookChanged { + mutation_type: MutationType::Created, + id: id.clone(), + }; + SimpleBroker::publish(book_mutated); Ok(Some(Value::from(id))) }) }) @@ -89,38 +143,28 @@ pub fn schema() -> Result { TypeRef::named_nn(TypeRef::STRING), )), ); - // .field( - // Field::new("updateValue", TypeRef::named_nn(TypeRef::INT), |ctx| { - // FieldFuture::new(async move { - // let mut store_value = ctx.data_unchecked::().value.lock().await; - // let new_value = ctx.args.try_get("value")?; - // let value = new_value.u64()?; - // *store_value = value; - // Ok(Some(Value::from(*store_value))) - // }) - // }) - // .argument(InputValue::new("value", TypeRef::named_nn(TypeRef::INT))), - // ); - // Todo:Show book.value - let subscription = Subscription::new("Subscription").field(SubscriptionField::new( + let subscription_root = Subscription::new("Subscription").field(SubscriptionField::new( "bookAdded", - TypeRef::named_nn(book.type_name()), + TypeRef::named_nn(book_changed.type_name()), |_| { SubscriptionFieldFuture::new(async { - Ok(SimpleBroker::::subscribe().map(|book| Ok(FieldValue::owned_any(book)))) + Ok(SimpleBroker::::subscribe() + .map(|book| Ok(FieldValue::owned_any(book)))) }) }, )); Schema::build( - query.type_name(), - Some(mutatation.type_name()), - Some(subscription.type_name()), + query_root.type_name(), + Some(mutatation_root.type_name()), + Some(subscription_root.type_name()), ) + .register(mutation_type) .register(book) - .register(query) - .register(subscription) - .register(mutatation) + .register(book_changed) + .register(query_root) + .register(subscription_root) + .register(mutatation_root) .data(Storage::default()) .finish() } From 334de2947586fb0cfa98dc2de29252bc5d121395 Mon Sep 17 00:00:00 2001 From: gianmarcoalarcon Date: Wed, 30 Aug 2023 00:20:18 +0800 Subject: [PATCH 067/102] Add deleteBook mutation --- models/dynamic-books/src/lib.rs | 4 +- models/dynamic-books/src/model.rs | 220 ++++++++++++++++++------------ 2 files changed, 138 insertions(+), 86 deletions(-) diff --git a/models/dynamic-books/src/lib.rs b/models/dynamic-books/src/lib.rs index 40aedd2..ab994d8 100644 --- a/models/dynamic-books/src/lib.rs +++ b/models/dynamic-books/src/lib.rs @@ -7,8 +7,6 @@ pub use model::schema; use slab::Slab; use std::sync::Arc; -type Storage = Arc>>; - #[derive(Clone)] pub struct Book { id: ID, @@ -16,6 +14,8 @@ pub struct Book { author: String, } +type Storage = Arc>>; + #[derive(Eq, PartialEq, Copy, Clone)] pub enum MutationType { Created, diff --git a/models/dynamic-books/src/model.rs b/models/dynamic-books/src/model.rs index 68a15ea..3bac737 100644 --- a/models/dynamic-books/src/model.rs +++ b/models/dynamic-books/src/model.rs @@ -19,56 +19,49 @@ pub fn schema() -> Result { let book = Object::new("Book") .description("A book that will be stored.") - .field( - Field::new("id", TypeRef::named_nn(TypeRef::ID), |ctx| { - FieldFuture::new(async move { - let book = ctx.parent_value.try_downcast_ref::()?; - Ok(Some(Value::from(book.id.to_owned()))) - }) + .field(Field::new("id", TypeRef::named_nn(TypeRef::ID), |ctx| { + FieldFuture::new(async move { + let book = ctx.parent_value.try_downcast_ref::()?; + Ok(Some(Value::from(book.id.to_owned()))) }) - .description("The id of the book."), - ) - .field( - Field::new("name", TypeRef::named_nn(TypeRef::STRING), |ctx| { + })) + .field(Field::new( + "name", + TypeRef::named_nn(TypeRef::STRING), + |ctx| { FieldFuture::new(async move { let book = ctx.parent_value.try_downcast_ref::()?; Ok(Some(Value::from(book.name.to_owned()))) }) - }) - .description("The name of the book."), - ) - .field( - Field::new("author", TypeRef::named_nn(TypeRef::STRING), |ctx| { + }, + )) + .field(Field::new( + "author", + TypeRef::named_nn(TypeRef::STRING), + |ctx| { FieldFuture::new(async move { let book = ctx.parent_value.try_downcast_ref::()?; Ok(Some(Value::from(book.author.to_owned()))) }) - }) - .description("The author of the book."), - ); + }, + )); let book_changed = Object::new("BookChanged") - .field( - Field::new( - "mutation_type", - TypeRef::named_nn(mutation_type.type_name()), - |ctx| { - FieldFuture::new(async move { - let book_changed = ctx.parent_value.try_downcast_ref::()?; - Ok(Some(FieldValue::from(book_changed.mutation_type))) - }) - }, - ) - .description("The type of mutation."), - ) - .field( - Field::new("id", TypeRef::named_nn(TypeRef::ID), |ctx| { + .field(Field::new( + "mutationType", + TypeRef::named_nn(mutation_type.type_name()), + |ctx| { FieldFuture::new(async move { let book_changed = ctx.parent_value.try_downcast_ref::()?; - Ok(Some(Value::from(book_changed.id.to_owned()))) + Ok(Some(FieldValue::from(book_changed.mutation_type))) }) + }, + )) + .field(Field::new("id", TypeRef::named_nn(TypeRef::ID), |ctx| { + FieldFuture::new(async move { + let book_changed = ctx.parent_value.try_downcast_ref::()?; + Ok(Some(Value::from(book_changed.id.to_owned()))) }) - .description("The id of the book."), - ) + })) .field(Field::new( "book", TypeRef::named(book.type_name()), @@ -85,6 +78,19 @@ pub fn schema() -> Result { )); let query_root = Object::new("Query") + .field(Field::new( + "getBooks", + TypeRef::named_list(book.type_name()), + |ctx| { + FieldFuture::new(async move { + let store = ctx.data_unchecked::().lock().await; + let books: Vec = store.iter().map(|(_, book)| book.clone()).collect(); + Ok(Some(FieldValue::list( + books.into_iter().map(FieldValue::owned_any), + ))) + }) + }, + )) .field( Field::new("getBook", TypeRef::named(book.type_name()), |ctx| { FieldFuture::new(async move { @@ -100,60 +106,106 @@ pub fn schema() -> Result { }) }) .argument(InputValue::new("id", TypeRef::named_nn(TypeRef::ID))), + ); + + let mutatation_root = Object::new("Mutation") + .field( + Field::new("createBook", TypeRef::named(TypeRef::ID), |ctx| { + FieldFuture::new(async move { + let mut store = ctx.data_unchecked::().lock().await; + let name = ctx.args.try_get("name")?; + let author = ctx.args.try_get("author")?; + let entry = store.vacant_entry(); + let id: ID = entry.key().into(); + let book = Book { + id: id.clone(), + name: name.string()?.to_string(), + author: author.string()?.to_string(), + }; + entry.insert(book); + let book_mutated = BookChanged { + mutation_type: MutationType::Created, + id: id.clone(), + }; + SimpleBroker::publish(book_mutated); + Ok(Some(Value::from(id))) + }) + }) + .argument(InputValue::new("name", TypeRef::named_nn(TypeRef::STRING))) + .argument(InputValue::new( + "author", + TypeRef::named_nn(TypeRef::STRING), + )), ) - .field(Field::new( - "getBooks", - TypeRef::named_nn_list_nn(book.type_name()), - |ctx| { + .field( + Field::new("deleteBook", TypeRef::named_nn(TypeRef::BOOLEAN), |ctx| { FieldFuture::new(async move { - let store = ctx.data_unchecked::().lock().await; - let books: Vec = store.iter().map(|(_, book)| book.clone()).collect(); - Ok(Some(FieldValue::list( - books.into_iter().map(FieldValue::owned_any), - ))) + let mut store = ctx.data_unchecked::().lock().await; + let id = ctx.args.try_get("id")?; + let book_id = match id.string() { + Ok(id) => id.to_string(), + Err(_) => id.u64()?.to_string(), + }; + let book_id = book_id.parse::()?; + if store.contains(book_id) { + store.remove(book_id); + let book_mutated = BookChanged { + mutation_type: MutationType::Deleted, + id: book_id.into(), + }; + SimpleBroker::publish(book_mutated); + Ok(Some(Value::from(true))) + } else { + Ok(Some(Value::from(false))) + } + }) + }) + .argument(InputValue::new("id", TypeRef::named_nn(TypeRef::ID))), + ); + let subscription_root = Subscription::new("Subscription") + // .field( + // SubscriptionField::new( + // "bookMutation", + // TypeRef::named_nn(book_changed.type_name()), + // |ctx| { + // SubscriptionFieldFuture::new(async { + // let mutation_type = match ctx.args.get("mutationType") { + // Some(mutation_type) => Some(match mutation_type.enum_name()? { + // "CREATED" => MutationType::Created, + // "DELETED" => MutationType::Deleted, + // _ => return Err("Invalid mutation type".into()), + // }), + // None => None, + // }; + // Ok( + // SimpleBroker::::subscribe().filter(move |event| { + // let res = if let Some(mutation_type) = mutation_type { + // event.mutation_type == mutation_type + // } else { + // true + // }; + // async move { res } + // }), + // ) + // }) + // }, + // ) + // .argument(InputValue::new( + // "mutationType", + // TypeRef::named(mutation_type.type_name()), + // )), + // ) + .field(SubscriptionField::new( + "bookMutation", + TypeRef::named_nn(book_changed.type_name()), + |_| { + SubscriptionFieldFuture::new(async { + Ok(SimpleBroker::::subscribe() + .map(|book| Ok(FieldValue::owned_any(book)))) }) }, )); - let mutatation_root = Object::new("Mutation").field( - Field::new("createBook", TypeRef::named(TypeRef::ID), |ctx| { - FieldFuture::new(async move { - let mut store = ctx.data_unchecked::().lock().await; - let name = ctx.args.try_get("name")?; - let author = ctx.args.try_get("author")?; - let entry = store.vacant_entry(); - let id: ID = entry.key().into(); - let book = Book { - id: id.clone(), - name: name.string()?.to_string(), - author: author.string()?.to_string(), - }; - entry.insert(book); - let book_mutated = BookChanged { - mutation_type: MutationType::Created, - id: id.clone(), - }; - SimpleBroker::publish(book_mutated); - Ok(Some(Value::from(id))) - }) - }) - .argument(InputValue::new("name", TypeRef::named_nn(TypeRef::STRING))) - .argument(InputValue::new( - "author", - TypeRef::named_nn(TypeRef::STRING), - )), - ); - let subscription_root = Subscription::new("Subscription").field(SubscriptionField::new( - "bookAdded", - TypeRef::named_nn(book_changed.type_name()), - |_| { - SubscriptionFieldFuture::new(async { - Ok(SimpleBroker::::subscribe() - .map(|book| Ok(FieldValue::owned_any(book)))) - }) - }, - )); - Schema::build( query_root.type_name(), Some(mutatation_root.type_name()), From 87960bcb354dbe5f42cbd5fa4296fe3215cab232 Mon Sep 17 00:00:00 2001 From: Eduardo Date: Wed, 30 Aug 2023 10:54:02 -0500 Subject: [PATCH 068/102] update: dynamic enum --- models/dynamic-books/src/lib.rs | 15 ++++++++++++++- models/dynamic-books/src/model.rs | 14 ++++++++++++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/models/dynamic-books/src/lib.rs b/models/dynamic-books/src/lib.rs index ab994d8..5d38fc8 100644 --- a/models/dynamic-books/src/lib.rs +++ b/models/dynamic-books/src/lib.rs @@ -2,6 +2,7 @@ mod model; mod simple_broker; use async_graphql::ID; +use std::str::FromStr; use futures_util::lock::Mutex; pub use model::schema; use slab::Slab; @@ -16,12 +17,24 @@ pub struct Book { type Storage = Arc>>; -#[derive(Eq, PartialEq, Copy, Clone)] +#[derive(Eq, PartialEq, Copy, Clone, Debug)] pub enum MutationType { Created, Deleted, } +impl FromStr for MutationType { + type Err = String; // Error type can be customized based on your needs + + fn from_str(s: &str) -> Result { + match s { + "CREATED" => Ok(MutationType::Created), + "DELETED" => Ok(MutationType::Deleted), + _ => Err(format!("Invalid MutationType: {}", s)), + } + } +} + #[derive(Clone)] struct BookChanged { mutation_type: MutationType, diff --git a/models/dynamic-books/src/model.rs b/models/dynamic-books/src/model.rs index 3bac737..b3ac0a4 100644 --- a/models/dynamic-books/src/model.rs +++ b/models/dynamic-books/src/model.rs @@ -198,13 +198,23 @@ pub fn schema() -> Result { .field(SubscriptionField::new( "bookMutation", TypeRef::named_nn(book_changed.type_name()), - |_| { + |ctx| { + let mutation_type: Result = ctx.args.try_get("mutation_type").unwrap().enum_name().unwrap().parse(); + + match mutation_type { + Ok(mutation_type) => match mutation_type { + MutationType::Created => println!("Created"), + MutationType::Deleted => println!("Deleted") + }, + Err(err) => println!("Error: {}", err), + } + SubscriptionFieldFuture::new(async { Ok(SimpleBroker::::subscribe() .map(|book| Ok(FieldValue::owned_any(book)))) }) }, - )); + ).argument(InputValue::new("mutation_type", TypeRef::named(mutation_type.type_name())))); Schema::build( query_root.type_name(), From 7159718fbe717941ccde4ea2628a34a8d5f89f7b Mon Sep 17 00:00:00 2001 From: gianmarcoalarcon Date: Thu, 31 Aug 2023 00:19:22 +0700 Subject: [PATCH 069/102] Clean code --- models/dynamic-books/src/model.rs | 63 +++++-------------------------- 1 file changed, 10 insertions(+), 53 deletions(-) diff --git a/models/dynamic-books/src/model.rs b/models/dynamic-books/src/model.rs index b3ac0a4..ba466e0 100644 --- a/models/dynamic-books/src/model.rs +++ b/models/dynamic-books/src/model.rs @@ -162,59 +162,16 @@ pub fn schema() -> Result { }) .argument(InputValue::new("id", TypeRef::named_nn(TypeRef::ID))), ); - let subscription_root = Subscription::new("Subscription") - // .field( - // SubscriptionField::new( - // "bookMutation", - // TypeRef::named_nn(book_changed.type_name()), - // |ctx| { - // SubscriptionFieldFuture::new(async { - // let mutation_type = match ctx.args.get("mutationType") { - // Some(mutation_type) => Some(match mutation_type.enum_name()? { - // "CREATED" => MutationType::Created, - // "DELETED" => MutationType::Deleted, - // _ => return Err("Invalid mutation type".into()), - // }), - // None => None, - // }; - // Ok( - // SimpleBroker::::subscribe().filter(move |event| { - // let res = if let Some(mutation_type) = mutation_type { - // event.mutation_type == mutation_type - // } else { - // true - // }; - // async move { res } - // }), - // ) - // }) - // }, - // ) - // .argument(InputValue::new( - // "mutationType", - // TypeRef::named(mutation_type.type_name()), - // )), - // ) - .field(SubscriptionField::new( - "bookMutation", - TypeRef::named_nn(book_changed.type_name()), - |ctx| { - let mutation_type: Result = ctx.args.try_get("mutation_type").unwrap().enum_name().unwrap().parse(); - - match mutation_type { - Ok(mutation_type) => match mutation_type { - MutationType::Created => println!("Created"), - MutationType::Deleted => println!("Deleted") - }, - Err(err) => println!("Error: {}", err), - } - - SubscriptionFieldFuture::new(async { - Ok(SimpleBroker::::subscribe() - .map(|book| Ok(FieldValue::owned_any(book)))) - }) - }, - ).argument(InputValue::new("mutation_type", TypeRef::named(mutation_type.type_name())))); + let subscription_root = Subscription::new("Subscription").field(SubscriptionField::new( + "bookMutation", + TypeRef::named_nn(book_changed.type_name()), + |_| { + SubscriptionFieldFuture::new(async { + Ok(SimpleBroker::::subscribe() + .map(|book| Ok(FieldValue::owned_any(book)))) + }) + }, + )); Schema::build( query_root.type_name(), From ce6686391b1e0df8045000746cb7c07eb2a5294e Mon Sep 17 00:00:00 2001 From: GianMarco Date: Thu, 31 Aug 2023 08:29:22 +0700 Subject: [PATCH 070/102] Update Cargo.toml --- Cargo.toml | 93 +++++++++++++++++++++++++++--------------------------- 1 file changed, 46 insertions(+), 47 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 0417f05..5b0ba3c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,50 +1,49 @@ [workspace] members = [ - "models/starwars", - "models/dynamic-starwars", - "models/books", - "models/files", - "models/token", - - "poem/opentelemetry-basic", - "poem/starwars", - "poem/subscription", - "poem/subscription-redis", - "poem/token-from-header", - "poem/upload", - "poem/dynamic-schema", - "poem/dynamic-starwars", - "poem/dynamic-books", - - - "actix-web/token-from-header", - "actix-web/subscription", - "actix-web/upload", - "actix-web/starwars", - "actix-web/error-extensions", - - "warp/starwars", - "warp/subscription", - "warp/token-from-header", - - "rocket/starwars", - "rocket/upload", - - "axum/starwars", - "axum/subscription", - "axum/upload", - "axum/token-from-header", - - "tide/starwars", - "tide/dataloader", - "tide/dataloader-postgres", - "tide/subscription", - - "federation/static-schema/federation-accounts", - "federation/static-schema/federation-products", - "federation/static-schema/federation-reviews", - - "federation/dynamic-schema/federation-accounts", - "federation/dynamic-schema/federation-products", - "federation/dynamic-schema/federation-reviews", + "models/starwars", + "models/dynamic-starwars", + "models/books", + "models/files", + "models/token", + + "poem/opentelemetry-basic", + "poem/starwars", + "poem/subscription", + "poem/subscription-redis", + "poem/token-from-header", + "poem/upload", + "poem/dynamic-schema", + "poem/dynamic-starwars", + "poem/dynamic-books", + + "actix-web/token-from-header", + "actix-web/subscription", + "actix-web/upload", + "actix-web/starwars", + "actix-web/error-extensions", + + "warp/starwars", + "warp/subscription", + "warp/token-from-header", + + "rocket/starwars", + "rocket/upload", + + "axum/starwars", + "axum/subscription", + "axum/upload", + "axum/token-from-header", + + "tide/starwars", + "tide/dataloader", + "tide/dataloader-postgres", + "tide/subscription", + + "federation/static-schema/federation-accounts", + "federation/static-schema/federation-products", + "federation/static-schema/federation-reviews", + + "federation/dynamic-schema/federation-accounts", + "federation/dynamic-schema/federation-products", + "federation/dynamic-schema/federation-reviews", ] From 59cfedf21c1bee4c06a6345222a0d67ff34b20f1 Mon Sep 17 00:00:00 2001 From: Sunli Date: Fri, 1 Sep 2023 23:35:43 +0800 Subject: [PATCH 071/102] rustfmt --- models/dynamic-books/src/lib.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/models/dynamic-books/src/lib.rs b/models/dynamic-books/src/lib.rs index 5d38fc8..e9a2438 100644 --- a/models/dynamic-books/src/lib.rs +++ b/models/dynamic-books/src/lib.rs @@ -1,12 +1,11 @@ mod model; mod simple_broker; -use async_graphql::ID; +use std::{str::FromStr, sync::Arc}; -use std::str::FromStr; +use async_graphql::ID; use futures_util::lock::Mutex; pub use model::schema; use slab::Slab; -use std::sync::Arc; #[derive(Clone)] pub struct Book { From ed1e7f28e472b27d883092f660c7632942c4f314 Mon Sep 17 00:00:00 2001 From: Sunli Date: Fri, 29 Sep 2023 13:55:16 +0800 Subject: [PATCH 072/102] add dynamic-files example --- Cargo.toml | 5 +- models/dynamic-files/Cargo.toml | 9 +++ models/dynamic-files/src/lib.rs | 108 ++++++++++++++++++++++++++++++++ models/files/src/lib.rs | 1 - poem/dynamic-upload/Cargo.toml | 11 ++++ poem/dynamic-upload/src/main.rs | 22 +++++++ 6 files changed, 154 insertions(+), 2 deletions(-) create mode 100644 models/dynamic-files/Cargo.toml create mode 100644 models/dynamic-files/src/lib.rs create mode 100644 poem/dynamic-upload/Cargo.toml create mode 100644 poem/dynamic-upload/src/main.rs diff --git a/Cargo.toml b/Cargo.toml index 5b0ba3c..0c12c45 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,10 +1,12 @@ [workspace] +resolver = "2" members = [ "models/starwars", - "models/dynamic-starwars", "models/books", "models/files", "models/token", + "models/dynamic-starwars", + "models/dynamic-files", "poem/opentelemetry-basic", "poem/starwars", @@ -15,6 +17,7 @@ members = [ "poem/dynamic-schema", "poem/dynamic-starwars", "poem/dynamic-books", + "poem/dynamic-upload", "actix-web/token-from-header", "actix-web/subscription", diff --git a/models/dynamic-files/Cargo.toml b/models/dynamic-files/Cargo.toml new file mode 100644 index 0000000..cb570d1 --- /dev/null +++ b/models/dynamic-files/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "dynamic-files" +version = "0.1.0" +edition = "2021" + +[dependencies] +async-graphql = { path = "../../.." } +slab = "0.4.2" +futures = "0.3.0" diff --git a/models/dynamic-files/src/lib.rs b/models/dynamic-files/src/lib.rs new file mode 100644 index 0000000..b9f398d --- /dev/null +++ b/models/dynamic-files/src/lib.rs @@ -0,0 +1,108 @@ +use async_graphql::{ + dynamic::{Field, FieldFuture, FieldValue, InputValue, Object, Schema, SchemaError, TypeRef}, + Value, +}; +use futures::lock::Mutex; +use slab::Slab; + +pub type Storage = Mutex>; + +#[derive(Clone)] +pub struct FileInfo { + pub id: String, + url: String, +} + +pub fn schema() -> Result { + let file_info = Object::new("FileInfo") + .field(Field::new("id", TypeRef::named_nn(TypeRef::ID), |ctx| { + FieldFuture::new(async { + let file_info = ctx.parent_value.try_downcast_ref::()?; + Ok(Some(Value::from(&file_info.id))) + }) + })) + .field(Field::new( + "url", + TypeRef::named_nn(TypeRef::STRING), + |ctx| { + FieldFuture::new(async { + let file_info = ctx.parent_value.try_downcast_ref::()?; + Ok(Some(Value::from(&file_info.url))) + }) + }, + )); + + let query = Object::new("Query").field(Field::new( + "uploads", + TypeRef::named_nn_list_nn(file_info.type_name()), + |ctx| { + FieldFuture::new(async move { + let storage = ctx.data_unchecked::().lock().await; + Ok(Some(FieldValue::list( + storage + .iter() + .map(|(_, file)| FieldValue::owned_any(file.clone())), + ))) + }) + }, + )); + + let mutation = Object::new("Mutation") + .field( + Field::new( + "singleUpload", + TypeRef::named_nn(file_info.type_name()), + |ctx| { + FieldFuture::new(async move { + let mut storage = ctx.data_unchecked::().lock().await; + let file = ctx.args.try_get("file")?.upload()?; + let entry = storage.vacant_entry(); + let upload = file.value(&ctx).unwrap(); + let info = FileInfo { + id: entry.key().to_string(), + url: upload.filename.clone(), + }; + entry.insert(info.clone()); + Ok(Some(FieldValue::owned_any(info))) + }) + }, + ) + .argument(InputValue::new("file", TypeRef::named_nn(TypeRef::UPLOAD))), + ) + .field( + Field::new( + "multipleUpload", + TypeRef::named_nn_list_nn(file_info.type_name()), + |ctx| { + FieldFuture::new(async move { + let mut infos = Vec::new(); + let mut storage = ctx.data_unchecked::().lock().await; + for item in ctx.args.try_get("files")?.list()?.iter() { + let file = item.upload()?; + let entry = storage.vacant_entry(); + let upload = file.value(&ctx).unwrap(); + let info = FileInfo { + id: entry.key().to_string(), + url: upload.filename.clone(), + }; + entry.insert(info.clone()); + infos.push(FieldValue::owned_any(info)) + } + Ok(Some(infos)) + }) + }, + ) + .argument(InputValue::new( + "files", + TypeRef::named_nn_list_nn(TypeRef::UPLOAD), + )), + ); + + Schema::build(query.type_name(), Some(mutation.type_name()), None) + .enable_uploading() + .register(file_info) + .register(query) + .register(mutation) + .data(Storage::default()) + .finish() +} diff --git a/models/files/src/lib.rs b/models/files/src/lib.rs index da273ef..0e9b310 100644 --- a/models/files/src/lib.rs +++ b/models/files/src/lib.rs @@ -28,7 +28,6 @@ pub struct MutationRoot; impl MutationRoot { async fn single_upload(&self, ctx: &Context<'_>, file: Upload) -> FileInfo { let mut storage = ctx.data_unchecked::().lock().await; - println!("files count: {}", storage.len()); let entry = storage.vacant_entry(); let upload = file.value(ctx).unwrap(); let info = FileInfo { diff --git a/poem/dynamic-upload/Cargo.toml b/poem/dynamic-upload/Cargo.toml new file mode 100644 index 0000000..1775375 --- /dev/null +++ b/poem/dynamic-upload/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "dynamic-upload" +version = "0.1.0" +edition = "2021" + +[dependencies] +async-graphql = { path = "../../..", features = ["dynamic-schema"] } +async-graphql-poem = { path = "../../../integrations/poem" } +tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } +dynamic-files = { path = "../../models/dynamic-files" } +poem = "1.3.48" diff --git a/poem/dynamic-upload/src/main.rs b/poem/dynamic-upload/src/main.rs new file mode 100644 index 0000000..1d357dc --- /dev/null +++ b/poem/dynamic-upload/src/main.rs @@ -0,0 +1,22 @@ +use async_graphql::http::GraphiQLSource; +use async_graphql_poem::GraphQL; +use poem::{get, handler, listener::TcpListener, web::Html, IntoResponse, Route, Server}; + +#[handler] +async fn graphiql() -> impl IntoResponse { + Html(GraphiQLSource::build().endpoint("/").finish()) +} + +#[tokio::main] +async fn main() { + let app = Route::new().at( + "/", + get(graphiql).post(GraphQL::new(dynamic_files::schema().unwrap())), + ); + + println!("GraphiQL IDE: http://localhost:8000"); + Server::new(TcpListener::bind("0.0.0.0:8000")) + .run(app) + .await + .unwrap(); +} From 400ff0a13520fe417532b7747c76529469fd4fb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sylwester=20R=C4=85pa=C5=82a?= Date: Fri, 13 Oct 2023 08:56:34 +0200 Subject: [PATCH 073/102] fix: use correct start scripts for federations --- federation/dynamic-schema/start.sh | 14 +++++++------- federation/static-schema/start.sh | 12 ++++++------ 2 files changed, 13 insertions(+), 13 deletions(-) mode change 100644 => 100755 federation/dynamic-schema/start.sh mode change 100644 => 100755 federation/static-schema/start.sh diff --git a/federation/dynamic-schema/start.sh b/federation/dynamic-schema/start.sh old mode 100644 new mode 100755 index 6bb75b1..f027cfd --- a/federation/dynamic-schema/start.sh +++ b/federation/dynamic-schema/start.sh @@ -11,17 +11,17 @@ function cleanup { } trap cleanup EXIT -cargo build --bin static-federation-accounts -cargo build --bin static-federation-products -cargo build --bin static-federation-reviews +cargo build --bin dynamic-federation-accounts +cargo build --bin dynamic-federation-products +cargo build --bin dynamic-federation-reviews -cargo run --bin static-federation-accounts & +cargo run --bin dynamic-federation-accounts & ACCOUNTS_PID=$! -cargo run --bin static-federation-products & +cargo run --bin dynamic-federation-products & PRODUCTS_PID=$! -cargo run --bin static-federation-reviews & +cargo run --bin dynamic-federation-reviews & REVIEWS_PID=$! sleep 3 @@ -33,4 +33,4 @@ PRODUCTS_ROVER_PID=$! sleep 1 rover dev --url http://localhost:4003 --name reviews & REVIEWS_ROVER_PID=$! -fg %4 \ No newline at end of file +fg %4 diff --git a/federation/static-schema/start.sh b/federation/static-schema/start.sh old mode 100644 new mode 100755 index 0c931dd..6bb75b1 --- a/federation/static-schema/start.sh +++ b/federation/static-schema/start.sh @@ -11,17 +11,17 @@ function cleanup { } trap cleanup EXIT -cargo build --bin dynamic-federation-accounts -cargo build --bin dynamic-federation-products -cargo build --bin dynamic-federation-reviews +cargo build --bin static-federation-accounts +cargo build --bin static-federation-products +cargo build --bin static-federation-reviews -cargo run --bin dynamic-federation-accounts & +cargo run --bin static-federation-accounts & ACCOUNTS_PID=$! -cargo run --bin dynamic-federation-products & +cargo run --bin static-federation-products & PRODUCTS_PID=$! -cargo run --bin dynamic-federation-reviews & +cargo run --bin static-federation-reviews & REVIEWS_PID=$! sleep 3 From b162f4e7b24deb65ea6919505278f5897db829a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sylwester=20R=C4=85pa=C5=82a?= Date: Fri, 13 Oct 2023 09:03:41 +0200 Subject: [PATCH 074/102] fix: before killing pid check for existance. Continue for all pids --- federation/dynamic-schema/start.sh | 9 ++++----- federation/static-schema/start.sh | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/federation/dynamic-schema/start.sh b/federation/dynamic-schema/start.sh index f027cfd..6e6b8a1 100755 --- a/federation/dynamic-schema/start.sh +++ b/federation/dynamic-schema/start.sh @@ -3,11 +3,10 @@ set -eumo pipefail function cleanup { - kill "$PRODUCTS_ROVER_PID" - kill "$REVIEWS_ROVER_PID" - kill "$ACCOUNTS_PID" - kill "$PRODUCTS_PID" - kill "$REVIEWS_PID" + for pid in "${PRODUCTS_ROVER_PID:-}" "${REVIEWS_ROVER_PID:-}" "${ACCOUNTS_PID:-}" "${PRODUCTS_PID:-}" "${REVIEWS_PID:-}"; do + # try kill all registered pids + [ -n "$pid" ] && kill -0 "$pid" 2>/dev/null && kill "$pid" || echo "Could not kill $pid" + done } trap cleanup EXIT diff --git a/federation/static-schema/start.sh b/federation/static-schema/start.sh index 6bb75b1..d174905 100755 --- a/federation/static-schema/start.sh +++ b/federation/static-schema/start.sh @@ -3,11 +3,10 @@ set -eumo pipefail function cleanup { - kill "$PRODUCTS_ROVER_PID" - kill "$REVIEWS_ROVER_PID" - kill "$ACCOUNTS_PID" - kill "$PRODUCTS_PID" - kill "$REVIEWS_PID" + for pid in "${PRODUCTS_ROVER_PID:-}" "${REVIEWS_ROVER_PID:-}" "${ACCOUNTS_PID:-}" "${PRODUCTS_PID:-}" "${REVIEWS_PID:-}"; do + # try kill all registered pids + [ -n "$pid" ] && kill -0 "$pid" 2>/dev/null && kill "$pid" || echo "Could not kill $pid" + done } trap cleanup EXIT From 6abb6737468104c3f709d4ad92e313bdd61523ba Mon Sep 17 00:00:00 2001 From: Sunli Date: Sat, 4 Nov 2023 12:14:17 +0800 Subject: [PATCH 075/102] Update Cargo.toml --- poem/opentelemetry-basic/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/poem/opentelemetry-basic/Cargo.toml b/poem/opentelemetry-basic/Cargo.toml index d207fe5..33dcee5 100644 --- a/poem/opentelemetry-basic/Cargo.toml +++ b/poem/opentelemetry-basic/Cargo.toml @@ -10,4 +10,4 @@ async-graphql = { path = "../../..", features = ["opentelemetry"] } async-graphql-poem = { path = "../../../integrations/poem" } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } poem = "1.3.42" -opentelemetry = { version = "0.19.0", features = ["rt-tokio"] } +opentelemetry = { version = "0.20.0", features = ["rt-tokio"] } From cff9ebc6b274f3db811c29c0920dbd099a638ab8 Mon Sep 17 00:00:00 2001 From: Sunli Date: Sat, 4 Nov 2023 12:46:06 +0800 Subject: [PATCH 076/102] update examples --- poem/opentelemetry-basic/Cargo.toml | 1 + poem/opentelemetry-basic/src/main.rs | 7 +++++-- tide/dataloader-postgres/Cargo.toml | 5 ++++- tide/dataloader/Cargo.toml | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/poem/opentelemetry-basic/Cargo.toml b/poem/opentelemetry-basic/Cargo.toml index 33dcee5..7aadfc0 100644 --- a/poem/opentelemetry-basic/Cargo.toml +++ b/poem/opentelemetry-basic/Cargo.toml @@ -11,3 +11,4 @@ async-graphql-poem = { path = "../../../integrations/poem" } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } poem = "1.3.42" opentelemetry = { version = "0.20.0", features = ["rt-tokio"] } +opentelemetry-stdout = { version = "0.1.0", features = ["trace"] } diff --git a/poem/opentelemetry-basic/src/main.rs b/poem/opentelemetry-basic/src/main.rs index 6647856..cb7c34f 100644 --- a/poem/opentelemetry-basic/src/main.rs +++ b/poem/opentelemetry-basic/src/main.rs @@ -2,7 +2,7 @@ use async_graphql::{ extensions::OpenTelemetry, EmptyMutation, EmptySubscription, Object, Result, Schema, }; use async_graphql_poem::GraphQL; -use opentelemetry::sdk::export::trace::stdout; +use opentelemetry::{sdk::trace::TracerProvider, trace::TracerProvider as _}; use poem::{listener::TcpListener, post, EndpointExt, Route, Server}; struct QueryRoot; @@ -16,7 +16,10 @@ impl QueryRoot { #[tokio::main] async fn main() { - let tracer = stdout::new_pipeline().install_simple(); + let provider = TracerProvider::builder() + .with_simple_exporter(opentelemetry_stdout::SpanExporter::default()) + .build(); + let tracer = provider.tracer("poem-opentelemetry-basic"); let opentelemetry_extension = OpenTelemetry::new(tracer); let schema = Schema::build(QueryRoot, EmptyMutation, EmptySubscription) diff --git a/tide/dataloader-postgres/Cargo.toml b/tide/dataloader-postgres/Cargo.toml index 4a95873..d85aa87 100644 --- a/tide/dataloader-postgres/Cargo.toml +++ b/tide/dataloader-postgres/Cargo.toml @@ -10,7 +10,10 @@ async-graphql-tide = { path = "../../../integrations/tide" } async-std = "1.9.0" async-trait = "0.1.42" itertools = "0.10.0" -sqlx = { version = "0.6.2", features = ["runtime-async-std-rustls", "postgres"] } +sqlx = { version = "0.7.2", features = [ + "runtime-async-std-rustls", + "postgres", +] } tide = "0.16.0" [dev-dependencies] diff --git a/tide/dataloader/Cargo.toml b/tide/dataloader/Cargo.toml index ec7da1d..65eaf3c 100644 --- a/tide/dataloader/Cargo.toml +++ b/tide/dataloader/Cargo.toml @@ -9,7 +9,7 @@ async-graphql = { path = "../../..", features = ["dataloader"] } async-graphql-tide = { path = "../../../integrations/tide" } tide = "0.16" async-std = "1.9.0" -sqlx = { version = "0.5.5", features = ["sqlite", "runtime-async-std-rustls"] } +sqlx = { version = "0.7.2", features = ["sqlite", "runtime-async-std-rustls"] } async-trait = "0.1.30" itertools = "0.9.0" From 6c7157b5226fc32a7efb597057c6a28e0b24556b Mon Sep 17 00:00:00 2001 From: Lawrence Coleman Date: Sat, 4 Nov 2023 17:03:51 -0500 Subject: [PATCH 077/102] Add information on how to run to README --- README.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/README.md b/README.md index 21aa3f8..8a9e221 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ # Examples for async-graphql +A git submodule that shows example async-graphql projects. + + ## Directory structure - [poem] Examples for `poem` @@ -9,3 +12,28 @@ - [rocket] Examples for `rocket` - [axum] Examples for `axum` - [federation] Examples for [Apollo Federation](https://www.apollographql.com/docs/federation/) + + +## Running Examples + +To run the examples, clone the top-level repo, [async-graphql](https://github.com/async-graphql/async-graphql) and then issue the following commands: + +```bash +git clone async-graphql/async-graphql +# in async-graphql repo, install needed dependencies +cargo build + +# update this repo as a git submodule +git submodule update +``` + +To run the example axum-starwars: +``` +# change into the example folder and run a relevant binary +cargo run --bin axum-starwars +``` + +To list all available binary targets: +``` +cargo run --bin +``` \ No newline at end of file From 966d899c65a1255be4a6f85d0a825a945e4bbb93 Mon Sep 17 00:00:00 2001 From: Sunli Date: Sat, 18 Nov 2023 10:10:46 +0800 Subject: [PATCH 078/102] bump opentelemetry from `0.20.0` to `0.21.0` --- poem/opentelemetry-basic/Cargo.toml | 5 +++-- poem/opentelemetry-basic/src/main.rs | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/poem/opentelemetry-basic/Cargo.toml b/poem/opentelemetry-basic/Cargo.toml index 7aadfc0..f0e467f 100644 --- a/poem/opentelemetry-basic/Cargo.toml +++ b/poem/opentelemetry-basic/Cargo.toml @@ -10,5 +10,6 @@ async-graphql = { path = "../../..", features = ["opentelemetry"] } async-graphql-poem = { path = "../../../integrations/poem" } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } poem = "1.3.42" -opentelemetry = { version = "0.20.0", features = ["rt-tokio"] } -opentelemetry-stdout = { version = "0.1.0", features = ["trace"] } +opentelemetry = { version = "0.21.0" } +opentelemetry_sdk = { version = "0.21", features = ["rt-tokio"] } +opentelemetry-stdout = { version = "0.2.0", features = ["trace"] } diff --git a/poem/opentelemetry-basic/src/main.rs b/poem/opentelemetry-basic/src/main.rs index cb7c34f..897f316 100644 --- a/poem/opentelemetry-basic/src/main.rs +++ b/poem/opentelemetry-basic/src/main.rs @@ -2,7 +2,8 @@ use async_graphql::{ extensions::OpenTelemetry, EmptyMutation, EmptySubscription, Object, Result, Schema, }; use async_graphql_poem::GraphQL; -use opentelemetry::{sdk::trace::TracerProvider, trace::TracerProvider as _}; +use opentelemetry::trace::TracerProvider as _; +use opentelemetry_sdk::trace::TracerProvider; use poem::{listener::TcpListener, post, EndpointExt, Route, Server}; struct QueryRoot; From 1dcd0b2c888298e4e65143d3af58923153f96cf1 Mon Sep 17 00:00:00 2001 From: Sunli Date: Sun, 10 Dec 2023 09:47:08 +0800 Subject: [PATCH 079/102] update for axum07 --- axum/starwars/Cargo.toml | 2 +- axum/starwars/src/main.rs | 6 +++--- axum/subscription/Cargo.toml | 2 +- axum/token-from-header/Cargo.toml | 2 +- axum/upload/Cargo.toml | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/axum/starwars/Cargo.toml b/axum/starwars/Cargo.toml index ea26bb2..6d6efee 100644 --- a/axum/starwars/Cargo.toml +++ b/axum/starwars/Cargo.toml @@ -9,4 +9,4 @@ async-graphql-axum = { path = "../../../integrations/axum" } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } starwars = { path = "../../models/starwars" } hyper = "0.14" -axum = { version = "0.6.0", features = ["headers"] } +axum = { version = "0.7.0" } diff --git a/axum/starwars/src/main.rs b/axum/starwars/src/main.rs index dea53f9..52c7a1a 100644 --- a/axum/starwars/src/main.rs +++ b/axum/starwars/src/main.rs @@ -3,9 +3,10 @@ use async_graphql_axum::GraphQL; use axum::{ response::{self, IntoResponse}, routing::get, - Router, Server, + Router, }; use starwars::{QueryRoot, StarWars}; +use tokio::net::TcpListener; async fn graphiql() -> impl IntoResponse { response::Html(GraphiQLSource::build().endpoint("/").finish()) @@ -21,8 +22,7 @@ async fn main() { println!("GraphiQL IDE: http://localhost:8000"); - Server::bind(&"127.0.0.1:8000".parse().unwrap()) - .serve(app.into_make_service()) + axum::serve(TcpListener::bind("127.0.0.1:8000").await.unwrap(), app) .await .unwrap(); } diff --git a/axum/subscription/Cargo.toml b/axum/subscription/Cargo.toml index 6a13791..d692458 100644 --- a/axum/subscription/Cargo.toml +++ b/axum/subscription/Cargo.toml @@ -9,4 +9,4 @@ async-graphql-axum = { path = "../../../integrations/axum" } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } books = { path = "../../models/books" } hyper = "0.14" -axum = { version = "0.6.0", features = ["ws", "headers"] } +axum = { version = "0.7.0", features = ["ws"] } diff --git a/axum/token-from-header/Cargo.toml b/axum/token-from-header/Cargo.toml index 612b3de..c000b31 100644 --- a/axum/token-from-header/Cargo.toml +++ b/axum/token-from-header/Cargo.toml @@ -9,4 +9,4 @@ async-graphql-axum = { path = "../../../integrations/axum" } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } token = { path = "../../models/token" } hyper = "0.14" -axum = { version = "0.6.0", features = ["ws", "headers"] } +axum = { version = "0.7.0", features = ["ws"] } diff --git a/axum/upload/Cargo.toml b/axum/upload/Cargo.toml index e074bd4..36cbde0 100644 --- a/axum/upload/Cargo.toml +++ b/axum/upload/Cargo.toml @@ -7,8 +7,8 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-axum = { path = "../../../integrations/axum" } -axum = "0.6.0" +axum = "0.7.0" files = { path = "../../models/files" } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } hyper = "0.14" -tower-http = { version = "0.2.1", features = ["cors"] } +tower-http = { version = "0.5.0", features = ["cors"] } From 6b6262f352a0577aefb47ed7cf57d359c99c4a72 Mon Sep 17 00:00:00 2001 From: Sunli Date: Sat, 16 Dec 2023 08:31:31 +0800 Subject: [PATCH 080/102] update for axum07 --- axum/starwars/Cargo.toml | 1 - axum/subscription/Cargo.toml | 3 +-- axum/subscription/src/main.rs | 6 +++--- axum/token-from-header/Cargo.toml | 1 - axum/token-from-header/src/main.rs | 3 +-- axum/upload/Cargo.toml | 1 - axum/upload/src/main.rs | 12 ++++++------ 7 files changed, 11 insertions(+), 16 deletions(-) diff --git a/axum/starwars/Cargo.toml b/axum/starwars/Cargo.toml index 6d6efee..1defbe2 100644 --- a/axum/starwars/Cargo.toml +++ b/axum/starwars/Cargo.toml @@ -8,5 +8,4 @@ async-graphql = { path = "../../.." } async-graphql-axum = { path = "../../../integrations/axum" } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } starwars = { path = "../../models/starwars" } -hyper = "0.14" axum = { version = "0.7.0" } diff --git a/axum/subscription/Cargo.toml b/axum/subscription/Cargo.toml index d692458..6001b29 100644 --- a/axum/subscription/Cargo.toml +++ b/axum/subscription/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "subscription" +name = "axum-subscription" version = "0.1.0" edition = "2021" @@ -8,5 +8,4 @@ async-graphql = { path = "../../.." } async-graphql-axum = { path = "../../../integrations/axum" } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } books = { path = "../../models/books" } -hyper = "0.14" axum = { version = "0.7.0", features = ["ws"] } diff --git a/axum/subscription/src/main.rs b/axum/subscription/src/main.rs index 46cee97..348c61e 100644 --- a/axum/subscription/src/main.rs +++ b/axum/subscription/src/main.rs @@ -3,9 +3,10 @@ use async_graphql_axum::{GraphQL, GraphQLSubscription}; use axum::{ response::{self, IntoResponse}, routing::get, - Router, Server, + Router, }; use books::{MutationRoot, QueryRoot, Storage, SubscriptionRoot}; +use tokio::net::TcpListener; async fn graphiql() -> impl IntoResponse { response::Html( @@ -31,8 +32,7 @@ async fn main() { println!("GraphiQL IDE: http://localhost:8000"); - Server::bind(&"127.0.0.1:8000".parse().unwrap()) - .serve(app.into_make_service()) + axum::serve(TcpListener::bind("127.0.0.1:8000").await.unwrap(), app) .await .unwrap(); } diff --git a/axum/token-from-header/Cargo.toml b/axum/token-from-header/Cargo.toml index c000b31..33726d3 100644 --- a/axum/token-from-header/Cargo.toml +++ b/axum/token-from-header/Cargo.toml @@ -8,5 +8,4 @@ async-graphql = { path = "../../.." } async-graphql-axum = { path = "../../../integrations/axum" } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } token = { path = "../../models/token" } -hyper = "0.14" axum = { version = "0.7.0", features = ["ws"] } diff --git a/axum/token-from-header/src/main.rs b/axum/token-from-header/src/main.rs index 44a886c..0883679 100644 --- a/axum/token-from-header/src/main.rs +++ b/axum/token-from-header/src/main.rs @@ -61,8 +61,7 @@ async fn main() { println!("Playground: http://localhost:8000"); - Server::bind(&"127.0.0.1:8000".parse().unwrap()) - .serve(app.into_make_service()) + axum::serve(TcpListener::bind("127.0.0.1:8000").await.unwrap(), app) .await .unwrap(); } diff --git a/axum/upload/Cargo.toml b/axum/upload/Cargo.toml index 36cbde0..9f8e7ab 100644 --- a/axum/upload/Cargo.toml +++ b/axum/upload/Cargo.toml @@ -10,5 +10,4 @@ async-graphql-axum = { path = "../../../integrations/axum" } axum = "0.7.0" files = { path = "../../models/files" } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } -hyper = "0.14" tower-http = { version = "0.5.0", features = ["cors"] } diff --git a/axum/upload/src/main.rs b/axum/upload/src/main.rs index a334cc6..f56b142 100644 --- a/axum/upload/src/main.rs +++ b/axum/upload/src/main.rs @@ -1,13 +1,14 @@ use async_graphql::{http::GraphiQLSource, EmptySubscription, Schema}; use async_graphql_axum::GraphQL; use axum::{ + http::Method, response::{Html, IntoResponse}, routing::get, Router, }; use files::{MutationRoot, QueryRoot, Storage}; -use hyper::{Method, Server}; -use tower_http::cors::{CorsLayer, Origin}; +use tokio::net::TcpListener; +use tower_http::cors::{AllowOrigin, CorsLayer}; async fn graphiql() -> impl IntoResponse { Html(GraphiQLSource::build().endpoint("/").finish()) @@ -25,12 +26,11 @@ async fn main() { .route("/", get(graphiql).post_service(GraphQL::new(schema))) .layer( CorsLayer::new() - .allow_origin(Origin::predicate(|_, _| true)) - .allow_methods(vec![Method::GET, Method::POST]), + .allow_origin(AllowOrigin::predicate(|_, _| true)) + .allow_methods([Method::GET, Method::POST]), ); - Server::bind(&"127.0.0.1:8000".parse().unwrap()) - .serve(app.into_make_service()) + axum::serve(TcpListener::bind("127.0.0.1:8000").await.unwrap(), app) .await .unwrap(); } From b06819714f57b27cad2af389e434f51528a21fff Mon Sep 17 00:00:00 2001 From: Sunli Date: Sat, 16 Dec 2023 10:43:26 +0800 Subject: [PATCH 081/102] update for axum07 --- axum/token-from-header/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/axum/token-from-header/src/main.rs b/axum/token-from-header/src/main.rs index 0883679..57fd153 100644 --- a/axum/token-from-header/src/main.rs +++ b/axum/token-from-header/src/main.rs @@ -8,7 +8,7 @@ use axum::{ http::header::HeaderMap, response::{Html, IntoResponse, Response}, routing::get, - Router, Server, + Router, }; use token::{on_connection_init, QueryRoot, SubscriptionRoot, Token, TokenSchema}; From a57e1a62345ed9e5509c9b82643998a77e580845 Mon Sep 17 00:00:00 2001 From: Sunli Date: Sat, 16 Dec 2023 10:44:41 +0800 Subject: [PATCH 082/102] update for axum07 --- axum/token-from-header/src/main.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/axum/token-from-header/src/main.rs b/axum/token-from-header/src/main.rs index 57fd153..8bd2c43 100644 --- a/axum/token-from-header/src/main.rs +++ b/axum/token-from-header/src/main.rs @@ -11,6 +11,7 @@ use axum::{ Router, }; use token::{on_connection_init, QueryRoot, SubscriptionRoot, Token, TokenSchema}; +use tokio::net::TcpListener; async fn graphql_playground() -> impl IntoResponse { Html(playground_source( From 2ce9be649133cacd6b8648c70863ed074c835739 Mon Sep 17 00:00:00 2001 From: Sunli Date: Sat, 6 Jan 2024 09:53:51 +0800 Subject: [PATCH 083/102] update examples --- federation/dynamic-schema/federation-accounts/Cargo.toml | 2 +- federation/dynamic-schema/federation-products/Cargo.toml | 2 +- federation/dynamic-schema/federation-reviews/Cargo.toml | 2 +- federation/static-schema/federation-accounts/Cargo.toml | 2 +- federation/static-schema/federation-products/Cargo.toml | 2 +- federation/static-schema/federation-reviews/Cargo.toml | 2 +- poem/dynamic-books/Cargo.toml | 2 +- poem/dynamic-schema/Cargo.toml | 2 +- poem/dynamic-starwars/Cargo.toml | 2 +- poem/dynamic-upload/Cargo.toml | 2 +- poem/opentelemetry-basic/Cargo.toml | 2 +- poem/starwars/Cargo.toml | 2 +- poem/subscription-redis/Cargo.toml | 2 +- poem/subscription/Cargo.toml | 2 +- poem/token-from-header/Cargo.toml | 2 +- poem/upload/Cargo.toml | 2 +- rocket/starwars/Cargo.toml | 2 +- rocket/upload/Cargo.toml | 2 +- 18 files changed, 18 insertions(+), 18 deletions(-) diff --git a/federation/dynamic-schema/federation-accounts/Cargo.toml b/federation/dynamic-schema/federation-accounts/Cargo.toml index 85c905e..738603e 100644 --- a/federation/dynamic-schema/federation-accounts/Cargo.toml +++ b/federation/dynamic-schema/federation-accounts/Cargo.toml @@ -7,4 +7,4 @@ edition = "2021" async-graphql = { path = "../../../..", features = ["dynamic-schema"] } async-graphql-poem = { path = "../../../../integrations/poem" } tokio = { version = "1.0.2", features = ["macros", "rt-multi-thread"] } -poem = { version = "1.3.43" } +poem = { version = "2.0.0" } diff --git a/federation/dynamic-schema/federation-products/Cargo.toml b/federation/dynamic-schema/federation-products/Cargo.toml index 82cddc5..c03b8c7 100644 --- a/federation/dynamic-schema/federation-products/Cargo.toml +++ b/federation/dynamic-schema/federation-products/Cargo.toml @@ -7,4 +7,4 @@ edition = "2021" async-graphql = { path = "../../../..", features = ["dynamic-schema"] } async-graphql-poem = { path = "../../../../integrations/poem" } tokio = { version = "1.0.2", features = ["macros", "rt-multi-thread"] } -poem = { version = "1.3.43" } +poem = { version = "2.0.0" } diff --git a/federation/dynamic-schema/federation-reviews/Cargo.toml b/federation/dynamic-schema/federation-reviews/Cargo.toml index 912ba03..92ea76e 100644 --- a/federation/dynamic-schema/federation-reviews/Cargo.toml +++ b/federation/dynamic-schema/federation-reviews/Cargo.toml @@ -7,4 +7,4 @@ edition = "2021" async-graphql = { path = "../../../..", features = ["dynamic-schema"] } async-graphql-poem = { path = "../../../../integrations/poem" } tokio = { version = "1.0.2", features = ["macros", "rt-multi-thread"] } -poem = { version = "1.3.43" } +poem = { version = "2.0.0" } diff --git a/federation/static-schema/federation-accounts/Cargo.toml b/federation/static-schema/federation-accounts/Cargo.toml index ba1ba79..8698ba9 100644 --- a/federation/static-schema/federation-accounts/Cargo.toml +++ b/federation/static-schema/federation-accounts/Cargo.toml @@ -9,4 +9,4 @@ async-graphql = { path = "../../../.." } async-graphql-poem = { path = "../../../../integrations/poem" } directives = { path = "../directives" } tokio = { version = "1.0.2", features = ["macros", "rt-multi-thread"] } -poem = { version = "1.3.43" } +poem = { version = "2.0.0" } diff --git a/federation/static-schema/federation-products/Cargo.toml b/federation/static-schema/federation-products/Cargo.toml index c276979..ad6f60f 100644 --- a/federation/static-schema/federation-products/Cargo.toml +++ b/federation/static-schema/federation-products/Cargo.toml @@ -9,4 +9,4 @@ async-graphql = { path = "../../../.." } async-graphql-poem = { path = "../../../../integrations/poem" } directives = { path = "../directives" } tokio = { version = "1.0.2", features = ["macros", "rt-multi-thread"] } -poem = { version = "1.3.43" } +poem = { version = "2.0.0" } diff --git a/federation/static-schema/federation-reviews/Cargo.toml b/federation/static-schema/federation-reviews/Cargo.toml index 74b63a7..574acd1 100644 --- a/federation/static-schema/federation-reviews/Cargo.toml +++ b/federation/static-schema/federation-reviews/Cargo.toml @@ -9,4 +9,4 @@ async-graphql = { path = "../../../.." } async-graphql-poem = { path = "../../../../integrations/poem" } directives = { path = "../directives" } tokio = { version = "1.0.2", features = ["macros", "rt-multi-thread"] } -poem = { version = "1.3.43" } +poem = { version = "2.0.0" } diff --git a/poem/dynamic-books/Cargo.toml b/poem/dynamic-books/Cargo.toml index a755e8b..4892def 100644 --- a/poem/dynamic-books/Cargo.toml +++ b/poem/dynamic-books/Cargo.toml @@ -8,4 +8,4 @@ async-graphql = { path = "../../..", features = ["dynamic-schema"] } async-graphql-poem = { path = "../../../integrations/poem" } tokio = { version = "1.29", features = ["macros", "rt-multi-thread"] } dynamic-books = { path = "../../models/dynamic-books" } -poem = "1.3.57" +poem = "2.0.0" diff --git a/poem/dynamic-schema/Cargo.toml b/poem/dynamic-schema/Cargo.toml index 4060a9e..246ed99 100644 --- a/poem/dynamic-schema/Cargo.toml +++ b/poem/dynamic-schema/Cargo.toml @@ -7,4 +7,4 @@ edition = "2021" async-graphql = { path = "../../..", features = ["dynamic-schema"] } async-graphql-poem = { path = "../../../integrations/poem" } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } -poem = "1.3.48" +poem = "2.0.0" diff --git a/poem/dynamic-starwars/Cargo.toml b/poem/dynamic-starwars/Cargo.toml index ecf98e3..4db9d67 100644 --- a/poem/dynamic-starwars/Cargo.toml +++ b/poem/dynamic-starwars/Cargo.toml @@ -8,4 +8,4 @@ async-graphql = { path = "../../..", features = ["dynamic-schema"] } async-graphql-poem = { path = "../../../integrations/poem" } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } dynamic-starwars = { path = "../../models/dynamic-starwars" } -poem = "1.3.48" +poem = "2.0.0" diff --git a/poem/dynamic-upload/Cargo.toml b/poem/dynamic-upload/Cargo.toml index 1775375..ac02bc3 100644 --- a/poem/dynamic-upload/Cargo.toml +++ b/poem/dynamic-upload/Cargo.toml @@ -8,4 +8,4 @@ async-graphql = { path = "../../..", features = ["dynamic-schema"] } async-graphql-poem = { path = "../../../integrations/poem" } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } dynamic-files = { path = "../../models/dynamic-files" } -poem = "1.3.48" +poem = "2.0.0" diff --git a/poem/opentelemetry-basic/Cargo.toml b/poem/opentelemetry-basic/Cargo.toml index f0e467f..cd4b1fa 100644 --- a/poem/opentelemetry-basic/Cargo.toml +++ b/poem/opentelemetry-basic/Cargo.toml @@ -9,7 +9,7 @@ edition = "2021" async-graphql = { path = "../../..", features = ["opentelemetry"] } async-graphql-poem = { path = "../../../integrations/poem" } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } -poem = "1.3.42" +poem = "2.0.0" opentelemetry = { version = "0.21.0" } opentelemetry_sdk = { version = "0.21", features = ["rt-tokio"] } opentelemetry-stdout = { version = "0.2.0", features = ["trace"] } diff --git a/poem/starwars/Cargo.toml b/poem/starwars/Cargo.toml index 06567d1..ec23009 100644 --- a/poem/starwars/Cargo.toml +++ b/poem/starwars/Cargo.toml @@ -8,4 +8,4 @@ async-graphql = { path = "../../.." } async-graphql-poem = { path = "../../../integrations/poem" } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } starwars = { path = "../../models/starwars" } -poem = "1.3.48" +poem = "2.0.0" diff --git a/poem/subscription-redis/Cargo.toml b/poem/subscription-redis/Cargo.toml index ee2913a..647f4ca 100644 --- a/poem/subscription-redis/Cargo.toml +++ b/poem/subscription-redis/Cargo.toml @@ -7,6 +7,6 @@ edition = "2021" async-graphql = { path = "../../.." } async-graphql-poem = { path = "../../../integrations/poem" } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } -poem = { version = "1.3.48", features = ["websocket"] } +poem = { version = "2.0.0", features = ["websocket"] } redis = { version = "0.21.4", features = ["aio", "tokio-comp"] } futures-util = "0.3.19" diff --git a/poem/subscription/Cargo.toml b/poem/subscription/Cargo.toml index b80dda2..015f127 100644 --- a/poem/subscription/Cargo.toml +++ b/poem/subscription/Cargo.toml @@ -8,4 +8,4 @@ async-graphql = { path = "../../.." } async-graphql-poem = { path = "../../../integrations/poem" } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } books = { path = "../../models/books" } -poem = { version = "1.3.48", features = ["websocket"] } +poem = { version = "2.0.0", features = ["websocket"] } diff --git a/poem/token-from-header/Cargo.toml b/poem/token-from-header/Cargo.toml index bb9a52a..033fad1 100644 --- a/poem/token-from-header/Cargo.toml +++ b/poem/token-from-header/Cargo.toml @@ -7,5 +7,5 @@ edition = "2021" async-graphql = { path = "../../.." } async-graphql-poem = { path = "../../../integrations/poem" } token = { path = "../../models/token" } -poem = { version = "1.3.48", features = ["websocket"] } +poem = { version = "2.0.0", features = ["websocket"] } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } diff --git a/poem/upload/Cargo.toml b/poem/upload/Cargo.toml index c52f2c3..1e6b5ee 100644 --- a/poem/upload/Cargo.toml +++ b/poem/upload/Cargo.toml @@ -7,6 +7,6 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-poem = { path = "../../../integrations/poem" } -poem = { version = "1.3.48", features = ["websocket"] } +poem = { version = "2.0.0", features = ["websocket"] } files = { path = "../../models/files" } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } diff --git a/rocket/starwars/Cargo.toml b/rocket/starwars/Cargo.toml index a8234f6..ff65574 100644 --- a/rocket/starwars/Cargo.toml +++ b/rocket/starwars/Cargo.toml @@ -7,5 +7,5 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-rocket = { path = "../../../integrations/rocket" } -rocket = { version = "0.5.0-rc.2", default-features = false } +rocket = { version = "0.5.0", default-features = false } starwars = { path = "../../models/starwars" } diff --git a/rocket/upload/Cargo.toml b/rocket/upload/Cargo.toml index a5eca42..cdbf040 100644 --- a/rocket/upload/Cargo.toml +++ b/rocket/upload/Cargo.toml @@ -7,5 +7,5 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-rocket = { path = "../../../integrations/rocket" } -rocket = { version = "0.5.0-rc.2", default-features = false } +rocket = { version = "0.5.0", default-features = false } files = { path = "../../models/files" } From 711d360c6fa5bc4e100a8420a7fc8ccf3a2c3193 Mon Sep 17 00:00:00 2001 From: Sunli Date: Wed, 14 Feb 2024 11:16:32 +0800 Subject: [PATCH 084/102] update examples --- tide/dataloader-postgres/Cargo.toml | 1 - tide/dataloader-postgres/src/main.rs | 2 -- tide/dataloader/Cargo.toml | 1 - tide/dataloader/src/main.rs | 2 -- 4 files changed, 6 deletions(-) diff --git a/tide/dataloader-postgres/Cargo.toml b/tide/dataloader-postgres/Cargo.toml index d85aa87..35dffa1 100644 --- a/tide/dataloader-postgres/Cargo.toml +++ b/tide/dataloader-postgres/Cargo.toml @@ -8,7 +8,6 @@ edition = "2018" async-graphql = { path = "../../..", features = ["dataloader"] } async-graphql-tide = { path = "../../../integrations/tide" } async-std = "1.9.0" -async-trait = "0.1.42" itertools = "0.10.0" sqlx = { version = "0.7.2", features = [ "runtime-async-std-rustls", diff --git a/tide/dataloader-postgres/src/main.rs b/tide/dataloader-postgres/src/main.rs index 59f384b..26d22a6 100644 --- a/tide/dataloader-postgres/src/main.rs +++ b/tide/dataloader-postgres/src/main.rs @@ -7,7 +7,6 @@ use async_graphql::{ Context, EmptyMutation, EmptySubscription, FieldError, Object, Result, Schema, SimpleObject, }; use async_std::task; -use async_trait::async_trait; use sqlx::PgPool; use tide::{http::mime, Body, Response, StatusCode}; @@ -26,7 +25,6 @@ impl BookLoader { } } -#[async_trait] impl Loader for BookLoader { type Value = Book; type Error = FieldError; diff --git a/tide/dataloader/Cargo.toml b/tide/dataloader/Cargo.toml index 65eaf3c..1f4149a 100644 --- a/tide/dataloader/Cargo.toml +++ b/tide/dataloader/Cargo.toml @@ -10,7 +10,6 @@ async-graphql-tide = { path = "../../../integrations/tide" } tide = "0.16" async-std = "1.9.0" sqlx = { version = "0.7.2", features = ["sqlite", "runtime-async-std-rustls"] } -async-trait = "0.1.30" itertools = "0.9.0" [dev-dependencies] diff --git a/tide/dataloader/src/main.rs b/tide/dataloader/src/main.rs index 11615c6..a30f083 100644 --- a/tide/dataloader/src/main.rs +++ b/tide/dataloader/src/main.rs @@ -7,7 +7,6 @@ use async_graphql::{ Context, EmptyMutation, EmptySubscription, FieldError, Object, Result, Schema, SimpleObject, }; use async_std::task; -use async_trait::async_trait; use itertools::Itertools; use sqlx::{Pool, Sqlite}; use tide::{http::mime, Body, Response, StatusCode}; @@ -27,7 +26,6 @@ impl BookLoader { } } -#[async_trait] impl Loader for BookLoader { type Value = Book; type Error = FieldError; From cc1ee103682f1b98001c2c63b66f9fea2396c13b Mon Sep 17 00:00:00 2001 From: Negezor Date: Sat, 30 Mar 2024 13:59:13 +1100 Subject: [PATCH 085/102] chore(deps): update dependencies --- actix-web/error-extensions/Cargo.toml | 2 +- actix-web/starwars/Cargo.toml | 2 +- actix-web/subscription/Cargo.toml | 2 +- actix-web/token-from-header/Cargo.toml | 2 +- actix-web/upload/Cargo.toml | 2 +- axum/starwars/Cargo.toml | 4 ++-- axum/subscription/Cargo.toml | 4 ++-- axum/token-from-header/Cargo.toml | 4 ++-- axum/upload/Cargo.toml | 6 +++--- .../dynamic-schema/federation-accounts/Cargo.toml | 4 ++-- .../dynamic-schema/federation-products/Cargo.toml | 4 ++-- .../dynamic-schema/federation-reviews/Cargo.toml | 4 ++-- federation/static-schema/directives/Cargo.toml | 2 +- .../static-schema/federation-accounts/Cargo.toml | 4 ++-- .../static-schema/federation-products/Cargo.toml | 4 ++-- .../static-schema/federation-reviews/Cargo.toml | 4 ++-- models/books/Cargo.toml | 12 ++++++------ models/dynamic-books/Cargo.toml | 12 ++++++------ models/dynamic-files/Cargo.toml | 4 ++-- models/dynamic-starwars/Cargo.toml | 2 +- models/files/Cargo.toml | 4 ++-- models/starwars/Cargo.toml | 2 +- models/token/Cargo.toml | 2 +- poem/dynamic-books/Cargo.toml | 4 ++-- poem/dynamic-schema/Cargo.toml | 4 ++-- poem/dynamic-starwars/Cargo.toml | 4 ++-- poem/dynamic-upload/Cargo.toml | 4 ++-- poem/opentelemetry-basic/Cargo.toml | 10 +++++----- poem/starwars/Cargo.toml | 4 ++-- poem/subscription-redis/Cargo.toml | 8 ++++---- poem/subscription/Cargo.toml | 4 ++-- poem/token-from-header/Cargo.toml | 4 ++-- poem/upload/Cargo.toml | 4 ++-- tide/dataloader-postgres/Cargo.toml | 10 +++++----- tide/dataloader/Cargo.toml | 10 +++++----- tide/starwars/Cargo.toml | 6 +++--- tide/subscription/Cargo.toml | 2 +- warp/starwars/Cargo.toml | 2 +- warp/subscription/Cargo.toml | 2 +- warp/token-from-header/Cargo.toml | 2 +- 40 files changed, 88 insertions(+), 88 deletions(-) diff --git a/actix-web/error-extensions/Cargo.toml b/actix-web/error-extensions/Cargo.toml index a8281e4..013ac15 100644 --- a/actix-web/error-extensions/Cargo.toml +++ b/actix-web/error-extensions/Cargo.toml @@ -7,6 +7,6 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-actix-web = { path = "../../../integrations/actix-web" } -actix-web = { version = "4.0.1", default-features = false, features = ["macros"] } +actix-web = { version = "4.5.1", default-features = false, features = ["macros"] } thiserror = "1.0" serde_json = "1.0" diff --git a/actix-web/starwars/Cargo.toml b/actix-web/starwars/Cargo.toml index f02f3cf..b0173ae 100644 --- a/actix-web/starwars/Cargo.toml +++ b/actix-web/starwars/Cargo.toml @@ -7,5 +7,5 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-actix-web = { path = "../../../integrations/actix-web" } -actix-web = { version = "4.0.1", default-features = false, features = ["macros"] } +actix-web = { version = "4.5.1", default-features = false, features = ["macros"] } starwars = { path = "../../models/starwars" } diff --git a/actix-web/subscription/Cargo.toml b/actix-web/subscription/Cargo.toml index ef6b143..ae20b6f 100644 --- a/actix-web/subscription/Cargo.toml +++ b/actix-web/subscription/Cargo.toml @@ -7,5 +7,5 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-actix-web = { path = "../../../integrations/actix-web" } -actix-web = { version = "4.0.1", default-features = false, features = ["macros"] } +actix-web = { version = "4.5.1", default-features = false, features = ["macros"] } books = { path = "../../models/books" } diff --git a/actix-web/token-from-header/Cargo.toml b/actix-web/token-from-header/Cargo.toml index e27dd08..cb04c92 100644 --- a/actix-web/token-from-header/Cargo.toml +++ b/actix-web/token-from-header/Cargo.toml @@ -7,5 +7,5 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-actix-web = { path = "../../../integrations/actix-web" } -actix-web = { version = "4.0.1", default-features = false, features = ["macros"] } +actix-web = { version = "4.5.1", default-features = false, features = ["macros"] } token = { path = "../../models/token" } diff --git a/actix-web/upload/Cargo.toml b/actix-web/upload/Cargo.toml index 8974300..5c5dd6f 100644 --- a/actix-web/upload/Cargo.toml +++ b/actix-web/upload/Cargo.toml @@ -7,5 +7,5 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-actix-web = { path = "../../../integrations/actix-web" } -actix-web = { version = "4.0.1", default-features = false, features = ["macros"] } +actix-web = { version = "4.5.1", default-features = false, features = ["macros"] } files = { path = "../../models/files" } diff --git a/axum/starwars/Cargo.toml b/axum/starwars/Cargo.toml index 1defbe2..a301e5a 100644 --- a/axum/starwars/Cargo.toml +++ b/axum/starwars/Cargo.toml @@ -6,6 +6,6 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-axum = { path = "../../../integrations/axum" } -tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } +tokio = { version = "1.37", features = ["macros", "rt-multi-thread"] } starwars = { path = "../../models/starwars" } -axum = { version = "0.7.0" } +axum = { version = "0.7.5" } diff --git a/axum/subscription/Cargo.toml b/axum/subscription/Cargo.toml index 6001b29..d10012f 100644 --- a/axum/subscription/Cargo.toml +++ b/axum/subscription/Cargo.toml @@ -6,6 +6,6 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-axum = { path = "../../../integrations/axum" } -tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } +tokio = { version = "1.37", features = ["macros", "rt-multi-thread"] } books = { path = "../../models/books" } -axum = { version = "0.7.0", features = ["ws"] } +axum = { version = "0.7.5", features = ["ws"] } diff --git a/axum/token-from-header/Cargo.toml b/axum/token-from-header/Cargo.toml index 33726d3..69f0d31 100644 --- a/axum/token-from-header/Cargo.toml +++ b/axum/token-from-header/Cargo.toml @@ -6,6 +6,6 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-axum = { path = "../../../integrations/axum" } -tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } +tokio = { version = "1.37", features = ["macros", "rt-multi-thread"] } token = { path = "../../models/token" } -axum = { version = "0.7.0", features = ["ws"] } +axum = { version = "0.7.5", features = ["ws"] } diff --git a/axum/upload/Cargo.toml b/axum/upload/Cargo.toml index 9f8e7ab..0810f64 100644 --- a/axum/upload/Cargo.toml +++ b/axum/upload/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-axum = { path = "../../../integrations/axum" } -axum = "0.7.0" +axum = "0.7.5" files = { path = "../../models/files" } -tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } -tower-http = { version = "0.5.0", features = ["cors"] } +tokio = { version = "1.37", features = ["macros", "rt-multi-thread"] } +tower-http = { version = "0.5.2", features = ["cors"] } diff --git a/federation/dynamic-schema/federation-accounts/Cargo.toml b/federation/dynamic-schema/federation-accounts/Cargo.toml index 738603e..13a5408 100644 --- a/federation/dynamic-schema/federation-accounts/Cargo.toml +++ b/federation/dynamic-schema/federation-accounts/Cargo.toml @@ -6,5 +6,5 @@ edition = "2021" [dependencies] async-graphql = { path = "../../../..", features = ["dynamic-schema"] } async-graphql-poem = { path = "../../../../integrations/poem" } -tokio = { version = "1.0.2", features = ["macros", "rt-multi-thread"] } -poem = { version = "2.0.0" } +tokio = { version = "1.37", features = ["macros", "rt-multi-thread"] } +poem = { version = "2.0.1" } diff --git a/federation/dynamic-schema/federation-products/Cargo.toml b/federation/dynamic-schema/federation-products/Cargo.toml index c03b8c7..0a8281a 100644 --- a/federation/dynamic-schema/federation-products/Cargo.toml +++ b/federation/dynamic-schema/federation-products/Cargo.toml @@ -6,5 +6,5 @@ edition = "2021" [dependencies] async-graphql = { path = "../../../..", features = ["dynamic-schema"] } async-graphql-poem = { path = "../../../../integrations/poem" } -tokio = { version = "1.0.2", features = ["macros", "rt-multi-thread"] } -poem = { version = "2.0.0" } +tokio = { version = "1.37", features = ["macros", "rt-multi-thread"] } +poem = { version = "2.0.1" } diff --git a/federation/dynamic-schema/federation-reviews/Cargo.toml b/federation/dynamic-schema/federation-reviews/Cargo.toml index 92ea76e..1553166 100644 --- a/federation/dynamic-schema/federation-reviews/Cargo.toml +++ b/federation/dynamic-schema/federation-reviews/Cargo.toml @@ -6,5 +6,5 @@ edition = "2021" [dependencies] async-graphql = { path = "../../../..", features = ["dynamic-schema"] } async-graphql-poem = { path = "../../../../integrations/poem" } -tokio = { version = "1.0.2", features = ["macros", "rt-multi-thread"] } -poem = { version = "2.0.0" } +tokio = { version = "1.37", features = ["macros", "rt-multi-thread"] } +poem = { version = "2.0.1" } diff --git a/federation/static-schema/directives/Cargo.toml b/federation/static-schema/directives/Cargo.toml index b8014a8..500fa6d 100644 --- a/federation/static-schema/directives/Cargo.toml +++ b/federation/static-schema/directives/Cargo.toml @@ -6,4 +6,4 @@ edition = "2021" [dependencies] async-graphql = { path = "../../../.." } -async-trait = "0.1.61" +async-trait = "0.1.79" diff --git a/federation/static-schema/federation-accounts/Cargo.toml b/federation/static-schema/federation-accounts/Cargo.toml index 8698ba9..285cec4 100644 --- a/federation/static-schema/federation-accounts/Cargo.toml +++ b/federation/static-schema/federation-accounts/Cargo.toml @@ -8,5 +8,5 @@ edition = "2021" async-graphql = { path = "../../../.." } async-graphql-poem = { path = "../../../../integrations/poem" } directives = { path = "../directives" } -tokio = { version = "1.0.2", features = ["macros", "rt-multi-thread"] } -poem = { version = "2.0.0" } +tokio = { version = "1.37", features = ["macros", "rt-multi-thread"] } +poem = { version = "2.0.1" } diff --git a/federation/static-schema/federation-products/Cargo.toml b/federation/static-schema/federation-products/Cargo.toml index ad6f60f..7d4fc6e 100644 --- a/federation/static-schema/federation-products/Cargo.toml +++ b/federation/static-schema/federation-products/Cargo.toml @@ -8,5 +8,5 @@ edition = "2021" async-graphql = { path = "../../../.." } async-graphql-poem = { path = "../../../../integrations/poem" } directives = { path = "../directives" } -tokio = { version = "1.0.2", features = ["macros", "rt-multi-thread"] } -poem = { version = "2.0.0" } +tokio = { version = "1.37", features = ["macros", "rt-multi-thread"] } +poem = { version = "2.0.1" } diff --git a/federation/static-schema/federation-reviews/Cargo.toml b/federation/static-schema/federation-reviews/Cargo.toml index 574acd1..e574fe5 100644 --- a/federation/static-schema/federation-reviews/Cargo.toml +++ b/federation/static-schema/federation-reviews/Cargo.toml @@ -8,5 +8,5 @@ edition = "2021" async-graphql = { path = "../../../.." } async-graphql-poem = { path = "../../../../integrations/poem" } directives = { path = "../directives" } -tokio = { version = "1.0.2", features = ["macros", "rt-multi-thread"] } -poem = { version = "2.0.0" } +tokio = { version = "1.37", features = ["macros", "rt-multi-thread"] } +poem = { version = "2.0.1" } diff --git a/models/books/Cargo.toml b/models/books/Cargo.toml index aef63bc..aad4193 100644 --- a/models/books/Cargo.toml +++ b/models/books/Cargo.toml @@ -6,9 +6,9 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } -slab = "0.4.2" -futures-util = "0.3.0" -futures-channel = "0.3.0" -once_cell = "1.0" -futures-timer = "3.0.2" -async-stream = "0.3.0" +slab = "0.4.9" +futures-util = "0.3.30" +futures-channel = "0.3.30" +once_cell = "1.19" +futures-timer = "3.0.3" +async-stream = "0.3.5" diff --git a/models/dynamic-books/Cargo.toml b/models/dynamic-books/Cargo.toml index 10585c7..fc6d02b 100644 --- a/models/dynamic-books/Cargo.toml +++ b/models/dynamic-books/Cargo.toml @@ -5,9 +5,9 @@ edition = "2021" [dependencies] async-graphql = { path = "../../..", features = ["dynamic-schema"] } -slab = "0.4.2" -futures-util = "0.3.0" -futures-channel = "0.3.0" -once_cell = "1.0" -futures-timer = "3.0.2" -async-stream = "0.3.0" +slab = "0.4.9" +futures-util = "0.3.30" +futures-channel = "0.3.30" +once_cell = "1.19" +futures-timer = "3.0.3" +async-stream = "0.3.5" diff --git a/models/dynamic-files/Cargo.toml b/models/dynamic-files/Cargo.toml index cb570d1..ee2f6c7 100644 --- a/models/dynamic-files/Cargo.toml +++ b/models/dynamic-files/Cargo.toml @@ -5,5 +5,5 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } -slab = "0.4.2" -futures = "0.3.0" +slab = "0.4.9" +futures = "0.3.30" diff --git a/models/dynamic-starwars/Cargo.toml b/models/dynamic-starwars/Cargo.toml index b6738bc..c5a7286 100644 --- a/models/dynamic-starwars/Cargo.toml +++ b/models/dynamic-starwars/Cargo.toml @@ -5,4 +5,4 @@ edition = "2021" [dependencies] async-graphql = { path = "../../..", features = ["dynamic-schema"] } -slab = "0.4.2" +slab = "0.4.9" diff --git a/models/files/Cargo.toml b/models/files/Cargo.toml index a08696d..b14f440 100644 --- a/models/files/Cargo.toml +++ b/models/files/Cargo.toml @@ -6,5 +6,5 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } -slab = "0.4.2" -futures = "0.3.0" +slab = "0.4.9" +futures = "0.3.30" diff --git a/models/starwars/Cargo.toml b/models/starwars/Cargo.toml index ebf5ba6..9f5ca3d 100644 --- a/models/starwars/Cargo.toml +++ b/models/starwars/Cargo.toml @@ -6,4 +6,4 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } -slab = "0.4.2" +slab = "0.4.9" diff --git a/models/token/Cargo.toml b/models/token/Cargo.toml index 1050312..22ed687 100644 --- a/models/token/Cargo.toml +++ b/models/token/Cargo.toml @@ -5,6 +5,6 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } -futures-util = "0.3.0" +futures-util = "0.3.30" serde_json = "1.0" serde = { version = "1.0", features = ["derive"] } diff --git a/poem/dynamic-books/Cargo.toml b/poem/dynamic-books/Cargo.toml index 4892def..a6bb612 100644 --- a/poem/dynamic-books/Cargo.toml +++ b/poem/dynamic-books/Cargo.toml @@ -6,6 +6,6 @@ edition = "2021" [dependencies] async-graphql = { path = "../../..", features = ["dynamic-schema"] } async-graphql-poem = { path = "../../../integrations/poem" } -tokio = { version = "1.29", features = ["macros", "rt-multi-thread"] } +tokio = { version = "1.37", features = ["macros", "rt-multi-thread"] } dynamic-books = { path = "../../models/dynamic-books" } -poem = "2.0.0" +poem = "2.0.1" diff --git a/poem/dynamic-schema/Cargo.toml b/poem/dynamic-schema/Cargo.toml index 246ed99..76fd0c1 100644 --- a/poem/dynamic-schema/Cargo.toml +++ b/poem/dynamic-schema/Cargo.toml @@ -6,5 +6,5 @@ edition = "2021" [dependencies] async-graphql = { path = "../../..", features = ["dynamic-schema"] } async-graphql-poem = { path = "../../../integrations/poem" } -tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } -poem = "2.0.0" +tokio = { version = "1.37", features = ["macros", "rt-multi-thread"] } +poem = "2.0.1" diff --git a/poem/dynamic-starwars/Cargo.toml b/poem/dynamic-starwars/Cargo.toml index 4db9d67..caf6076 100644 --- a/poem/dynamic-starwars/Cargo.toml +++ b/poem/dynamic-starwars/Cargo.toml @@ -6,6 +6,6 @@ edition = "2021" [dependencies] async-graphql = { path = "../../..", features = ["dynamic-schema"] } async-graphql-poem = { path = "../../../integrations/poem" } -tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } +tokio = { version = "1.37", features = ["macros", "rt-multi-thread"] } dynamic-starwars = { path = "../../models/dynamic-starwars" } -poem = "2.0.0" +poem = "2.0.1" diff --git a/poem/dynamic-upload/Cargo.toml b/poem/dynamic-upload/Cargo.toml index ac02bc3..aab57a6 100644 --- a/poem/dynamic-upload/Cargo.toml +++ b/poem/dynamic-upload/Cargo.toml @@ -6,6 +6,6 @@ edition = "2021" [dependencies] async-graphql = { path = "../../..", features = ["dynamic-schema"] } async-graphql-poem = { path = "../../../integrations/poem" } -tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } +tokio = { version = "1.37", features = ["macros", "rt-multi-thread"] } dynamic-files = { path = "../../models/dynamic-files" } -poem = "2.0.0" +poem = "2.0.1" diff --git a/poem/opentelemetry-basic/Cargo.toml b/poem/opentelemetry-basic/Cargo.toml index cd4b1fa..2752625 100644 --- a/poem/opentelemetry-basic/Cargo.toml +++ b/poem/opentelemetry-basic/Cargo.toml @@ -8,8 +8,8 @@ edition = "2021" [dependencies] async-graphql = { path = "../../..", features = ["opentelemetry"] } async-graphql-poem = { path = "../../../integrations/poem" } -tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } -poem = "2.0.0" -opentelemetry = { version = "0.21.0" } -opentelemetry_sdk = { version = "0.21", features = ["rt-tokio"] } -opentelemetry-stdout = { version = "0.2.0", features = ["trace"] } +tokio = { version = "1.37", features = ["macros", "rt-multi-thread"] } +poem = "2.0.1" +opentelemetry = { version = "0.22.0" } +opentelemetry_sdk = { version = "0.22", features = ["rt-tokio"] } +opentelemetry-stdout = { version = "0.3.0", features = ["trace"] } diff --git a/poem/starwars/Cargo.toml b/poem/starwars/Cargo.toml index ec23009..1695279 100644 --- a/poem/starwars/Cargo.toml +++ b/poem/starwars/Cargo.toml @@ -6,6 +6,6 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-poem = { path = "../../../integrations/poem" } -tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } +tokio = { version = "1.37", features = ["macros", "rt-multi-thread"] } starwars = { path = "../../models/starwars" } -poem = "2.0.0" +poem = "2.0.1" diff --git a/poem/subscription-redis/Cargo.toml b/poem/subscription-redis/Cargo.toml index 647f4ca..519a40d 100644 --- a/poem/subscription-redis/Cargo.toml +++ b/poem/subscription-redis/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-poem = { path = "../../../integrations/poem" } -tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } -poem = { version = "2.0.0", features = ["websocket"] } -redis = { version = "0.21.4", features = ["aio", "tokio-comp"] } -futures-util = "0.3.19" +tokio = { version = "1.37", features = ["macros", "rt-multi-thread"] } +poem = { version = "2.0.1", features = ["websocket"] } +redis = { version = "0.25.2", features = ["aio", "tokio-comp"] } +futures-util = "0.3.30" diff --git a/poem/subscription/Cargo.toml b/poem/subscription/Cargo.toml index 015f127..417e9c9 100644 --- a/poem/subscription/Cargo.toml +++ b/poem/subscription/Cargo.toml @@ -6,6 +6,6 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-poem = { path = "../../../integrations/poem" } -tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } +tokio = { version = "1.37", features = ["macros", "rt-multi-thread"] } books = { path = "../../models/books" } -poem = { version = "2.0.0", features = ["websocket"] } +poem = { version = "2.0.1", features = ["websocket"] } diff --git a/poem/token-from-header/Cargo.toml b/poem/token-from-header/Cargo.toml index 033fad1..a5dc7b0 100644 --- a/poem/token-from-header/Cargo.toml +++ b/poem/token-from-header/Cargo.toml @@ -7,5 +7,5 @@ edition = "2021" async-graphql = { path = "../../.." } async-graphql-poem = { path = "../../../integrations/poem" } token = { path = "../../models/token" } -poem = { version = "2.0.0", features = ["websocket"] } -tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } +poem = { version = "2.0.1", features = ["websocket"] } +tokio = { version = "1.37", features = ["macros", "rt-multi-thread"] } diff --git a/poem/upload/Cargo.toml b/poem/upload/Cargo.toml index 1e6b5ee..e61563a 100644 --- a/poem/upload/Cargo.toml +++ b/poem/upload/Cargo.toml @@ -7,6 +7,6 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-poem = { path = "../../../integrations/poem" } -poem = { version = "2.0.0", features = ["websocket"] } +poem = { version = "2.0.1", features = ["websocket"] } files = { path = "../../models/files" } -tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } +tokio = { version = "1.37", features = ["macros", "rt-multi-thread"] } diff --git a/tide/dataloader-postgres/Cargo.toml b/tide/dataloader-postgres/Cargo.toml index 35dffa1..8d60f87 100644 --- a/tide/dataloader-postgres/Cargo.toml +++ b/tide/dataloader-postgres/Cargo.toml @@ -7,14 +7,14 @@ edition = "2018" [dependencies] async-graphql = { path = "../../..", features = ["dataloader"] } async-graphql-tide = { path = "../../../integrations/tide" } -async-std = "1.9.0" -itertools = "0.10.0" -sqlx = { version = "0.7.2", features = [ +async-std = "1.12.0" +itertools = "0.12.1" +sqlx = { version = "0.7.4", features = [ "runtime-async-std-rustls", "postgres", ] } tide = "0.16.0" [dev-dependencies] -serde_json = "1.0.61" -surf = "2.1.0" +serde_json = "1.0.115" +surf = "2.3.2" diff --git a/tide/dataloader/Cargo.toml b/tide/dataloader/Cargo.toml index 1f4149a..bbd1808 100644 --- a/tide/dataloader/Cargo.toml +++ b/tide/dataloader/Cargo.toml @@ -8,10 +8,10 @@ edition = "2018" async-graphql = { path = "../../..", features = ["dataloader"] } async-graphql-tide = { path = "../../../integrations/tide" } tide = "0.16" -async-std = "1.9.0" -sqlx = { version = "0.7.2", features = ["sqlite", "runtime-async-std-rustls"] } -itertools = "0.9.0" +async-std = "1.12.0" +sqlx = { version = "0.7.4", features = ["sqlite", "runtime-async-std-rustls"] } +itertools = "0.12.1" [dev-dependencies] -serde_json = "1.0.51" -surf = "2.0.0-alpha.1" +serde_json = "1.0.115" +surf = "2.3.2" diff --git a/tide/starwars/Cargo.toml b/tide/starwars/Cargo.toml index 3dd2845..c619a27 100644 --- a/tide/starwars/Cargo.toml +++ b/tide/starwars/Cargo.toml @@ -8,9 +8,9 @@ edition = "2018" async-graphql = { path = "../../.." } async-graphql-tide = { path = "../../../integrations/tide" } tide = "0.16" -async-std = "1.9.0" +async-std = "1.12.0" starwars = { path = "../../models/starwars" } [dev-dependencies] -serde_json = "1.0.51" -surf = "2.0.0-alpha.5" +serde_json = "1.0.115" +surf = "2.3.2" diff --git a/tide/subscription/Cargo.toml b/tide/subscription/Cargo.toml index 3f05f52..50b0d66 100644 --- a/tide/subscription/Cargo.toml +++ b/tide/subscription/Cargo.toml @@ -9,4 +9,4 @@ async-graphql = { path = "../../.." } async-graphql-tide = { path = "../../../integrations/tide" } books = { path = "../../models/books" } tide = "0.16" -async-std = "1.9.0" +async-std = "1.12.0" diff --git a/warp/starwars/Cargo.toml b/warp/starwars/Cargo.toml index b53aaa8..48b1050 100644 --- a/warp/starwars/Cargo.toml +++ b/warp/starwars/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-warp = { path = "../../../integrations/warp" } -tokio = { version = "1.0.2", features = ["macros", "rt-multi-thread"] } +tokio = { version = "1.37", features = ["macros", "rt-multi-thread"] } warp = "0.3" starwars = { path = "../../models/starwars" } http = "0.2" diff --git a/warp/subscription/Cargo.toml b/warp/subscription/Cargo.toml index 00a3e37..e4ecdbe 100644 --- a/warp/subscription/Cargo.toml +++ b/warp/subscription/Cargo.toml @@ -7,6 +7,6 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-warp = { path = "../../../integrations/warp" } -tokio = { version = "1.0.2", features = ["macros", "rt-multi-thread"] } +tokio = { version = "1.37", features = ["macros", "rt-multi-thread"] } warp = "0.3" books = { path = "../../models/books" } diff --git a/warp/token-from-header/Cargo.toml b/warp/token-from-header/Cargo.toml index 78e2bed..d3a38a2 100644 --- a/warp/token-from-header/Cargo.toml +++ b/warp/token-from-header/Cargo.toml @@ -7,6 +7,6 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-warp = { path = "../../../integrations/warp" } -tokio = { version = "1.0.2", features = ["macros", "rt-multi-thread"] } +tokio = { version = "1.37", features = ["macros", "rt-multi-thread"] } warp = "0.3" token = { path = "../../models/token" } From c7754bddfac1993fa342a2d676db20c2646a06ca Mon Sep 17 00:00:00 2001 From: Negezor Date: Sat, 30 Mar 2024 14:03:41 +1100 Subject: [PATCH 086/102] chore(deps): bump redis to 0.25.2 --- poem/subscription-redis/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/poem/subscription-redis/Cargo.toml b/poem/subscription-redis/Cargo.toml index 647f4ca..ddd6a30 100644 --- a/poem/subscription-redis/Cargo.toml +++ b/poem/subscription-redis/Cargo.toml @@ -8,5 +8,5 @@ async-graphql = { path = "../../.." } async-graphql-poem = { path = "../../../integrations/poem" } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } poem = { version = "2.0.0", features = ["websocket"] } -redis = { version = "0.21.4", features = ["aio", "tokio-comp"] } +redis = { version = "0.25.2", features = ["aio", "tokio-comp"] } futures-util = "0.3.19" From f85b020efbd4fc55f0fe3a115b6172553a3b8570 Mon Sep 17 00:00:00 2001 From: Negezor Date: Sat, 30 Mar 2024 14:04:47 +1100 Subject: [PATCH 087/102] chore: replace deprecated redis calls --- poem/subscription-redis/src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/poem/subscription-redis/src/main.rs b/poem/subscription-redis/src/main.rs index 7ad4e99..0f11d7c 100644 --- a/poem/subscription-redis/src/main.rs +++ b/poem/subscription-redis/src/main.rs @@ -19,7 +19,7 @@ struct MutationRoot; impl MutationRoot { async fn publish(&self, ctx: &Context<'_>, value: String) -> Result { let client = ctx.data_unchecked::(); - let mut conn = client.get_async_connection().await?; + let mut conn = client.get_multiplexed_async_connection().await?; conn.publish("values", value).await?; Ok(true) } @@ -31,7 +31,7 @@ struct SubscriptionRoot; impl SubscriptionRoot { async fn values(&self, ctx: &Context<'_>) -> Result> { let client = ctx.data_unchecked::(); - let mut conn = client.get_async_connection().await?.into_pubsub(); + let mut conn = client.get_async_pubsub().await?; conn.subscribe("values").await?; Ok(conn .into_on_message() From 7370bc738ccabc79c9677fe8b787aaf6abfbb2c9 Mon Sep 17 00:00:00 2001 From: Sunli Date: Sat, 30 Mar 2024 22:05:29 +0800 Subject: [PATCH 088/102] update for poem 3.0.0 --- federation/dynamic-schema/federation-accounts/Cargo.toml | 2 +- federation/dynamic-schema/federation-products/Cargo.toml | 2 +- federation/dynamic-schema/federation-reviews/Cargo.toml | 2 +- federation/static-schema/federation-accounts/Cargo.toml | 2 +- federation/static-schema/federation-products/Cargo.toml | 2 +- federation/static-schema/federation-reviews/Cargo.toml | 2 +- poem/dynamic-books/Cargo.toml | 2 +- poem/dynamic-schema/Cargo.toml | 2 +- poem/dynamic-starwars/Cargo.toml | 2 +- poem/dynamic-upload/Cargo.toml | 2 +- poem/opentelemetry-basic/Cargo.toml | 2 +- poem/starwars/Cargo.toml | 2 +- poem/subscription-redis/Cargo.toml | 2 +- poem/subscription/Cargo.toml | 2 +- poem/token-from-header/Cargo.toml | 2 +- poem/upload/Cargo.toml | 2 +- 16 files changed, 16 insertions(+), 16 deletions(-) diff --git a/federation/dynamic-schema/federation-accounts/Cargo.toml b/federation/dynamic-schema/federation-accounts/Cargo.toml index 738603e..0418de7 100644 --- a/federation/dynamic-schema/federation-accounts/Cargo.toml +++ b/federation/dynamic-schema/federation-accounts/Cargo.toml @@ -7,4 +7,4 @@ edition = "2021" async-graphql = { path = "../../../..", features = ["dynamic-schema"] } async-graphql-poem = { path = "../../../../integrations/poem" } tokio = { version = "1.0.2", features = ["macros", "rt-multi-thread"] } -poem = { version = "2.0.0" } +poem = { version = "3.0.0" } diff --git a/federation/dynamic-schema/federation-products/Cargo.toml b/federation/dynamic-schema/federation-products/Cargo.toml index c03b8c7..4e9ebb7 100644 --- a/federation/dynamic-schema/federation-products/Cargo.toml +++ b/federation/dynamic-schema/federation-products/Cargo.toml @@ -7,4 +7,4 @@ edition = "2021" async-graphql = { path = "../../../..", features = ["dynamic-schema"] } async-graphql-poem = { path = "../../../../integrations/poem" } tokio = { version = "1.0.2", features = ["macros", "rt-multi-thread"] } -poem = { version = "2.0.0" } +poem = { version = "3.0.0" } diff --git a/federation/dynamic-schema/federation-reviews/Cargo.toml b/federation/dynamic-schema/federation-reviews/Cargo.toml index 92ea76e..ac27101 100644 --- a/federation/dynamic-schema/federation-reviews/Cargo.toml +++ b/federation/dynamic-schema/federation-reviews/Cargo.toml @@ -7,4 +7,4 @@ edition = "2021" async-graphql = { path = "../../../..", features = ["dynamic-schema"] } async-graphql-poem = { path = "../../../../integrations/poem" } tokio = { version = "1.0.2", features = ["macros", "rt-multi-thread"] } -poem = { version = "2.0.0" } +poem = { version = "3.0.0" } diff --git a/federation/static-schema/federation-accounts/Cargo.toml b/federation/static-schema/federation-accounts/Cargo.toml index 8698ba9..06e964a 100644 --- a/federation/static-schema/federation-accounts/Cargo.toml +++ b/federation/static-schema/federation-accounts/Cargo.toml @@ -9,4 +9,4 @@ async-graphql = { path = "../../../.." } async-graphql-poem = { path = "../../../../integrations/poem" } directives = { path = "../directives" } tokio = { version = "1.0.2", features = ["macros", "rt-multi-thread"] } -poem = { version = "2.0.0" } +poem = { version = "3.0.0" } diff --git a/federation/static-schema/federation-products/Cargo.toml b/federation/static-schema/federation-products/Cargo.toml index ad6f60f..107024c 100644 --- a/federation/static-schema/federation-products/Cargo.toml +++ b/federation/static-schema/federation-products/Cargo.toml @@ -9,4 +9,4 @@ async-graphql = { path = "../../../.." } async-graphql-poem = { path = "../../../../integrations/poem" } directives = { path = "../directives" } tokio = { version = "1.0.2", features = ["macros", "rt-multi-thread"] } -poem = { version = "2.0.0" } +poem = { version = "3.0.0" } diff --git a/federation/static-schema/federation-reviews/Cargo.toml b/federation/static-schema/federation-reviews/Cargo.toml index 574acd1..9df8ad6 100644 --- a/federation/static-schema/federation-reviews/Cargo.toml +++ b/federation/static-schema/federation-reviews/Cargo.toml @@ -9,4 +9,4 @@ async-graphql = { path = "../../../.." } async-graphql-poem = { path = "../../../../integrations/poem" } directives = { path = "../directives" } tokio = { version = "1.0.2", features = ["macros", "rt-multi-thread"] } -poem = { version = "2.0.0" } +poem = { version = "3.0.0" } diff --git a/poem/dynamic-books/Cargo.toml b/poem/dynamic-books/Cargo.toml index 4892def..c661971 100644 --- a/poem/dynamic-books/Cargo.toml +++ b/poem/dynamic-books/Cargo.toml @@ -8,4 +8,4 @@ async-graphql = { path = "../../..", features = ["dynamic-schema"] } async-graphql-poem = { path = "../../../integrations/poem" } tokio = { version = "1.29", features = ["macros", "rt-multi-thread"] } dynamic-books = { path = "../../models/dynamic-books" } -poem = "2.0.0" +poem = "3.0.0" diff --git a/poem/dynamic-schema/Cargo.toml b/poem/dynamic-schema/Cargo.toml index 246ed99..8c77e6f 100644 --- a/poem/dynamic-schema/Cargo.toml +++ b/poem/dynamic-schema/Cargo.toml @@ -7,4 +7,4 @@ edition = "2021" async-graphql = { path = "../../..", features = ["dynamic-schema"] } async-graphql-poem = { path = "../../../integrations/poem" } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } -poem = "2.0.0" +poem = "3.0.0" diff --git a/poem/dynamic-starwars/Cargo.toml b/poem/dynamic-starwars/Cargo.toml index 4db9d67..ba1e3f7 100644 --- a/poem/dynamic-starwars/Cargo.toml +++ b/poem/dynamic-starwars/Cargo.toml @@ -8,4 +8,4 @@ async-graphql = { path = "../../..", features = ["dynamic-schema"] } async-graphql-poem = { path = "../../../integrations/poem" } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } dynamic-starwars = { path = "../../models/dynamic-starwars" } -poem = "2.0.0" +poem = "3.0.0" diff --git a/poem/dynamic-upload/Cargo.toml b/poem/dynamic-upload/Cargo.toml index ac02bc3..aadf8d7 100644 --- a/poem/dynamic-upload/Cargo.toml +++ b/poem/dynamic-upload/Cargo.toml @@ -8,4 +8,4 @@ async-graphql = { path = "../../..", features = ["dynamic-schema"] } async-graphql-poem = { path = "../../../integrations/poem" } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } dynamic-files = { path = "../../models/dynamic-files" } -poem = "2.0.0" +poem = "3.0.0" diff --git a/poem/opentelemetry-basic/Cargo.toml b/poem/opentelemetry-basic/Cargo.toml index cd4b1fa..54099b2 100644 --- a/poem/opentelemetry-basic/Cargo.toml +++ b/poem/opentelemetry-basic/Cargo.toml @@ -9,7 +9,7 @@ edition = "2021" async-graphql = { path = "../../..", features = ["opentelemetry"] } async-graphql-poem = { path = "../../../integrations/poem" } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } -poem = "2.0.0" +poem = "3.0.0" opentelemetry = { version = "0.21.0" } opentelemetry_sdk = { version = "0.21", features = ["rt-tokio"] } opentelemetry-stdout = { version = "0.2.0", features = ["trace"] } diff --git a/poem/starwars/Cargo.toml b/poem/starwars/Cargo.toml index ec23009..ceb12aa 100644 --- a/poem/starwars/Cargo.toml +++ b/poem/starwars/Cargo.toml @@ -8,4 +8,4 @@ async-graphql = { path = "../../.." } async-graphql-poem = { path = "../../../integrations/poem" } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } starwars = { path = "../../models/starwars" } -poem = "2.0.0" +poem = "3.0.0" diff --git a/poem/subscription-redis/Cargo.toml b/poem/subscription-redis/Cargo.toml index 647f4ca..d755afe 100644 --- a/poem/subscription-redis/Cargo.toml +++ b/poem/subscription-redis/Cargo.toml @@ -7,6 +7,6 @@ edition = "2021" async-graphql = { path = "../../.." } async-graphql-poem = { path = "../../../integrations/poem" } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } -poem = { version = "2.0.0", features = ["websocket"] } +poem = { version = "3.0.0", features = ["websocket"] } redis = { version = "0.21.4", features = ["aio", "tokio-comp"] } futures-util = "0.3.19" diff --git a/poem/subscription/Cargo.toml b/poem/subscription/Cargo.toml index 015f127..803b2fd 100644 --- a/poem/subscription/Cargo.toml +++ b/poem/subscription/Cargo.toml @@ -8,4 +8,4 @@ async-graphql = { path = "../../.." } async-graphql-poem = { path = "../../../integrations/poem" } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } books = { path = "../../models/books" } -poem = { version = "2.0.0", features = ["websocket"] } +poem = { version = "3.0.0", features = ["websocket"] } diff --git a/poem/token-from-header/Cargo.toml b/poem/token-from-header/Cargo.toml index 033fad1..cb12d15 100644 --- a/poem/token-from-header/Cargo.toml +++ b/poem/token-from-header/Cargo.toml @@ -7,5 +7,5 @@ edition = "2021" async-graphql = { path = "../../.." } async-graphql-poem = { path = "../../../integrations/poem" } token = { path = "../../models/token" } -poem = { version = "2.0.0", features = ["websocket"] } +poem = { version = "3.0.0", features = ["websocket"] } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } diff --git a/poem/upload/Cargo.toml b/poem/upload/Cargo.toml index 1e6b5ee..9c2bc64 100644 --- a/poem/upload/Cargo.toml +++ b/poem/upload/Cargo.toml @@ -7,6 +7,6 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-poem = { path = "../../../integrations/poem" } -poem = { version = "2.0.0", features = ["websocket"] } +poem = { version = "3.0.0", features = ["websocket"] } files = { path = "../../models/files" } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } From 3d30c93e6ef97a404f26f5a3ff11bd1657fd2278 Mon Sep 17 00:00:00 2001 From: Sunli Date: Wed, 1 May 2024 16:05:22 +0800 Subject: [PATCH 089/102] Update Cargo.toml --- poem/opentelemetry-basic/Cargo.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/poem/opentelemetry-basic/Cargo.toml b/poem/opentelemetry-basic/Cargo.toml index 54099b2..70adc3c 100644 --- a/poem/opentelemetry-basic/Cargo.toml +++ b/poem/opentelemetry-basic/Cargo.toml @@ -10,6 +10,6 @@ async-graphql = { path = "../../..", features = ["opentelemetry"] } async-graphql-poem = { path = "../../../integrations/poem" } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } poem = "3.0.0" -opentelemetry = { version = "0.21.0" } -opentelemetry_sdk = { version = "0.21", features = ["rt-tokio"] } -opentelemetry-stdout = { version = "0.2.0", features = ["trace"] } +opentelemetry = { version = "0.22.0" } +opentelemetry_sdk = { version = "0.22", features = ["rt-tokio"] } +opentelemetry-stdout = { version = "0.3.0", features = ["trace"] } From db93e2c56be3c9eca74699f2831af76f33d941da Mon Sep 17 00:00:00 2001 From: Elad Kaplan Date: Wed, 19 Jun 2024 22:11:33 +0300 Subject: [PATCH 090/102] adding loco Starwars + subscription examples --- README.md | 1 + loco/starwars/.cargo/config.toml | 2 + loco/starwars/Cargo.toml | 26 +++++++++ loco/starwars/README.md | 36 +++++++++++++ loco/starwars/config/development.yaml | 45 ++++++++++++++++ loco/starwars/src/app.rs | 42 +++++++++++++++ loco/starwars/src/bin/main.rs | 7 +++ loco/starwars/src/controllers/graphiql.rs | 18 +++++++ loco/starwars/src/controllers/mod.rs | 1 + loco/starwars/src/lib.rs | 2 + loco/subscription/.cargo/config.toml | 2 + loco/subscription/Cargo.toml | 25 +++++++++ loco/subscription/README.md | 36 +++++++++++++ loco/subscription/config/development.yaml | 45 ++++++++++++++++ loco/subscription/src/app.rs | 54 +++++++++++++++++++ loco/subscription/src/bin/main.rs | 7 +++ loco/subscription/src/controllers/graphiql.rs | 23 ++++++++ loco/subscription/src/controllers/mod.rs | 1 + loco/subscription/src/lib.rs | 2 + 19 files changed, 375 insertions(+) create mode 100644 loco/starwars/.cargo/config.toml create mode 100644 loco/starwars/Cargo.toml create mode 100644 loco/starwars/README.md create mode 100644 loco/starwars/config/development.yaml create mode 100644 loco/starwars/src/app.rs create mode 100644 loco/starwars/src/bin/main.rs create mode 100644 loco/starwars/src/controllers/graphiql.rs create mode 100644 loco/starwars/src/controllers/mod.rs create mode 100644 loco/starwars/src/lib.rs create mode 100644 loco/subscription/.cargo/config.toml create mode 100644 loco/subscription/Cargo.toml create mode 100644 loco/subscription/README.md create mode 100644 loco/subscription/config/development.yaml create mode 100644 loco/subscription/src/app.rs create mode 100644 loco/subscription/src/bin/main.rs create mode 100644 loco/subscription/src/controllers/graphiql.rs create mode 100644 loco/subscription/src/controllers/mod.rs create mode 100644 loco/subscription/src/lib.rs diff --git a/README.md b/README.md index 8a9e221..796a79b 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ A git submodule that shows example async-graphql projects. - [tide] Examples for `tide` - [rocket] Examples for `rocket` - [axum] Examples for `axum` +- [loco] Examples for `loco` - [federation] Examples for [Apollo Federation](https://www.apollographql.com/docs/federation/) diff --git a/loco/starwars/.cargo/config.toml b/loco/starwars/.cargo/config.toml new file mode 100644 index 0000000..5ebf033 --- /dev/null +++ b/loco/starwars/.cargo/config.toml @@ -0,0 +1,2 @@ +[alias] +loco = "run --" diff --git a/loco/starwars/Cargo.toml b/loco/starwars/Cargo.toml new file mode 100644 index 0000000..6136bed --- /dev/null +++ b/loco/starwars/Cargo.toml @@ -0,0 +1,26 @@ +[workspace] + +[package] +name = "loco-starwars" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +loco-rs = { version = "0.6.0", default-features = false, features = ["cli"] } +eyre = "*" +tokio = { version = "1.33.0", default-features = false } +async-trait = "0.1.74" + +axum = "0.7.1" + +# async-graphql dependencies +async-graphql = { path = "../../.." } +async-graphql-axum = { path = "../../../integrations/axum" } +starwars = { path = "../../models/starwars" } + +[[bin]] +name = "starwars-cli" +path = "src/bin/main.rs" +required-features = [] diff --git a/loco/starwars/README.md b/loco/starwars/README.md new file mode 100644 index 0000000..55aba3c --- /dev/null +++ b/loco/starwars/README.md @@ -0,0 +1,36 @@ +# async-graphql with Loco :train: + +Example async-graphql project with [Loco](https://github.com/loco-rs/loco). + +## Quick Start + +Start your app: + +``` +$ cargo loco start +Finished dev [unoptimized + debuginfo] target(s) in 21.63s + Running `target/debug/myapp start` + + : + : + : + +controller/app_routes.rs:203: [Middleware] Adding log trace id + + ▄ ▀ + ▀ ▄ + ▄ ▀ ▄ ▄ ▄▀ + ▄ ▀▄▄ + ▄ ▀ ▀ ▀▄▀█▄ + ▀█▄ +▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄ ▀▀█ + ██████ █████ ███ █████ ███ █████ ███ ▀█ + ██████ █████ ███ █████ ▀▀▀ █████ ███ ▄█▄ + ██████ █████ ███ █████ █████ ███ ████▄ + ██████ █████ ███ █████ ▄▄▄ █████ ███ █████ + ██████ █████ ███ ████ ███ █████ ███ ████▀ + ▀▀▀██▄ ▀▀▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀ ██▀ + ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ + +started on port 5150 +``` diff --git a/loco/starwars/config/development.yaml b/loco/starwars/config/development.yaml new file mode 100644 index 0000000..fa21014 --- /dev/null +++ b/loco/starwars/config/development.yaml @@ -0,0 +1,45 @@ +# Loco configuration file documentation + +# Application logging configuration +logger: + # Enable or disable logging. + enable: true + # Log level, options: trace, debug, info, warn or error. + level: debug + # Define the logging format. options: compact, pretty or json + format: compact + # By default the logger has filtering only logs that came from your code or logs that came from `loco` framework. to see all third party libraries + # Uncomment the line below to override to see all third party libraries you can enable this config and override the logger filters. + # override_filter: trace + +# Web server configuration +server: + # Port on which the server will listen. the server binding is 0.0.0.0:{PORT} + port: 5150 + # The UI hostname or IP address that mailers will point to. + host: http://localhost + # Out of the box middleware configuration. to disable middleware you can changed the `enable` field to `false` of comment the middleware block + middlewares: + # Enable Etag cache header middleware + etag: + enable: true + # Allows to limit the payload size request. payload that bigger than this file will blocked the request. + limit_payload: + # Enable/Disable the middleware. + enable: true + # the limit size. can be b,kb,kib,mb,mib,gb,gib + body_limit: 5mb + # Generating a unique request ID and enhancing logging with additional information such as the start and completion of request processing, latency, status code, and other request details. + logger: + # Enable/Disable the middleware. + enable: true + # when your code is panicked, the request still returns 500 status code. + catch_panic: + # Enable/Disable the middleware. + enable: true + # Timeout for incoming requests middleware. requests that take more time from the configuration will cute and 408 status code will returned. + timeout_request: + # Enable/Disable the middleware. + enable: false + # Duration time in milliseconds. + timeout: 5000 diff --git a/loco/starwars/src/app.rs b/loco/starwars/src/app.rs new file mode 100644 index 0000000..6f0d33e --- /dev/null +++ b/loco/starwars/src/app.rs @@ -0,0 +1,42 @@ +use async_trait::async_trait; +use loco_rs::{ + app::{AppContext, Hooks}, + boot::{create_app, BootResult, StartMode}, + controller::AppRoutes, + environment::Environment, + task::Tasks, + worker::Processor, + Result, +}; + +use crate::controllers; + +pub struct App; +#[async_trait] +impl Hooks for App { + fn app_name() -> &'static str { + env!("CARGO_CRATE_NAME") + } + + fn app_version() -> String { + format!( + "{} ({})", + env!("CARGO_PKG_VERSION"), + option_env!("BUILD_SHA") + .or(option_env!("GITHUB_SHA")) + .unwrap_or("dev") + ) + } + + async fn boot(mode: StartMode, environment: &Environment) -> Result { + create_app::(mode, environment).await + } + + fn routes(_ctx: &AppContext) -> AppRoutes { + AppRoutes::empty().add_route(controllers::graphiql::routes()) + } + + fn connect_workers<'a>(_p: &'a mut Processor, _ctx: &'a AppContext) {} + + fn register_tasks(_tasks: &mut Tasks) {} +} diff --git a/loco/starwars/src/bin/main.rs b/loco/starwars/src/bin/main.rs new file mode 100644 index 0000000..ffe90e7 --- /dev/null +++ b/loco/starwars/src/bin/main.rs @@ -0,0 +1,7 @@ +use loco_rs::cli; +use loco_starwars::app::App; + +#[tokio::main] +async fn main() -> eyre::Result<()> { + cli::main::().await +} diff --git a/loco/starwars/src/controllers/graphiql.rs b/loco/starwars/src/controllers/graphiql.rs new file mode 100644 index 0000000..6263797 --- /dev/null +++ b/loco/starwars/src/controllers/graphiql.rs @@ -0,0 +1,18 @@ +use async_graphql::{http::GraphiQLSource, EmptyMutation, EmptySubscription, Schema}; +use async_graphql_axum::GraphQL; +use axum::debug_handler; +use loco_rs::prelude::*; +use starwars::{QueryRoot, StarWars}; + +#[debug_handler] +async fn graphiql() -> Result { + format::html(&GraphiQLSource::build().endpoint("/").finish()) +} + +pub fn routes() -> Routes { + let schema = Schema::build(QueryRoot, EmptyMutation, EmptySubscription) + .data(StarWars::new()) + .finish(); + + Routes::new().add("/", get(graphiql).post_service(GraphQL::new(schema))) +} diff --git a/loco/starwars/src/controllers/mod.rs b/loco/starwars/src/controllers/mod.rs new file mode 100644 index 0000000..982badf --- /dev/null +++ b/loco/starwars/src/controllers/mod.rs @@ -0,0 +1 @@ +pub mod graphiql; diff --git a/loco/starwars/src/lib.rs b/loco/starwars/src/lib.rs new file mode 100644 index 0000000..cee1ed4 --- /dev/null +++ b/loco/starwars/src/lib.rs @@ -0,0 +1,2 @@ +pub mod app; +pub mod controllers; diff --git a/loco/subscription/.cargo/config.toml b/loco/subscription/.cargo/config.toml new file mode 100644 index 0000000..5ebf033 --- /dev/null +++ b/loco/subscription/.cargo/config.toml @@ -0,0 +1,2 @@ +[alias] +loco = "run --" diff --git a/loco/subscription/Cargo.toml b/loco/subscription/Cargo.toml new file mode 100644 index 0000000..b6c4381 --- /dev/null +++ b/loco/subscription/Cargo.toml @@ -0,0 +1,25 @@ +[workspace] + +[package] +name = "loco-subscription" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +loco-rs = { version = "0.6.0", default-features = false, features = ["cli"] } +eyre = "*" +tokio = { version = "1.33.0", default-features = false } +async-trait = "0.1.74" +axum = "0.7.1" + +# async-graphql dependencies +async-graphql = { path = "../../.." } +async-graphql-axum = { path = "../../../integrations/axum" } +books = { path = "../../models/books" } + +[[bin]] +name = "starwars-cli" +path = "src/bin/main.rs" +required-features = [] diff --git a/loco/subscription/README.md b/loco/subscription/README.md new file mode 100644 index 0000000..55aba3c --- /dev/null +++ b/loco/subscription/README.md @@ -0,0 +1,36 @@ +# async-graphql with Loco :train: + +Example async-graphql project with [Loco](https://github.com/loco-rs/loco). + +## Quick Start + +Start your app: + +``` +$ cargo loco start +Finished dev [unoptimized + debuginfo] target(s) in 21.63s + Running `target/debug/myapp start` + + : + : + : + +controller/app_routes.rs:203: [Middleware] Adding log trace id + + ▄ ▀ + ▀ ▄ + ▄ ▀ ▄ ▄ ▄▀ + ▄ ▀▄▄ + ▄ ▀ ▀ ▀▄▀█▄ + ▀█▄ +▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄ ▀▀█ + ██████ █████ ███ █████ ███ █████ ███ ▀█ + ██████ █████ ███ █████ ▀▀▀ █████ ███ ▄█▄ + ██████ █████ ███ █████ █████ ███ ████▄ + ██████ █████ ███ █████ ▄▄▄ █████ ███ █████ + ██████ █████ ███ ████ ███ █████ ███ ████▀ + ▀▀▀██▄ ▀▀▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀ ██▀ + ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ + +started on port 5150 +``` diff --git a/loco/subscription/config/development.yaml b/loco/subscription/config/development.yaml new file mode 100644 index 0000000..fa21014 --- /dev/null +++ b/loco/subscription/config/development.yaml @@ -0,0 +1,45 @@ +# Loco configuration file documentation + +# Application logging configuration +logger: + # Enable or disable logging. + enable: true + # Log level, options: trace, debug, info, warn or error. + level: debug + # Define the logging format. options: compact, pretty or json + format: compact + # By default the logger has filtering only logs that came from your code or logs that came from `loco` framework. to see all third party libraries + # Uncomment the line below to override to see all third party libraries you can enable this config and override the logger filters. + # override_filter: trace + +# Web server configuration +server: + # Port on which the server will listen. the server binding is 0.0.0.0:{PORT} + port: 5150 + # The UI hostname or IP address that mailers will point to. + host: http://localhost + # Out of the box middleware configuration. to disable middleware you can changed the `enable` field to `false` of comment the middleware block + middlewares: + # Enable Etag cache header middleware + etag: + enable: true + # Allows to limit the payload size request. payload that bigger than this file will blocked the request. + limit_payload: + # Enable/Disable the middleware. + enable: true + # the limit size. can be b,kb,kib,mb,mib,gb,gib + body_limit: 5mb + # Generating a unique request ID and enhancing logging with additional information such as the start and completion of request processing, latency, status code, and other request details. + logger: + # Enable/Disable the middleware. + enable: true + # when your code is panicked, the request still returns 500 status code. + catch_panic: + # Enable/Disable the middleware. + enable: true + # Timeout for incoming requests middleware. requests that take more time from the configuration will cute and 408 status code will returned. + timeout_request: + # Enable/Disable the middleware. + enable: false + # Duration time in milliseconds. + timeout: 5000 diff --git a/loco/subscription/src/app.rs b/loco/subscription/src/app.rs new file mode 100644 index 0000000..3cd8413 --- /dev/null +++ b/loco/subscription/src/app.rs @@ -0,0 +1,54 @@ +use async_graphql::Schema; +use books::{MutationRoot, QueryRoot, Storage, SubscriptionRoot}; + +use async_graphql_axum::GraphQLSubscription; +use async_trait::async_trait; +use axum::Router as AxumRouter; +use loco_rs::{ + app::{AppContext, Hooks}, + boot::{create_app, BootResult, StartMode}, + controller::AppRoutes, + environment::Environment, + task::Tasks, + worker::Processor, + Result, +}; + +use crate::controllers; + +pub struct App; +#[async_trait] +impl Hooks for App { + fn app_name() -> &'static str { + env!("CARGO_CRATE_NAME") + } + + fn app_version() -> String { + format!( + "{} ({})", + env!("CARGO_PKG_VERSION"), + option_env!("BUILD_SHA") + .or(option_env!("GITHUB_SHA")) + .unwrap_or("dev") + ) + } + + async fn boot(mode: StartMode, environment: &Environment) -> Result { + create_app::(mode, environment).await + } + + fn routes(_ctx: &AppContext) -> AppRoutes { + AppRoutes::empty().add_route(controllers::graphiql::routes()) + } + + async fn after_routes(router: AxumRouter, _ctx: &AppContext) -> Result { + let schema = Schema::build(QueryRoot, MutationRoot, SubscriptionRoot) + .data(Storage::default()) + .finish(); + Ok(router.route_service("/ws", GraphQLSubscription::new(schema))) + } + + fn connect_workers<'a>(_p: &'a mut Processor, _ctx: &'a AppContext) {} + + fn register_tasks(_tasks: &mut Tasks) {} +} diff --git a/loco/subscription/src/bin/main.rs b/loco/subscription/src/bin/main.rs new file mode 100644 index 0000000..90f3acc --- /dev/null +++ b/loco/subscription/src/bin/main.rs @@ -0,0 +1,7 @@ +use loco_rs::cli; +use loco_subscription::app::App; + +#[tokio::main] +async fn main() -> eyre::Result<()> { + cli::main::().await +} diff --git a/loco/subscription/src/controllers/graphiql.rs b/loco/subscription/src/controllers/graphiql.rs new file mode 100644 index 0000000..e39a1d4 --- /dev/null +++ b/loco/subscription/src/controllers/graphiql.rs @@ -0,0 +1,23 @@ +use async_graphql::{http::GraphiQLSource, Schema}; +use async_graphql_axum::GraphQL; +use axum::debug_handler; +use books::{MutationRoot, QueryRoot, Storage, SubscriptionRoot}; +use loco_rs::prelude::*; + +#[debug_handler] +async fn graphiql() -> Result { + format::html( + &GraphiQLSource::build() + .endpoint("/") + .subscription_endpoint("/ws") + .finish(), + ) +} + +pub fn routes() -> Routes { + let schema = Schema::build(QueryRoot, MutationRoot, SubscriptionRoot) + .data(Storage::default()) + .finish(); + + Routes::new().add("/", get(graphiql).post_service(GraphQL::new(schema))) +} diff --git a/loco/subscription/src/controllers/mod.rs b/loco/subscription/src/controllers/mod.rs new file mode 100644 index 0000000..982badf --- /dev/null +++ b/loco/subscription/src/controllers/mod.rs @@ -0,0 +1 @@ +pub mod graphiql; diff --git a/loco/subscription/src/lib.rs b/loco/subscription/src/lib.rs new file mode 100644 index 0000000..cee1ed4 --- /dev/null +++ b/loco/subscription/src/lib.rs @@ -0,0 +1,2 @@ +pub mod app; +pub mod controllers; From c6d2bd18d8f1d02db3a4aefde75457d70f63c7ac Mon Sep 17 00:00:00 2001 From: Sunli Date: Sun, 14 Jul 2024 10:59:59 +0800 Subject: [PATCH 091/102] bump opentelemetry from `0.22.0` to `0.23.0` --- poem/opentelemetry-basic/Cargo.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/poem/opentelemetry-basic/Cargo.toml b/poem/opentelemetry-basic/Cargo.toml index 91fb807..23a667a 100644 --- a/poem/opentelemetry-basic/Cargo.toml +++ b/poem/opentelemetry-basic/Cargo.toml @@ -10,6 +10,6 @@ async-graphql = { path = "../../..", features = ["opentelemetry"] } async-graphql-poem = { path = "../../../integrations/poem" } tokio = { version = "1.37", features = ["macros", "rt-multi-thread"] } poem = "3.0.0" -opentelemetry = { version = "0.22.0" } -opentelemetry_sdk = { version = "0.22", features = ["rt-tokio"] } -opentelemetry-stdout = { version = "0.3.0", features = ["trace"] } \ No newline at end of file +opentelemetry = { version = "0.23.0" } +opentelemetry_sdk = { version = "0.23", features = ["rt-tokio"] } +opentelemetry-stdout = { version = "0.4.0", features = ["trace"] } From 0c4e5e29e97a41c8877c126cbcefb82721ae81af Mon Sep 17 00:00:00 2001 From: Sunli Date: Fri, 19 Jul 2024 16:40:25 +0800 Subject: [PATCH 092/102] Update model.rs --- models/starwars/src/model.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/models/starwars/src/model.rs b/models/starwars/src/model.rs index ee19c58..d62b847 100644 --- a/models/starwars/src/model.rs +++ b/models/starwars/src/model.rs @@ -172,6 +172,7 @@ impl QueryRoot { } #[derive(Interface)] +#[allow(clippy::duplicated_attributes)] #[graphql( field(name = "id", ty = "&str"), field(name = "name", ty = "&str"), From 629f1b7113598b26940836b2cc2710de5100ad36 Mon Sep 17 00:00:00 2001 From: Sunli Date: Sun, 15 Sep 2024 11:40:42 +0800 Subject: [PATCH 093/102] clippy clean --- .../dynamic-schema/federation-accounts/src/main.rs | 5 +---- .../dynamic-schema/federation-reviews/src/main.rs | 11 +++-------- models/dynamic-starwars/src/model.rs | 12 ++++-------- poem/opentelemetry-basic/Cargo.toml | 6 +++--- 4 files changed, 11 insertions(+), 23 deletions(-) diff --git a/federation/dynamic-schema/federation-accounts/src/main.rs b/federation/dynamic-schema/federation-accounts/src/main.rs index 7da9a2f..4fff07c 100644 --- a/federation/dynamic-schema/federation-accounts/src/main.rs +++ b/federation/dynamic-schema/federation-accounts/src/main.rs @@ -90,10 +90,7 @@ fn schema() -> Result { |ctx| { FieldFuture::new(async move { let user = ctx.parent_value.try_downcast_ref::()?; - Ok(user - .profile_picture - .as_ref() - .map(|profile_picture| FieldValue::borrowed_any(profile_picture))) + Ok(user.profile_picture.as_ref().map(FieldValue::borrowed_any)) }) }, )) diff --git a/federation/dynamic-schema/federation-reviews/src/main.rs b/federation/dynamic-schema/federation-reviews/src/main.rs index ccbbaa5..e0b2212 100644 --- a/federation/dynamic-schema/federation-reviews/src/main.rs +++ b/federation/dynamic-schema/federation-reviews/src/main.rs @@ -141,10 +141,7 @@ fn schema() -> Result { FieldFuture::new(async move { let review = ctx.parent_value.try_downcast_ref::()?; Ok(Some(FieldValue::list( - review - .pictures - .iter() - .map(|picture| FieldValue::borrowed_any(picture)), + review.pictures.iter().map(FieldValue::borrowed_any), ))) }) }, @@ -201,9 +198,7 @@ fn schema() -> Result { FieldFuture::new(async move { let reviews = ctx.data::>()?; Ok(Some(FieldValue::list( - reviews - .iter() - .map(|review| FieldValue::borrowed_any(review)), + reviews.iter().map(FieldValue::borrowed_any), ))) }) }, @@ -258,7 +253,7 @@ fn schema() -> Result { reviews .iter() .filter(|review| review.get_author().id == user.id) - .map(|review| FieldValue::borrowed_any(review)), + .map(FieldValue::borrowed_any), ))) }) }, diff --git a/models/dynamic-starwars/src/model.rs b/models/dynamic-starwars/src/model.rs index f9f6a3a..9ecaaf8 100644 --- a/models/dynamic-starwars/src/model.rs +++ b/models/dynamic-starwars/src/model.rs @@ -214,9 +214,7 @@ pub fn schema() -> Result { FieldFuture::new(async move { let starwars = ctx.data::()?; let id = ctx.args.try_get("id")?; - Ok(starwars - .human(id.string()?) - .map(|v| FieldValue::borrowed_any(v))) + Ok(starwars.human(id.string()?).map(FieldValue::borrowed_any)) }) }) .argument(InputValue::new("id", TypeRef::named_nn(TypeRef::STRING))), @@ -229,7 +227,7 @@ pub fn schema() -> Result { let starwars = ctx.data::()?; let humans = starwars.humans(); Ok(Some(FieldValue::list( - humans.into_iter().map(|v| FieldValue::borrowed_any(v)), + humans.into_iter().map(FieldValue::borrowed_any), ))) }) }, @@ -239,9 +237,7 @@ pub fn schema() -> Result { FieldFuture::new(async move { let starwars = ctx.data::()?; let id = ctx.args.try_get("id")?; - Ok(starwars - .droid(id.string()?) - .map(|v| FieldValue::borrowed_any(v))) + Ok(starwars.droid(id.string()?).map(FieldValue::borrowed_any)) }) }) .argument(InputValue::new("id", TypeRef::named_nn(TypeRef::STRING))), @@ -254,7 +250,7 @@ pub fn schema() -> Result { let starwars = ctx.data::()?; let droids = starwars.droids(); Ok(Some(FieldValue::list( - droids.into_iter().map(|v| FieldValue::borrowed_any(v)), + droids.into_iter().map(FieldValue::borrowed_any), ))) }) }, diff --git a/poem/opentelemetry-basic/Cargo.toml b/poem/opentelemetry-basic/Cargo.toml index 23a667a..e29b0be 100644 --- a/poem/opentelemetry-basic/Cargo.toml +++ b/poem/opentelemetry-basic/Cargo.toml @@ -10,6 +10,6 @@ async-graphql = { path = "../../..", features = ["opentelemetry"] } async-graphql-poem = { path = "../../../integrations/poem" } tokio = { version = "1.37", features = ["macros", "rt-multi-thread"] } poem = "3.0.0" -opentelemetry = { version = "0.23.0" } -opentelemetry_sdk = { version = "0.23", features = ["rt-tokio"] } -opentelemetry-stdout = { version = "0.4.0", features = ["trace"] } +opentelemetry = { version = "0.25.0" } +opentelemetry_sdk = { version = "0.25", features = ["rt-tokio"] } +opentelemetry-stdout = { version = "0.25.0", features = ["trace"] } From 2e57cb79138ab661fd7af788abe66270caef37e5 Mon Sep 17 00:00:00 2001 From: Vlad Date: Mon, 7 Oct 2024 02:39:29 +1100 Subject: [PATCH 094/102] chore(deps): bump opentelemetry to 0.26 --- poem/opentelemetry-basic/Cargo.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/poem/opentelemetry-basic/Cargo.toml b/poem/opentelemetry-basic/Cargo.toml index e29b0be..d46d0bc 100644 --- a/poem/opentelemetry-basic/Cargo.toml +++ b/poem/opentelemetry-basic/Cargo.toml @@ -10,6 +10,6 @@ async-graphql = { path = "../../..", features = ["opentelemetry"] } async-graphql-poem = { path = "../../../integrations/poem" } tokio = { version = "1.37", features = ["macros", "rt-multi-thread"] } poem = "3.0.0" -opentelemetry = { version = "0.25.0" } -opentelemetry_sdk = { version = "0.25", features = ["rt-tokio"] } -opentelemetry-stdout = { version = "0.25.0", features = ["trace"] } +opentelemetry = { version = "0.26.0" } +opentelemetry_sdk = { version = "0.26", features = ["rt-tokio"] } +opentelemetry-stdout = { version = "0.26.0", features = ["trace"] } From 8f0450eec914aa546e5a36c67586b01cf8ffe087 Mon Sep 17 00:00:00 2001 From: Sunli Date: Sun, 17 Nov 2024 10:53:58 +0800 Subject: [PATCH 095/102] fix actix-web-subscription #1624 --- actix-web/subscription/src/main.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/actix-web/subscription/src/main.rs b/actix-web/subscription/src/main.rs index d226d4d..89ce1ae 100644 --- a/actix-web/subscription/src/main.rs +++ b/actix-web/subscription/src/main.rs @@ -35,12 +35,13 @@ async fn main() -> std::io::Result<()> { .service( web::resource("/") .guard(guard::Post()) - .to(GraphQL::new(schema)), + .to(GraphQL::new(schema.clone())), ) .service( web::resource("/") .guard(guard::Get()) .guard(guard::Header("upgrade", "websocket")) + .app_data(web::Data::new(schema)) .to(index_ws), ) .service(web::resource("/").guard(guard::Get()).to(index_graphiql)) From 0d210145c47674fa6d7484d6f7f967869c25ed51 Mon Sep 17 00:00:00 2001 From: Vlad Date: Sun, 24 Nov 2024 22:00:55 +1100 Subject: [PATCH 096/102] chore(deps): bump opentelemetry to 0.27 --- poem/opentelemetry-basic/Cargo.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/poem/opentelemetry-basic/Cargo.toml b/poem/opentelemetry-basic/Cargo.toml index d46d0bc..24f9359 100644 --- a/poem/opentelemetry-basic/Cargo.toml +++ b/poem/opentelemetry-basic/Cargo.toml @@ -10,6 +10,6 @@ async-graphql = { path = "../../..", features = ["opentelemetry"] } async-graphql-poem = { path = "../../../integrations/poem" } tokio = { version = "1.37", features = ["macros", "rt-multi-thread"] } poem = "3.0.0" -opentelemetry = { version = "0.26.0" } -opentelemetry_sdk = { version = "0.26", features = ["rt-tokio"] } -opentelemetry-stdout = { version = "0.26.0", features = ["trace"] } +opentelemetry = { version = "0.27.0" } +opentelemetry_sdk = { version = "0.27", features = ["rt-tokio"] } +opentelemetry-stdout = { version = "0.27.0", features = ["trace"] } From 6f007959f5cb3f835e6a073aedcb8bf6d43fba50 Mon Sep 17 00:00:00 2001 From: Sunli Date: Wed, 27 Nov 2024 12:16:13 +0800 Subject: [PATCH 097/102] update examples --- .../federation-accounts/src/main.rs | 5 ++++- .../federation-reviews/src/main.rs | 11 ++++++++--- models/dynamic-starwars/src/model.rs | 16 ++++++++++++---- poem/subscription-redis/Cargo.toml | 2 +- poem/subscription-redis/src/main.rs | 2 +- 5 files changed, 26 insertions(+), 10 deletions(-) diff --git a/federation/dynamic-schema/federation-accounts/src/main.rs b/federation/dynamic-schema/federation-accounts/src/main.rs index 4fff07c..c16fbc5 100644 --- a/federation/dynamic-schema/federation-accounts/src/main.rs +++ b/federation/dynamic-schema/federation-accounts/src/main.rs @@ -90,7 +90,10 @@ fn schema() -> Result { |ctx| { FieldFuture::new(async move { let user = ctx.parent_value.try_downcast_ref::()?; - Ok(user.profile_picture.as_ref().map(FieldValue::borrowed_any)) + Ok(user + .profile_picture + .as_ref() + .map(|pic| FieldValue::borrowed_any(pic))) }) }, )) diff --git a/federation/dynamic-schema/federation-reviews/src/main.rs b/federation/dynamic-schema/federation-reviews/src/main.rs index e0b2212..405be08 100644 --- a/federation/dynamic-schema/federation-reviews/src/main.rs +++ b/federation/dynamic-schema/federation-reviews/src/main.rs @@ -141,7 +141,10 @@ fn schema() -> Result { FieldFuture::new(async move { let review = ctx.parent_value.try_downcast_ref::()?; Ok(Some(FieldValue::list( - review.pictures.iter().map(FieldValue::borrowed_any), + review + .pictures + .iter() + .map(|review| FieldValue::borrowed_any(review)), ))) }) }, @@ -198,7 +201,9 @@ fn schema() -> Result { FieldFuture::new(async move { let reviews = ctx.data::>()?; Ok(Some(FieldValue::list( - reviews.iter().map(FieldValue::borrowed_any), + reviews + .iter() + .map(|review| FieldValue::borrowed_any(review)), ))) }) }, @@ -253,7 +258,7 @@ fn schema() -> Result { reviews .iter() .filter(|review| review.get_author().id == user.id) - .map(FieldValue::borrowed_any), + .map(|review| FieldValue::borrowed_any(review)), ))) }) }, diff --git a/models/dynamic-starwars/src/model.rs b/models/dynamic-starwars/src/model.rs index 9ecaaf8..a307afb 100644 --- a/models/dynamic-starwars/src/model.rs +++ b/models/dynamic-starwars/src/model.rs @@ -214,7 +214,9 @@ pub fn schema() -> Result { FieldFuture::new(async move { let starwars = ctx.data::()?; let id = ctx.args.try_get("id")?; - Ok(starwars.human(id.string()?).map(FieldValue::borrowed_any)) + Ok(starwars + .human(id.string()?) + .map(|human| FieldValue::borrowed_any(human))) }) }) .argument(InputValue::new("id", TypeRef::named_nn(TypeRef::STRING))), @@ -227,7 +229,9 @@ pub fn schema() -> Result { let starwars = ctx.data::()?; let humans = starwars.humans(); Ok(Some(FieldValue::list( - humans.into_iter().map(FieldValue::borrowed_any), + humans + .into_iter() + .map(|human| FieldValue::borrowed_any(human)), ))) }) }, @@ -237,7 +241,9 @@ pub fn schema() -> Result { FieldFuture::new(async move { let starwars = ctx.data::()?; let id = ctx.args.try_get("id")?; - Ok(starwars.droid(id.string()?).map(FieldValue::borrowed_any)) + Ok(starwars + .droid(id.string()?) + .map(|droid| FieldValue::borrowed_any(droid))) }) }) .argument(InputValue::new("id", TypeRef::named_nn(TypeRef::STRING))), @@ -250,7 +256,9 @@ pub fn schema() -> Result { let starwars = ctx.data::()?; let droids = starwars.droids(); Ok(Some(FieldValue::list( - droids.into_iter().map(FieldValue::borrowed_any), + droids + .into_iter() + .map(|droid| FieldValue::borrowed_any(droid)), ))) }) }, diff --git a/poem/subscription-redis/Cargo.toml b/poem/subscription-redis/Cargo.toml index 8f90371..a57037d 100644 --- a/poem/subscription-redis/Cargo.toml +++ b/poem/subscription-redis/Cargo.toml @@ -8,5 +8,5 @@ async-graphql = { path = "../../.." } async-graphql-poem = { path = "../../../integrations/poem" } tokio = { version = "1.37", features = ["macros", "rt-multi-thread"] } poem = { version = "3.0.0", features = ["websocket"] } -redis = { version = "0.25.2", features = ["aio", "tokio-comp"] } +redis = { version = "0.27.5", features = ["aio", "tokio-comp"] } futures-util = "0.3.30" diff --git a/poem/subscription-redis/src/main.rs b/poem/subscription-redis/src/main.rs index 0f11d7c..611b682 100644 --- a/poem/subscription-redis/src/main.rs +++ b/poem/subscription-redis/src/main.rs @@ -20,7 +20,7 @@ impl MutationRoot { async fn publish(&self, ctx: &Context<'_>, value: String) -> Result { let client = ctx.data_unchecked::(); let mut conn = client.get_multiplexed_async_connection().await?; - conn.publish("values", value).await?; + conn.publish::<_, _, ()>("values", value).await?; Ok(true) } } From 308025986a50145e4b59f22e64da93f5b87a042b Mon Sep 17 00:00:00 2001 From: Aumetra Weisman Date: Sat, 4 Jan 2025 13:54:00 +0100 Subject: [PATCH 098/102] Bump axum to v0.8 --- axum/starwars/Cargo.toml | 2 +- axum/subscription/Cargo.toml | 2 +- axum/token-from-header/Cargo.toml | 2 +- axum/upload/Cargo.toml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/axum/starwars/Cargo.toml b/axum/starwars/Cargo.toml index a301e5a..a5c15e1 100644 --- a/axum/starwars/Cargo.toml +++ b/axum/starwars/Cargo.toml @@ -8,4 +8,4 @@ async-graphql = { path = "../../.." } async-graphql-axum = { path = "../../../integrations/axum" } tokio = { version = "1.37", features = ["macros", "rt-multi-thread"] } starwars = { path = "../../models/starwars" } -axum = { version = "0.7.5" } +axum = { version = "0.8.1" } diff --git a/axum/subscription/Cargo.toml b/axum/subscription/Cargo.toml index d10012f..6415434 100644 --- a/axum/subscription/Cargo.toml +++ b/axum/subscription/Cargo.toml @@ -8,4 +8,4 @@ async-graphql = { path = "../../.." } async-graphql-axum = { path = "../../../integrations/axum" } tokio = { version = "1.37", features = ["macros", "rt-multi-thread"] } books = { path = "../../models/books" } -axum = { version = "0.7.5", features = ["ws"] } +axum = { version = "0.8.1", features = ["ws"] } diff --git a/axum/token-from-header/Cargo.toml b/axum/token-from-header/Cargo.toml index 69f0d31..d60c3f3 100644 --- a/axum/token-from-header/Cargo.toml +++ b/axum/token-from-header/Cargo.toml @@ -8,4 +8,4 @@ async-graphql = { path = "../../.." } async-graphql-axum = { path = "../../../integrations/axum" } tokio = { version = "1.37", features = ["macros", "rt-multi-thread"] } token = { path = "../../models/token" } -axum = { version = "0.7.5", features = ["ws"] } +axum = { version = "0.8.1", features = ["ws"] } diff --git a/axum/upload/Cargo.toml b/axum/upload/Cargo.toml index 0810f64..326c343 100644 --- a/axum/upload/Cargo.toml +++ b/axum/upload/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-axum = { path = "../../../integrations/axum" } -axum = "0.7.5" +axum = "0.8.1" files = { path = "../../models/files" } tokio = { version = "1.37", features = ["macros", "rt-multi-thread"] } tower-http = { version = "0.5.2", features = ["cors"] } From 6829e43635d150debcbb00001fb50633464bb92c Mon Sep 17 00:00:00 2001 From: Negezor Date: Wed, 12 Feb 2025 23:07:20 +1100 Subject: [PATCH 099/102] chore: apply clippy --- models/dynamic-books/src/model.rs | 2 +- models/dynamic-starwars/src/model.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/models/dynamic-books/src/model.rs b/models/dynamic-books/src/model.rs index ba466e0..a7f5695 100644 --- a/models/dynamic-books/src/model.rs +++ b/models/dynamic-books/src/model.rs @@ -3,7 +3,7 @@ use futures_util::StreamExt; use crate::{simple_broker::SimpleBroker, Book, BookChanged, MutationType, Storage}; -impl<'a> From for FieldValue<'a> { +impl From for FieldValue<'_> { fn from(value: MutationType) -> Self { match value { MutationType::Created => FieldValue::value("CREATED"), diff --git a/models/dynamic-starwars/src/model.rs b/models/dynamic-starwars/src/model.rs index a307afb..c660b96 100644 --- a/models/dynamic-starwars/src/model.rs +++ b/models/dynamic-starwars/src/model.rs @@ -2,7 +2,7 @@ use async_graphql::{dynamic::*, Value}; use crate::{Episode, StarWars, StarWarsChar}; -impl<'a> From for FieldValue<'a> { +impl From for FieldValue<'_> { fn from(value: Episode) -> Self { match value { Episode::NewHope => FieldValue::value("NEW_HOPE"), From 907c2ce0f88ada8ca720b6d84b560e176ee6af64 Mon Sep 17 00:00:00 2001 From: Sunli Date: Sat, 10 May 2025 22:01:42 +0800 Subject: [PATCH 100/102] update edition to `2024` --- .rustfmt.toml | 2 +- actix-web/error-extensions/Cargo.toml | 6 ++++-- actix-web/starwars/Cargo.toml | 6 ++++-- actix-web/subscription/Cargo.toml | 6 ++++-- actix-web/token-from-header/Cargo.toml | 6 ++++-- actix-web/upload/Cargo.toml | 6 ++++-- axum/starwars/Cargo.toml | 2 +- axum/subscription/Cargo.toml | 2 +- axum/token-from-header/Cargo.toml | 2 +- axum/upload/Cargo.toml | 2 +- federation/dynamic-schema/federation-accounts/Cargo.toml | 4 ++-- federation/dynamic-schema/federation-products/Cargo.toml | 4 ++-- federation/dynamic-schema/federation-reviews/Cargo.toml | 4 ++-- federation/static-schema/directives/Cargo.toml | 2 +- federation/static-schema/federation-accounts/Cargo.toml | 4 ++-- federation/static-schema/federation-products/Cargo.toml | 4 ++-- federation/static-schema/federation-reviews/Cargo.toml | 4 ++-- loco/starwars/Cargo.toml | 2 +- loco/subscription/Cargo.toml | 2 +- models/books/Cargo.toml | 2 +- models/dynamic-books/Cargo.toml | 2 +- models/dynamic-files/Cargo.toml | 2 +- models/dynamic-starwars/Cargo.toml | 2 +- models/files/Cargo.toml | 2 +- models/starwars/Cargo.toml | 2 +- models/token/Cargo.toml | 2 +- poem/dynamic-books/Cargo.toml | 4 ++-- poem/dynamic-schema/Cargo.toml | 4 ++-- poem/dynamic-starwars/Cargo.toml | 4 ++-- poem/dynamic-upload/Cargo.toml | 2 +- poem/opentelemetry-basic/Cargo.toml | 2 +- poem/starwars/Cargo.toml | 4 ++-- poem/subscription-redis/Cargo.toml | 2 +- poem/subscription/Cargo.toml | 4 ++-- poem/token-from-header/Cargo.toml | 4 ++-- poem/upload/Cargo.toml | 2 +- rocket/starwars/Cargo.toml | 2 +- rocket/upload/Cargo.toml | 2 +- warp/starwars/Cargo.toml | 2 +- warp/subscription/Cargo.toml | 2 +- warp/token-from-header/Cargo.toml | 2 +- 41 files changed, 68 insertions(+), 58 deletions(-) diff --git a/.rustfmt.toml b/.rustfmt.toml index 066a39d..364029d 100644 --- a/.rustfmt.toml +++ b/.rustfmt.toml @@ -1,4 +1,4 @@ -edition = "2021" +edition = "2024" newline_style = "Unix" # comments normalize_comments = true diff --git a/actix-web/error-extensions/Cargo.toml b/actix-web/error-extensions/Cargo.toml index 013ac15..1a5d347 100644 --- a/actix-web/error-extensions/Cargo.toml +++ b/actix-web/error-extensions/Cargo.toml @@ -2,11 +2,13 @@ name = "actix-web-error-extensions" version = "0.1.1" authors = ["sunli "] -edition = "2021" +edition = "2024" [dependencies] async-graphql = { path = "../../.." } async-graphql-actix-web = { path = "../../../integrations/actix-web" } -actix-web = { version = "4.5.1", default-features = false, features = ["macros"] } +actix-web = { version = "4.5.1", default-features = false, features = [ + "macros", +] } thiserror = "1.0" serde_json = "1.0" diff --git a/actix-web/starwars/Cargo.toml b/actix-web/starwars/Cargo.toml index b0173ae..379228f 100644 --- a/actix-web/starwars/Cargo.toml +++ b/actix-web/starwars/Cargo.toml @@ -2,10 +2,12 @@ name = "actix-web-starwars" version = "0.1.1" authors = ["sunli "] -edition = "2021" +edition = "2024" [dependencies] async-graphql = { path = "../../.." } async-graphql-actix-web = { path = "../../../integrations/actix-web" } -actix-web = { version = "4.5.1", default-features = false, features = ["macros"] } +actix-web = { version = "4.5.1", default-features = false, features = [ + "macros", +] } starwars = { path = "../../models/starwars" } diff --git a/actix-web/subscription/Cargo.toml b/actix-web/subscription/Cargo.toml index ae20b6f..caf53d4 100644 --- a/actix-web/subscription/Cargo.toml +++ b/actix-web/subscription/Cargo.toml @@ -2,10 +2,12 @@ name = "actix-web-subscription" version = "0.1.1" authors = ["sunli "] -edition = "2021" +edition = "2024" [dependencies] async-graphql = { path = "../../.." } async-graphql-actix-web = { path = "../../../integrations/actix-web" } -actix-web = { version = "4.5.1", default-features = false, features = ["macros"] } +actix-web = { version = "4.5.1", default-features = false, features = [ + "macros", +] } books = { path = "../../models/books" } diff --git a/actix-web/token-from-header/Cargo.toml b/actix-web/token-from-header/Cargo.toml index cb04c92..2db48e8 100644 --- a/actix-web/token-from-header/Cargo.toml +++ b/actix-web/token-from-header/Cargo.toml @@ -2,10 +2,12 @@ name = "actix-web-token-from-header" version = "0.1.1" authors = ["sunli "] -edition = "2021" +edition = "2024" [dependencies] async-graphql = { path = "../../.." } async-graphql-actix-web = { path = "../../../integrations/actix-web" } -actix-web = { version = "4.5.1", default-features = false, features = ["macros"] } +actix-web = { version = "4.5.1", default-features = false, features = [ + "macros", +] } token = { path = "../../models/token" } diff --git a/actix-web/upload/Cargo.toml b/actix-web/upload/Cargo.toml index 5c5dd6f..d0a17ae 100644 --- a/actix-web/upload/Cargo.toml +++ b/actix-web/upload/Cargo.toml @@ -2,10 +2,12 @@ name = "actix-web-upload" version = "0.1.1" authors = ["sunli "] -edition = "2021" +edition = "2024" [dependencies] async-graphql = { path = "../../.." } async-graphql-actix-web = { path = "../../../integrations/actix-web" } -actix-web = { version = "4.5.1", default-features = false, features = ["macros"] } +actix-web = { version = "4.5.1", default-features = false, features = [ + "macros", +] } files = { path = "../../models/files" } diff --git a/axum/starwars/Cargo.toml b/axum/starwars/Cargo.toml index a5c15e1..1221e1b 100644 --- a/axum/starwars/Cargo.toml +++ b/axum/starwars/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "axum-starwars" version = "0.1.0" -edition = "2021" +edition = "2024" [dependencies] async-graphql = { path = "../../.." } diff --git a/axum/subscription/Cargo.toml b/axum/subscription/Cargo.toml index 6415434..4d5eb88 100644 --- a/axum/subscription/Cargo.toml +++ b/axum/subscription/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "axum-subscription" version = "0.1.0" -edition = "2021" +edition = "2024" [dependencies] async-graphql = { path = "../../.." } diff --git a/axum/token-from-header/Cargo.toml b/axum/token-from-header/Cargo.toml index d60c3f3..25fc994 100644 --- a/axum/token-from-header/Cargo.toml +++ b/axum/token-from-header/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "axum-token-from-header" version = "0.1.0" -edition = "2021" +edition = "2024" [dependencies] async-graphql = { path = "../../.." } diff --git a/axum/upload/Cargo.toml b/axum/upload/Cargo.toml index 326c343..dcdf687 100644 --- a/axum/upload/Cargo.toml +++ b/axum/upload/Cargo.toml @@ -2,7 +2,7 @@ name = "axum-upload" version = "0.1.1" authors = ["sunli "] -edition = "2021" +edition = "2024" [dependencies] async-graphql = { path = "../../.." } diff --git a/federation/dynamic-schema/federation-accounts/Cargo.toml b/federation/dynamic-schema/federation-accounts/Cargo.toml index 1c66f58..fa0ffec 100644 --- a/federation/dynamic-schema/federation-accounts/Cargo.toml +++ b/federation/dynamic-schema/federation-accounts/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "dynamic-federation-accounts" version = "0.1.0" -edition = "2021" +edition = "2024" [dependencies] async-graphql = { path = "../../../..", features = ["dynamic-schema"] } async-graphql-poem = { path = "../../../../integrations/poem" } tokio = { version = "1.37", features = ["macros", "rt-multi-thread"] } -poem = { version = "3.0.0" } \ No newline at end of file +poem = { version = "3.0.0" } diff --git a/federation/dynamic-schema/federation-products/Cargo.toml b/federation/dynamic-schema/federation-products/Cargo.toml index 209f487..535a220 100644 --- a/federation/dynamic-schema/federation-products/Cargo.toml +++ b/federation/dynamic-schema/federation-products/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "dynamic-federation-products" version = "0.1.0" -edition = "2021" +edition = "2024" [dependencies] async-graphql = { path = "../../../..", features = ["dynamic-schema"] } async-graphql-poem = { path = "../../../../integrations/poem" } tokio = { version = "1.37", features = ["macros", "rt-multi-thread"] } -poem = { version = "3.0.0" } \ No newline at end of file +poem = { version = "3.0.0" } diff --git a/federation/dynamic-schema/federation-reviews/Cargo.toml b/federation/dynamic-schema/federation-reviews/Cargo.toml index 35cae73..d4a7028 100644 --- a/federation/dynamic-schema/federation-reviews/Cargo.toml +++ b/federation/dynamic-schema/federation-reviews/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "dynamic-federation-reviews" version = "0.1.0" -edition = "2021" +edition = "2024" [dependencies] async-graphql = { path = "../../../..", features = ["dynamic-schema"] } async-graphql-poem = { path = "../../../../integrations/poem" } tokio = { version = "1.37", features = ["macros", "rt-multi-thread"] } -poem = { version = "3.0.0" } \ No newline at end of file +poem = { version = "3.0.0" } diff --git a/federation/static-schema/directives/Cargo.toml b/federation/static-schema/directives/Cargo.toml index 500fa6d..cfd89ce 100644 --- a/federation/static-schema/directives/Cargo.toml +++ b/federation/static-schema/directives/Cargo.toml @@ -2,7 +2,7 @@ name = "directives" version = "0.1.0" authors = ["sunli "] -edition = "2021" +edition = "2024" [dependencies] async-graphql = { path = "../../../.." } diff --git a/federation/static-schema/federation-accounts/Cargo.toml b/federation/static-schema/federation-accounts/Cargo.toml index 80ccf9a..64288ab 100644 --- a/federation/static-schema/federation-accounts/Cargo.toml +++ b/federation/static-schema/federation-accounts/Cargo.toml @@ -2,11 +2,11 @@ name = "static-federation-accounts" version = "0.2.0" authors = ["sunli "] -edition = "2021" +edition = "2024" [dependencies] async-graphql = { path = "../../../.." } async-graphql-poem = { path = "../../../../integrations/poem" } directives = { path = "../directives" } tokio = { version = "1.37", features = ["macros", "rt-multi-thread"] } -poem = { version = "3.0.0" } \ No newline at end of file +poem = { version = "3.0.0" } diff --git a/federation/static-schema/federation-products/Cargo.toml b/federation/static-schema/federation-products/Cargo.toml index 9e9066f..c754ce9 100644 --- a/federation/static-schema/federation-products/Cargo.toml +++ b/federation/static-schema/federation-products/Cargo.toml @@ -2,11 +2,11 @@ name = "static-federation-products" version = "0.2.0" authors = ["sunli "] -edition = "2021" +edition = "2024" [dependencies] async-graphql = { path = "../../../.." } async-graphql-poem = { path = "../../../../integrations/poem" } directives = { path = "../directives" } tokio = { version = "1.37", features = ["macros", "rt-multi-thread"] } -poem = { version = "3.0.0" } \ No newline at end of file +poem = { version = "3.0.0" } diff --git a/federation/static-schema/federation-reviews/Cargo.toml b/federation/static-schema/federation-reviews/Cargo.toml index f877ee6..5a86fa8 100644 --- a/federation/static-schema/federation-reviews/Cargo.toml +++ b/federation/static-schema/federation-reviews/Cargo.toml @@ -2,11 +2,11 @@ name = "static-federation-reviews" version = "0.2.0" authors = ["sunli "] -edition = "2021" +edition = "2024" [dependencies] async-graphql = { path = "../../../.." } async-graphql-poem = { path = "../../../../integrations/poem" } directives = { path = "../directives" } tokio = { version = "1.37", features = ["macros", "rt-multi-thread"] } -poem = { version = "3.0.0" } \ No newline at end of file +poem = { version = "3.0.0" } diff --git a/loco/starwars/Cargo.toml b/loco/starwars/Cargo.toml index 6136bed..37ec452 100644 --- a/loco/starwars/Cargo.toml +++ b/loco/starwars/Cargo.toml @@ -3,7 +3,7 @@ [package] name = "loco-starwars" version = "0.1.0" -edition = "2021" +edition = "2024" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/loco/subscription/Cargo.toml b/loco/subscription/Cargo.toml index b6c4381..ea2f83c 100644 --- a/loco/subscription/Cargo.toml +++ b/loco/subscription/Cargo.toml @@ -3,7 +3,7 @@ [package] name = "loco-subscription" version = "0.1.0" -edition = "2021" +edition = "2024" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/models/books/Cargo.toml b/models/books/Cargo.toml index aad4193..e5bc6a7 100644 --- a/models/books/Cargo.toml +++ b/models/books/Cargo.toml @@ -2,7 +2,7 @@ name = "books" version = "0.1.1" authors = ["sunli "] -edition = "2021" +edition = "2024" [dependencies] async-graphql = { path = "../../.." } diff --git a/models/dynamic-books/Cargo.toml b/models/dynamic-books/Cargo.toml index fc6d02b..e8296e5 100644 --- a/models/dynamic-books/Cargo.toml +++ b/models/dynamic-books/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dynamic-books" version = "0.1.0" -edition = "2021" +edition = "2024" [dependencies] async-graphql = { path = "../../..", features = ["dynamic-schema"] } diff --git a/models/dynamic-files/Cargo.toml b/models/dynamic-files/Cargo.toml index ee2f6c7..208e619 100644 --- a/models/dynamic-files/Cargo.toml +++ b/models/dynamic-files/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dynamic-files" version = "0.1.0" -edition = "2021" +edition = "2024" [dependencies] async-graphql = { path = "../../.." } diff --git a/models/dynamic-starwars/Cargo.toml b/models/dynamic-starwars/Cargo.toml index c5a7286..933e3d7 100644 --- a/models/dynamic-starwars/Cargo.toml +++ b/models/dynamic-starwars/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dynamic-starwars" version = "0.1.0" -edition = "2021" +edition = "2024" [dependencies] async-graphql = { path = "../../..", features = ["dynamic-schema"] } diff --git a/models/files/Cargo.toml b/models/files/Cargo.toml index b14f440..bc3e979 100644 --- a/models/files/Cargo.toml +++ b/models/files/Cargo.toml @@ -2,7 +2,7 @@ name = "files" version = "0.1.1" authors = ["sunli "] -edition = "2021" +edition = "2024" [dependencies] async-graphql = { path = "../../.." } diff --git a/models/starwars/Cargo.toml b/models/starwars/Cargo.toml index 9f5ca3d..72fa92e 100644 --- a/models/starwars/Cargo.toml +++ b/models/starwars/Cargo.toml @@ -2,7 +2,7 @@ name = "starwars" version = "0.1.1" authors = ["sunli "] -edition = "2021" +edition = "2024" [dependencies] async-graphql = { path = "../../.." } diff --git a/models/token/Cargo.toml b/models/token/Cargo.toml index 22ed687..cde96e9 100644 --- a/models/token/Cargo.toml +++ b/models/token/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "token" version = "0.1.0" -edition = "2021" +edition = "2024" [dependencies] async-graphql = { path = "../../.." } diff --git a/poem/dynamic-books/Cargo.toml b/poem/dynamic-books/Cargo.toml index 0e2a191..0acac2c 100644 --- a/poem/dynamic-books/Cargo.toml +++ b/poem/dynamic-books/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "poem-dynamic-books" version = "0.1.0" -edition = "2021" +edition = "2024" [dependencies] async-graphql = { path = "../../..", features = ["dynamic-schema"] } async-graphql-poem = { path = "../../../integrations/poem" } tokio = { version = "1.37", features = ["macros", "rt-multi-thread"] } dynamic-books = { path = "../../models/dynamic-books" } -poem = "3.0.0" \ No newline at end of file +poem = "3.0.0" diff --git a/poem/dynamic-schema/Cargo.toml b/poem/dynamic-schema/Cargo.toml index 559b9b9..84fdb4c 100644 --- a/poem/dynamic-schema/Cargo.toml +++ b/poem/dynamic-schema/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "poem-dynamic-schema" version = "0.1.0" -edition = "2021" +edition = "2024" [dependencies] async-graphql = { path = "../../..", features = ["dynamic-schema"] } async-graphql-poem = { path = "../../../integrations/poem" } tokio = { version = "1.37", features = ["macros", "rt-multi-thread"] } -poem = { version = "3.0.0" } \ No newline at end of file +poem = { version = "3.0.0" } diff --git a/poem/dynamic-starwars/Cargo.toml b/poem/dynamic-starwars/Cargo.toml index a30d1cb..6ccc630 100644 --- a/poem/dynamic-starwars/Cargo.toml +++ b/poem/dynamic-starwars/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "poem-dynamic-starwars" version = "0.1.0" -edition = "2021" +edition = "2024" [dependencies] async-graphql = { path = "../../..", features = ["dynamic-schema"] } async-graphql-poem = { path = "../../../integrations/poem" } tokio = { version = "1.37", features = ["macros", "rt-multi-thread"] } dynamic-starwars = { path = "../../models/dynamic-starwars" } -poem = "3.0.0" \ No newline at end of file +poem = "3.0.0" diff --git a/poem/dynamic-upload/Cargo.toml b/poem/dynamic-upload/Cargo.toml index 96dd4ef..4211e9d 100644 --- a/poem/dynamic-upload/Cargo.toml +++ b/poem/dynamic-upload/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dynamic-upload" version = "0.1.0" -edition = "2021" +edition = "2024" [dependencies] async-graphql = { path = "../../..", features = ["dynamic-schema"] } diff --git a/poem/opentelemetry-basic/Cargo.toml b/poem/opentelemetry-basic/Cargo.toml index 24f9359..f2d3882 100644 --- a/poem/opentelemetry-basic/Cargo.toml +++ b/poem/opentelemetry-basic/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "poem-opentelemetry-basic" version = "0.1.0" -edition = "2021" +edition = "2024" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/poem/starwars/Cargo.toml b/poem/starwars/Cargo.toml index 6125b16..d521325 100644 --- a/poem/starwars/Cargo.toml +++ b/poem/starwars/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "poem-starwars" version = "0.1.0" -edition = "2021" +edition = "2024" [dependencies] async-graphql = { path = "../../.." } async-graphql-poem = { path = "../../../integrations/poem" } tokio = { version = "1.37", features = ["macros", "rt-multi-thread"] } starwars = { path = "../../models/starwars" } -poem = "3.0.0" \ No newline at end of file +poem = "3.0.0" diff --git a/poem/subscription-redis/Cargo.toml b/poem/subscription-redis/Cargo.toml index a57037d..827cbc6 100644 --- a/poem/subscription-redis/Cargo.toml +++ b/poem/subscription-redis/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "subscription-redis" version = "0.1.0" -edition = "2021" +edition = "2024" [dependencies] async-graphql = { path = "../../.." } diff --git a/poem/subscription/Cargo.toml b/poem/subscription/Cargo.toml index 22e2b74..f024aba 100644 --- a/poem/subscription/Cargo.toml +++ b/poem/subscription/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "poem-subscription" version = "0.1.0" -edition = "2021" +edition = "2024" [dependencies] async-graphql = { path = "../../.." } async-graphql-poem = { path = "../../../integrations/poem" } tokio = { version = "1.37", features = ["macros", "rt-multi-thread"] } books = { path = "../../models/books" } -poem = { version = "3.0.0", features = ["websocket"] } \ No newline at end of file +poem = { version = "3.0.0", features = ["websocket"] } diff --git a/poem/token-from-header/Cargo.toml b/poem/token-from-header/Cargo.toml index 708e394..acc10b3 100644 --- a/poem/token-from-header/Cargo.toml +++ b/poem/token-from-header/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "poem-token-from-header" version = "0.1.0" -edition = "2021" +edition = "2024" [dependencies] async-graphql = { path = "../../.." } async-graphql-poem = { path = "../../../integrations/poem" } token = { path = "../../models/token" } poem = { version = "3.0.0", features = ["websocket"] } -tokio = { version = "1.37", features = ["macros", "rt-multi-thread"] } \ No newline at end of file +tokio = { version = "1.37", features = ["macros", "rt-multi-thread"] } diff --git a/poem/upload/Cargo.toml b/poem/upload/Cargo.toml index 081d6c9..6498e04 100644 --- a/poem/upload/Cargo.toml +++ b/poem/upload/Cargo.toml @@ -2,7 +2,7 @@ name = "poem-upload" version = "0.1.1" authors = ["sunli "] -edition = "2021" +edition = "2024" [dependencies] async-graphql = { path = "../../.." } diff --git a/rocket/starwars/Cargo.toml b/rocket/starwars/Cargo.toml index ff65574..1ef2b8c 100644 --- a/rocket/starwars/Cargo.toml +++ b/rocket/starwars/Cargo.toml @@ -2,7 +2,7 @@ name = "rocket-starwars" version = "0.1.1" authors = ["Daniel Wiesenberg "] -edition = "2021" +edition = "2024" [dependencies] async-graphql = { path = "../../.." } diff --git a/rocket/upload/Cargo.toml b/rocket/upload/Cargo.toml index cdbf040..b39af4c 100644 --- a/rocket/upload/Cargo.toml +++ b/rocket/upload/Cargo.toml @@ -2,7 +2,7 @@ name = "rocket-upload" version = "0.1.1" authors = ["Daniel Wiesenberg "] -edition = "2021" +edition = "2024" [dependencies] async-graphql = { path = "../../.." } diff --git a/warp/starwars/Cargo.toml b/warp/starwars/Cargo.toml index 48b1050..10c3ead 100644 --- a/warp/starwars/Cargo.toml +++ b/warp/starwars/Cargo.toml @@ -2,7 +2,7 @@ name = "warp-starwars" version = "0.1.1" authors = ["sunli "] -edition = "2021" +edition = "2024" [dependencies] async-graphql = { path = "../../.." } diff --git a/warp/subscription/Cargo.toml b/warp/subscription/Cargo.toml index e4ecdbe..44f2e6a 100644 --- a/warp/subscription/Cargo.toml +++ b/warp/subscription/Cargo.toml @@ -2,7 +2,7 @@ name = "warp-subscription" version = "0.1.1" authors = ["sunli "] -edition = "2021" +edition = "2024" [dependencies] async-graphql = { path = "../../.." } diff --git a/warp/token-from-header/Cargo.toml b/warp/token-from-header/Cargo.toml index d3a38a2..bd09f1f 100644 --- a/warp/token-from-header/Cargo.toml +++ b/warp/token-from-header/Cargo.toml @@ -2,7 +2,7 @@ name = "warp-token-from-header" version = "0.1.1" authors = ["sunli "] -edition = "2021" +edition = "2024" [dependencies] async-graphql = { path = "../../.." } From cddf5b6bd6f711e25864807d10ddcab33c294536 Mon Sep 17 00:00:00 2001 From: Sunli Date: Sat, 10 May 2025 22:39:27 +0800 Subject: [PATCH 101/102] rustfmt --- actix-web/error-extensions/src/main.rs | 6 +++--- actix-web/starwars/src/main.rs | 4 ++-- actix-web/subscription/src/main.rs | 4 ++-- actix-web/token-from-header/src/main.rs | 6 +++--- actix-web/upload/src/main.rs | 4 ++-- axum/starwars/src/main.rs | 4 ++-- axum/subscription/src/main.rs | 4 ++-- axum/token-from-header/src/main.rs | 8 ++++---- axum/upload/src/main.rs | 4 ++-- .../dynamic-schema/federation-accounts/src/main.rs | 2 +- .../dynamic-schema/federation-products/src/main.rs | 2 +- federation/dynamic-schema/federation-reviews/src/main.rs | 2 +- federation/static-schema/federation-accounts/src/main.rs | 4 ++-- federation/static-schema/federation-products/src/main.rs | 2 +- federation/static-schema/federation-reviews/src/main.rs | 6 +++--- models/books/src/lib.rs | 4 ++-- models/dynamic-books/src/model.rs | 4 ++-- models/dynamic-files/src/lib.rs | 2 +- models/dynamic-starwars/src/model.rs | 2 +- models/files/src/lib.rs | 2 +- models/starwars/src/model.rs | 2 +- poem/dynamic-books/src/main.rs | 2 +- poem/dynamic-schema/src/main.rs | 6 +++--- poem/dynamic-starwars/src/main.rs | 2 +- poem/dynamic-upload/src/main.rs | 2 +- poem/opentelemetry-basic/src/main.rs | 8 +++++--- poem/starwars/src/main.rs | 4 ++-- poem/subscription-redis/src/main.rs | 4 ++-- poem/subscription/src/main.rs | 4 ++-- poem/token-from-header/src/main.rs | 9 ++++----- poem/upload/src/main.rs | 5 ++--- rocket/starwars/src/main.rs | 4 ++-- rocket/upload/src/main.rs | 4 ++-- warp/starwars/src/main.rs | 4 ++-- warp/subscription/src/main.rs | 6 +++--- warp/token-from-header/src/main.rs | 8 ++++---- 36 files changed, 75 insertions(+), 75 deletions(-) diff --git a/actix-web/error-extensions/src/main.rs b/actix-web/error-extensions/src/main.rs index c84c955..ff2f8fa 100644 --- a/actix-web/error-extensions/src/main.rs +++ b/actix-web/error-extensions/src/main.rs @@ -1,10 +1,10 @@ #[macro_use] extern crate thiserror; -use actix_web::{guard, web, App, HttpResponse, HttpServer}; +use actix_web::{App, HttpResponse, HttpServer, guard, web}; use async_graphql::{ - http::GraphiQLSource, EmptyMutation, EmptySubscription, ErrorExtensions, FieldError, - FieldResult, Object, ResultExt, Schema, + EmptyMutation, EmptySubscription, ErrorExtensions, FieldError, FieldResult, Object, ResultExt, + Schema, http::GraphiQLSource, }; use async_graphql_actix_web::GraphQL; diff --git a/actix-web/starwars/src/main.rs b/actix-web/starwars/src/main.rs index 20c8876..d85ede7 100644 --- a/actix-web/starwars/src/main.rs +++ b/actix-web/starwars/src/main.rs @@ -1,5 +1,5 @@ -use actix_web::{guard, web, App, HttpResponse, HttpServer, Result}; -use async_graphql::{http::GraphiQLSource, EmptyMutation, EmptySubscription, Schema}; +use actix_web::{App, HttpResponse, HttpServer, Result, guard, web}; +use async_graphql::{EmptyMutation, EmptySubscription, Schema, http::GraphiQLSource}; use async_graphql_actix_web::GraphQL; use starwars::{QueryRoot, StarWars}; diff --git a/actix-web/subscription/src/main.rs b/actix-web/subscription/src/main.rs index 89ce1ae..8831b0c 100644 --- a/actix-web/subscription/src/main.rs +++ b/actix-web/subscription/src/main.rs @@ -1,5 +1,5 @@ -use actix_web::{guard, web, App, HttpRequest, HttpResponse, HttpServer, Result}; -use async_graphql::{http::GraphiQLSource, Schema}; +use actix_web::{App, HttpRequest, HttpResponse, HttpServer, Result, guard, web}; +use async_graphql::{Schema, http::GraphiQLSource}; use async_graphql_actix_web::{GraphQL, GraphQLSubscription}; use books::{BooksSchema, MutationRoot, QueryRoot, Storage, SubscriptionRoot}; diff --git a/actix-web/token-from-header/src/main.rs b/actix-web/token-from-header/src/main.rs index 859ff12..700e265 100644 --- a/actix-web/token-from-header/src/main.rs +++ b/actix-web/token-from-header/src/main.rs @@ -1,9 +1,9 @@ use actix_web::{ - guard, http::header::HeaderMap, web, App, HttpRequest, HttpResponse, HttpServer, Result, + App, HttpRequest, HttpResponse, HttpServer, Result, guard, http::header::HeaderMap, web, }; -use async_graphql::{http::GraphiQLSource, EmptyMutation, Schema}; +use async_graphql::{EmptyMutation, Schema, http::GraphiQLSource}; use async_graphql_actix_web::{GraphQLRequest, GraphQLResponse, GraphQLSubscription}; -use token::{on_connection_init, QueryRoot, SubscriptionRoot, Token, TokenSchema}; +use token::{QueryRoot, SubscriptionRoot, Token, TokenSchema, on_connection_init}; async fn graphiql() -> HttpResponse { HttpResponse::Ok() diff --git a/actix-web/upload/src/main.rs b/actix-web/upload/src/main.rs index 7a5291c..f9993ac 100644 --- a/actix-web/upload/src/main.rs +++ b/actix-web/upload/src/main.rs @@ -1,7 +1,7 @@ -use actix_web::{guard, web, web::Data, App, HttpResponse, HttpServer}; +use actix_web::{App, HttpResponse, HttpServer, guard, web, web::Data}; use async_graphql::{ - http::{GraphiQLSource, MultipartOptions}, EmptySubscription, Schema, + http::{GraphiQLSource, MultipartOptions}, }; use async_graphql_actix_web::{GraphQLRequest, GraphQLResponse}; use files::{FilesSchema, MutationRoot, QueryRoot, Storage}; diff --git a/axum/starwars/src/main.rs b/axum/starwars/src/main.rs index 52c7a1a..cbb1720 100644 --- a/axum/starwars/src/main.rs +++ b/axum/starwars/src/main.rs @@ -1,9 +1,9 @@ -use async_graphql::{http::GraphiQLSource, EmptyMutation, EmptySubscription, Schema}; +use async_graphql::{EmptyMutation, EmptySubscription, Schema, http::GraphiQLSource}; use async_graphql_axum::GraphQL; use axum::{ + Router, response::{self, IntoResponse}, routing::get, - Router, }; use starwars::{QueryRoot, StarWars}; use tokio::net::TcpListener; diff --git a/axum/subscription/src/main.rs b/axum/subscription/src/main.rs index 348c61e..8675c97 100644 --- a/axum/subscription/src/main.rs +++ b/axum/subscription/src/main.rs @@ -1,9 +1,9 @@ -use async_graphql::{http::GraphiQLSource, Schema}; +use async_graphql::{Schema, http::GraphiQLSource}; use async_graphql_axum::{GraphQL, GraphQLSubscription}; use axum::{ + Router, response::{self, IntoResponse}, routing::get, - Router, }; use books::{MutationRoot, QueryRoot, Storage, SubscriptionRoot}; use tokio::net::TcpListener; diff --git a/axum/token-from-header/src/main.rs b/axum/token-from-header/src/main.rs index 8bd2c43..65d938c 100644 --- a/axum/token-from-header/src/main.rs +++ b/axum/token-from-header/src/main.rs @@ -1,16 +1,16 @@ use async_graphql::{ - http::{playground_source, GraphQLPlaygroundConfig, ALL_WEBSOCKET_PROTOCOLS}, EmptyMutation, Schema, + http::{ALL_WEBSOCKET_PROTOCOLS, GraphQLPlaygroundConfig, playground_source}, }; use async_graphql_axum::{GraphQLProtocol, GraphQLRequest, GraphQLResponse, GraphQLWebSocket}; use axum::{ - extract::{ws::WebSocketUpgrade, State}, + Router, + extract::{State, ws::WebSocketUpgrade}, http::header::HeaderMap, response::{Html, IntoResponse, Response}, routing::get, - Router, }; -use token::{on_connection_init, QueryRoot, SubscriptionRoot, Token, TokenSchema}; +use token::{QueryRoot, SubscriptionRoot, Token, TokenSchema, on_connection_init}; use tokio::net::TcpListener; async fn graphql_playground() -> impl IntoResponse { diff --git a/axum/upload/src/main.rs b/axum/upload/src/main.rs index f56b142..5b3de6e 100644 --- a/axum/upload/src/main.rs +++ b/axum/upload/src/main.rs @@ -1,10 +1,10 @@ -use async_graphql::{http::GraphiQLSource, EmptySubscription, Schema}; +use async_graphql::{EmptySubscription, Schema, http::GraphiQLSource}; use async_graphql_axum::GraphQL; use axum::{ + Router, http::Method, response::{Html, IntoResponse}, routing::get, - Router, }; use files::{MutationRoot, QueryRoot, Storage}; use tokio::net::TcpListener; diff --git a/federation/dynamic-schema/federation-accounts/src/main.rs b/federation/dynamic-schema/federation-accounts/src/main.rs index c16fbc5..cb81bc7 100644 --- a/federation/dynamic-schema/federation-accounts/src/main.rs +++ b/federation/dynamic-schema/federation-accounts/src/main.rs @@ -2,7 +2,7 @@ use async_graphql::dynamic::{ Field, FieldFuture, FieldValue, Object, Schema, SchemaError, TypeRef, }; use async_graphql_poem::GraphQL; -use poem::{listener::TcpListener, Route, Server}; +use poem::{Route, Server, listener::TcpListener}; struct Picture { url: String, diff --git a/federation/dynamic-schema/federation-products/src/main.rs b/federation/dynamic-schema/federation-products/src/main.rs index d200bd7..f3d5cf1 100644 --- a/federation/dynamic-schema/federation-products/src/main.rs +++ b/federation/dynamic-schema/federation-products/src/main.rs @@ -2,7 +2,7 @@ use async_graphql::dynamic::{ Field, FieldFuture, FieldValue, Object, Schema, SchemaError, TypeRef, }; use async_graphql_poem::GraphQL; -use poem::{listener::TcpListener, Route, Server}; +use poem::{Route, Server, listener::TcpListener}; struct Product { upc: String, diff --git a/federation/dynamic-schema/federation-reviews/src/main.rs b/federation/dynamic-schema/federation-reviews/src/main.rs index 405be08..a5b441e 100644 --- a/federation/dynamic-schema/federation-reviews/src/main.rs +++ b/federation/dynamic-schema/federation-reviews/src/main.rs @@ -2,7 +2,7 @@ use async_graphql::dynamic::{ Enum, Field, FieldFuture, FieldValue, Object, Schema, SchemaError, TypeRef, }; use async_graphql_poem::GraphQL; -use poem::{listener::TcpListener, Route, Server}; +use poem::{Route, Server, listener::TcpListener}; struct Picture { url: String, diff --git a/federation/static-schema/federation-accounts/src/main.rs b/federation/static-schema/federation-accounts/src/main.rs index d736ee6..2def417 100644 --- a/federation/static-schema/federation-accounts/src/main.rs +++ b/federation/static-schema/federation-accounts/src/main.rs @@ -1,6 +1,6 @@ -use async_graphql::{EmptyMutation, EmptySubscription, Object, Schema, SimpleObject, ID}; +use async_graphql::{EmptyMutation, EmptySubscription, ID, Object, Schema, SimpleObject}; use async_graphql_poem::GraphQL; -use poem::{listener::TcpListener, Route, Server}; +use poem::{Route, Server, listener::TcpListener}; #[derive(SimpleObject)] struct User { diff --git a/federation/static-schema/federation-products/src/main.rs b/federation/static-schema/federation-products/src/main.rs index b033c9d..8d192de 100644 --- a/federation/static-schema/federation-products/src/main.rs +++ b/federation/static-schema/federation-products/src/main.rs @@ -1,6 +1,6 @@ use async_graphql::{Context, EmptyMutation, EmptySubscription, Object, Schema, SimpleObject}; use async_graphql_poem::GraphQL; -use poem::{listener::TcpListener, Route, Server}; +use poem::{Route, Server, listener::TcpListener}; #[derive(SimpleObject)] struct Product { diff --git a/federation/static-schema/federation-reviews/src/main.rs b/federation/static-schema/federation-reviews/src/main.rs index bb2a84b..4f566c3 100644 --- a/federation/static-schema/federation-reviews/src/main.rs +++ b/federation/static-schema/federation-reviews/src/main.rs @@ -1,9 +1,9 @@ use async_graphql::{ - ComplexObject, Context, EmptyMutation, EmptySubscription, Enum, Object, Schema, SimpleObject, - ID, + ComplexObject, Context, EmptyMutation, EmptySubscription, Enum, ID, Object, Schema, + SimpleObject, }; use async_graphql_poem::GraphQL; -use poem::{listener::TcpListener, Route, Server}; +use poem::{Route, Server, listener::TcpListener}; #[derive(SimpleObject)] #[graphql(complex)] diff --git a/models/books/src/lib.rs b/models/books/src/lib.rs index c364597..31ae117 100644 --- a/models/books/src/lib.rs +++ b/models/books/src/lib.rs @@ -2,8 +2,8 @@ mod simple_broker; use std::{sync::Arc, time::Duration}; -use async_graphql::{Context, Enum, Object, Result, Schema, Subscription, ID}; -use futures_util::{lock::Mutex, Stream, StreamExt}; +use async_graphql::{Context, Enum, ID, Object, Result, Schema, Subscription}; +use futures_util::{Stream, StreamExt, lock::Mutex}; use simple_broker::SimpleBroker; use slab::Slab; diff --git a/models/dynamic-books/src/model.rs b/models/dynamic-books/src/model.rs index ba466e0..41ecc97 100644 --- a/models/dynamic-books/src/model.rs +++ b/models/dynamic-books/src/model.rs @@ -1,7 +1,7 @@ -use async_graphql::{dynamic::*, Value, ID}; +use async_graphql::{ID, Value, dynamic::*}; use futures_util::StreamExt; -use crate::{simple_broker::SimpleBroker, Book, BookChanged, MutationType, Storage}; +use crate::{Book, BookChanged, MutationType, Storage, simple_broker::SimpleBroker}; impl<'a> From for FieldValue<'a> { fn from(value: MutationType) -> Self { diff --git a/models/dynamic-files/src/lib.rs b/models/dynamic-files/src/lib.rs index b9f398d..6f1bd0d 100644 --- a/models/dynamic-files/src/lib.rs +++ b/models/dynamic-files/src/lib.rs @@ -1,6 +1,6 @@ use async_graphql::{ - dynamic::{Field, FieldFuture, FieldValue, InputValue, Object, Schema, SchemaError, TypeRef}, Value, + dynamic::{Field, FieldFuture, FieldValue, InputValue, Object, Schema, SchemaError, TypeRef}, }; use futures::lock::Mutex; use slab::Slab; diff --git a/models/dynamic-starwars/src/model.rs b/models/dynamic-starwars/src/model.rs index a307afb..86508d8 100644 --- a/models/dynamic-starwars/src/model.rs +++ b/models/dynamic-starwars/src/model.rs @@ -1,4 +1,4 @@ -use async_graphql::{dynamic::*, Value}; +use async_graphql::{Value, dynamic::*}; use crate::{Episode, StarWars, StarWarsChar}; diff --git a/models/files/src/lib.rs b/models/files/src/lib.rs index 0e9b310..5f19a21 100644 --- a/models/files/src/lib.rs +++ b/models/files/src/lib.rs @@ -1,4 +1,4 @@ -use async_graphql::{Context, EmptySubscription, Object, Schema, SimpleObject, Upload, ID}; +use async_graphql::{Context, EmptySubscription, ID, Object, Schema, SimpleObject, Upload}; use futures::lock::Mutex; use slab::Slab; diff --git a/models/starwars/src/model.rs b/models/starwars/src/model.rs index d62b847..2f569c9 100644 --- a/models/starwars/src/model.rs +++ b/models/starwars/src/model.rs @@ -1,8 +1,8 @@ #![allow(clippy::needless_lifetimes)] use async_graphql::{ - connection::{query, Connection, Edge}, Context, Enum, Error, Interface, Object, OutputType, Result, + connection::{Connection, Edge, query}, }; use super::StarWars; diff --git a/poem/dynamic-books/src/main.rs b/poem/dynamic-books/src/main.rs index de2040d..c16c538 100644 --- a/poem/dynamic-books/src/main.rs +++ b/poem/dynamic-books/src/main.rs @@ -1,6 +1,6 @@ use async_graphql::http::GraphiQLSource; use async_graphql_poem::{GraphQL, GraphQLSubscription}; -use poem::{get, handler, listener::TcpListener, web::Html, IntoResponse, Route, Server}; +use poem::{IntoResponse, Route, Server, get, handler, listener::TcpListener, web::Html}; #[handler] async fn graphiql() -> impl IntoResponse { diff --git a/poem/dynamic-schema/src/main.rs b/poem/dynamic-schema/src/main.rs index 3c8298a..8403a98 100644 --- a/poem/dynamic-schema/src/main.rs +++ b/poem/dynamic-schema/src/main.rs @@ -1,12 +1,12 @@ use std::error::Error; use async_graphql::{ - dynamic::*, - http::{playground_source, GraphQLPlaygroundConfig}, Value, + dynamic::*, + http::{GraphQLPlaygroundConfig, playground_source}, }; use async_graphql_poem::GraphQL; -use poem::{get, handler, listener::TcpListener, web::Html, IntoResponse, Route, Server}; +use poem::{IntoResponse, Route, Server, get, handler, listener::TcpListener, web::Html}; #[handler] async fn graphql_playground() -> impl IntoResponse { diff --git a/poem/dynamic-starwars/src/main.rs b/poem/dynamic-starwars/src/main.rs index 7781822..11b2063 100644 --- a/poem/dynamic-starwars/src/main.rs +++ b/poem/dynamic-starwars/src/main.rs @@ -1,6 +1,6 @@ use async_graphql::http::GraphiQLSource; use async_graphql_poem::GraphQL; -use poem::{get, handler, listener::TcpListener, web::Html, IntoResponse, Route, Server}; +use poem::{IntoResponse, Route, Server, get, handler, listener::TcpListener, web::Html}; #[handler] async fn graphiql() -> impl IntoResponse { diff --git a/poem/dynamic-upload/src/main.rs b/poem/dynamic-upload/src/main.rs index 1d357dc..81a583c 100644 --- a/poem/dynamic-upload/src/main.rs +++ b/poem/dynamic-upload/src/main.rs @@ -1,6 +1,6 @@ use async_graphql::http::GraphiQLSource; use async_graphql_poem::GraphQL; -use poem::{get, handler, listener::TcpListener, web::Html, IntoResponse, Route, Server}; +use poem::{IntoResponse, Route, Server, get, handler, listener::TcpListener, web::Html}; #[handler] async fn graphiql() -> impl IntoResponse { diff --git a/poem/opentelemetry-basic/src/main.rs b/poem/opentelemetry-basic/src/main.rs index 897f316..e689ca8 100644 --- a/poem/opentelemetry-basic/src/main.rs +++ b/poem/opentelemetry-basic/src/main.rs @@ -1,10 +1,10 @@ use async_graphql::{ - extensions::OpenTelemetry, EmptyMutation, EmptySubscription, Object, Result, Schema, + EmptyMutation, EmptySubscription, Object, Result, Schema, extensions::OpenTelemetry, }; use async_graphql_poem::GraphQL; use opentelemetry::trace::TracerProvider as _; use opentelemetry_sdk::trace::TracerProvider; -use poem::{listener::TcpListener, post, EndpointExt, Route, Server}; +use poem::{EndpointExt, Route, Server, listener::TcpListener, post}; struct QueryRoot; @@ -37,7 +37,9 @@ async fn main() { -H 'content-type: application/json' \ --data '{ \"query\": \"{ hello }\" }'"; - println!("Run this curl command from another terminal window to see opentelemetry output in this terminal.\n\n{example_curl}\n\n"); + println!( + "Run this curl command from another terminal window to see opentelemetry output in this terminal.\n\n{example_curl}\n\n" + ); Server::new(TcpListener::bind("127.0.0.1:8000")) .run(app) diff --git a/poem/starwars/src/main.rs b/poem/starwars/src/main.rs index 619ce9a..45f6aad 100644 --- a/poem/starwars/src/main.rs +++ b/poem/starwars/src/main.rs @@ -1,6 +1,6 @@ -use async_graphql::{http::GraphiQLSource, EmptyMutation, EmptySubscription, Schema}; +use async_graphql::{EmptyMutation, EmptySubscription, Schema, http::GraphiQLSource}; use async_graphql_poem::GraphQL; -use poem::{get, handler, listener::TcpListener, web::Html, IntoResponse, Route, Server}; +use poem::{IntoResponse, Route, Server, get, handler, listener::TcpListener, web::Html}; use starwars::{QueryRoot, StarWars}; #[handler] diff --git a/poem/subscription-redis/src/main.rs b/poem/subscription-redis/src/main.rs index 611b682..3a4c335 100644 --- a/poem/subscription-redis/src/main.rs +++ b/poem/subscription-redis/src/main.rs @@ -1,7 +1,7 @@ -use async_graphql::{http::GraphiQLSource, Context, Object, Result, Schema, Subscription}; +use async_graphql::{Context, Object, Result, Schema, Subscription, http::GraphiQLSource}; use async_graphql_poem::{GraphQL, GraphQLSubscription}; use futures_util::{Stream, StreamExt}; -use poem::{get, handler, listener::TcpListener, web::Html, IntoResponse, Route, Server}; +use poem::{IntoResponse, Route, Server, get, handler, listener::TcpListener, web::Html}; use redis::{AsyncCommands, Client}; struct QueryRoot; diff --git a/poem/subscription/src/main.rs b/poem/subscription/src/main.rs index 5082d51..23ff2aa 100644 --- a/poem/subscription/src/main.rs +++ b/poem/subscription/src/main.rs @@ -1,7 +1,7 @@ -use async_graphql::{http::GraphiQLSource, Schema}; +use async_graphql::{Schema, http::GraphiQLSource}; use async_graphql_poem::{GraphQL, GraphQLSubscription}; use books::{MutationRoot, QueryRoot, Storage, SubscriptionRoot}; -use poem::{get, handler, listener::TcpListener, web::Html, IntoResponse, Route, Server}; +use poem::{IntoResponse, Route, Server, get, handler, listener::TcpListener, web::Html}; #[handler] async fn graphiql() -> impl IntoResponse { diff --git a/poem/token-from-header/src/main.rs b/poem/token-from-header/src/main.rs index c731aa3..7290b85 100644 --- a/poem/token-from-header/src/main.rs +++ b/poem/token-from-header/src/main.rs @@ -1,16 +1,15 @@ use async_graphql::{ - http::{GraphiQLSource, ALL_WEBSOCKET_PROTOCOLS}, EmptyMutation, Schema, + http::{ALL_WEBSOCKET_PROTOCOLS, GraphiQLSource}, }; use async_graphql_poem::{GraphQLProtocol, GraphQLRequest, GraphQLResponse, GraphQLWebSocket}; use poem::{ - get, handler, + EndpointExt, IntoResponse, Route, Server, get, handler, http::HeaderMap, listener::TcpListener, - web::{websocket::WebSocket, Data, Html}, - EndpointExt, IntoResponse, Route, Server, + web::{Data, Html, websocket::WebSocket}, }; -use token::{on_connection_init, QueryRoot, SubscriptionRoot, Token, TokenSchema}; +use token::{QueryRoot, SubscriptionRoot, Token, TokenSchema, on_connection_init}; fn get_token_from_headers(headers: &HeaderMap) -> Option { headers diff --git a/poem/upload/src/main.rs b/poem/upload/src/main.rs index f8353b7..807b082 100644 --- a/poem/upload/src/main.rs +++ b/poem/upload/src/main.rs @@ -1,12 +1,11 @@ -use async_graphql::{http::GraphiQLSource, EmptySubscription, Schema}; +use async_graphql::{EmptySubscription, Schema, http::GraphiQLSource}; use async_graphql_poem::{GraphQLRequest, GraphQLResponse}; use files::{FilesSchema, MutationRoot, QueryRoot, Storage}; use poem::{ - get, handler, + EndpointExt, IntoResponse, Route, Server, get, handler, listener::TcpListener, middleware::Cors, web::{Data, Html}, - EndpointExt, IntoResponse, Route, Server, }; #[handler] diff --git a/rocket/starwars/src/main.rs b/rocket/starwars/src/main.rs index 07fed6b..4949619 100644 --- a/rocket/starwars/src/main.rs +++ b/rocket/starwars/src/main.rs @@ -1,6 +1,6 @@ -use async_graphql::{http::GraphiQLSource, EmptyMutation, EmptySubscription, Schema}; +use async_graphql::{EmptyMutation, EmptySubscription, Schema, http::GraphiQLSource}; use async_graphql_rocket::{GraphQLQuery, GraphQLRequest, GraphQLResponse}; -use rocket::{response::content, routes, State}; +use rocket::{State, response::content, routes}; use starwars::{QueryRoot, StarWars}; pub type StarWarsSchema = Schema; diff --git a/rocket/upload/src/main.rs b/rocket/upload/src/main.rs index 501cca5..029959b 100644 --- a/rocket/upload/src/main.rs +++ b/rocket/upload/src/main.rs @@ -1,7 +1,7 @@ -use async_graphql::{http::GraphiQLSource, EmptyMutation, EmptySubscription, Schema}; +use async_graphql::{EmptyMutation, EmptySubscription, Schema, http::GraphiQLSource}; use async_graphql_rocket::{GraphQLQuery, GraphQLRequest, GraphQLResponse}; use files::{FilesSchema, MutationRoot, QueryRoot, Storage}; -use rocket::{response::content, routes, State}; +use rocket::{State, response::content, routes}; pub type StarWarsSchema = Schema; diff --git a/warp/starwars/src/main.rs b/warp/starwars/src/main.rs index 745773f..3b5023e 100644 --- a/warp/starwars/src/main.rs +++ b/warp/starwars/src/main.rs @@ -1,10 +1,10 @@ use std::convert::Infallible; -use async_graphql::{http::GraphiQLSource, EmptyMutation, EmptySubscription, Schema}; +use async_graphql::{EmptyMutation, EmptySubscription, Schema, http::GraphiQLSource}; use async_graphql_warp::{GraphQLBadRequest, GraphQLResponse}; use http::StatusCode; use starwars::{QueryRoot, StarWars}; -use warp::{http::Response as HttpResponse, Filter, Rejection}; +use warp::{Filter, Rejection, http::Response as HttpResponse}; #[tokio::main] async fn main() { diff --git a/warp/subscription/src/main.rs b/warp/subscription/src/main.rs index 559e4b3..9c9c563 100644 --- a/warp/subscription/src/main.rs +++ b/warp/subscription/src/main.rs @@ -1,9 +1,9 @@ use std::convert::Infallible; -use async_graphql::{http::GraphiQLSource, Schema}; -use async_graphql_warp::{graphql_subscription, GraphQLResponse}; +use async_graphql::{Schema, http::GraphiQLSource}; +use async_graphql_warp::{GraphQLResponse, graphql_subscription}; use books::{MutationRoot, QueryRoot, Storage, SubscriptionRoot}; -use warp::{http::Response as HttpResponse, Filter}; +use warp::{Filter, http::Response as HttpResponse}; #[tokio::main] async fn main() { diff --git a/warp/token-from-header/src/main.rs b/warp/token-from-header/src/main.rs index f14cc71..dbfd422 100644 --- a/warp/token-from-header/src/main.rs +++ b/warp/token-from-header/src/main.rs @@ -1,9 +1,9 @@ use std::convert::Infallible; -use async_graphql::{http::GraphiQLSource, Data, EmptyMutation, Schema}; -use async_graphql_warp::{graphql_protocol, GraphQLResponse, GraphQLWebSocket}; -use token::{on_connection_init, QueryRoot, SubscriptionRoot, Token}; -use warp::{http::Response as HttpResponse, ws::Ws, Filter}; +use async_graphql::{Data, EmptyMutation, Schema, http::GraphiQLSource}; +use async_graphql_warp::{GraphQLResponse, GraphQLWebSocket, graphql_protocol}; +use token::{QueryRoot, SubscriptionRoot, Token, on_connection_init}; +use warp::{Filter, http::Response as HttpResponse, ws::Ws}; #[tokio::main] async fn main() { From 0d7c54aaa8ee9a9f35251d3e6c3be308bb89813b Mon Sep 17 00:00:00 2001 From: Sunli Date: Sat, 24 May 2025 09:49:34 +0800 Subject: [PATCH 102/102] fix typo --- models/dynamic-starwars/src/model.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/dynamic-starwars/src/model.rs b/models/dynamic-starwars/src/model.rs index a34e309..b69706b 100644 --- a/models/dynamic-starwars/src/model.rs +++ b/models/dynamic-starwars/src/model.rs @@ -170,7 +170,7 @@ pub fn schema() -> Result { .description("The primary function of the droid."), ); - let query = Object::new("Qurey") + let query = Object::new("Query") .field( Field::new("hero", TypeRef::named_nn(character.type_name()), |ctx| { FieldFuture::new(async move {