Rename to Squadron

This commit is contained in:
eraden 2024-02-10 15:12:53 +01:00
parent f3df409904
commit c406b5af6f
57 changed files with 173 additions and 173 deletions

220
Cargo.lock generated
View File

@ -1895,116 +1895,6 @@ version = "1.0.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c"
[[package]]
name = "jet-api"
version = "0.1.0"
dependencies = [
"actix",
"actix-jwt-session",
"actix-web",
"async-trait",
"base64 0.21.7",
"basen",
"bincode",
"chrono",
"derive_more",
"dotenv",
"entities",
"figment",
"futures",
"futures-util",
"hmac",
"http-api-isahc-client",
"humantime",
"jet-contract",
"oauth2",
"oauth2-amazon",
"oauth2-client",
"oauth2-core",
"oauth2-github",
"oauth2-gitlab",
"oauth2-google",
"oauth2-signin",
"password-hash",
"rand",
"reqwest",
"rumqttc",
"rust-s3",
"sea-orm",
"sentry",
"serde",
"serde-aux",
"serde-email",
"serde_json",
"sha2",
"sqlx",
"thiserror",
"tokio",
"tracing",
"tracing-subscriber",
"tracing-test",
"uuid",
"validators",
]
[[package]]
name = "jet-beat"
version = "0.1.0"
[[package]]
name = "jet-bg"
version = "0.1.0"
dependencies = [
"bincode",
"futures",
"futures-util",
"redis-async",
"rumqttc",
"rust-s3",
"serde",
"serde_json",
"tokio",
]
[[package]]
name = "jet-contract"
version = "0.1.0"
dependencies = [
"bincode",
"chrono",
"deadpool-redis",
"derive_more",
"redis",
"rumqttc",
"serde",
"serde_json",
"thiserror",
"uuid",
]
[[package]]
name = "jet-plug"
version = "0.1.0"
dependencies = [
"actix",
"actix-web",
"async-trait",
"bincode",
"futures",
"futures-util",
"jet-contract",
"redis-async",
"rumqttc",
"rust-s3",
"serde",
"serde_json",
"tokio",
]
[[package]]
name = "jet-space"
version = "0.1.0"
[[package]]
name = "jobserver"
version = "0.1.27"
@ -4221,6 +4111,116 @@ dependencies = [
"uuid",
]
[[package]]
name = "squadron-api"
version = "0.1.0"
dependencies = [
"actix",
"actix-jwt-session",
"actix-web",
"async-trait",
"base64 0.21.7",
"basen",
"bincode",
"chrono",
"derive_more",
"dotenv",
"entities",
"figment",
"futures",
"futures-util",
"hmac",
"http-api-isahc-client",
"humantime",
"oauth2",
"oauth2-amazon",
"oauth2-client",
"oauth2-core",
"oauth2-github",
"oauth2-gitlab",
"oauth2-google",
"oauth2-signin",
"password-hash",
"rand",
"reqwest",
"rumqttc",
"rust-s3",
"sea-orm",
"sentry",
"serde",
"serde-aux",
"serde-email",
"serde_json",
"sha2",
"sqlx",
"squadron-contract",
"thiserror",
"tokio",
"tracing",
"tracing-subscriber",
"tracing-test",
"uuid",
"validators",
]
[[package]]
name = "squadron-beat"
version = "0.1.0"
[[package]]
name = "squadron-bg"
version = "0.1.0"
dependencies = [
"bincode",
"futures",
"futures-util",
"redis-async",
"rumqttc",
"rust-s3",
"serde",
"serde_json",
"tokio",
]
[[package]]
name = "squadron-contract"
version = "0.1.0"
dependencies = [
"bincode",
"chrono",
"deadpool-redis",
"derive_more",
"redis",
"rumqttc",
"serde",
"serde_json",
"thiserror",
"uuid",
]
[[package]]
name = "squadron-plug"
version = "0.1.0"
dependencies = [
"actix",
"actix-web",
"async-trait",
"bincode",
"futures",
"futures-util",
"redis-async",
"rumqttc",
"rust-s3",
"serde",
"serde_json",
"squadron-contract",
"tokio",
]
[[package]]
name = "squadron-space"
version = "0.1.0"
[[package]]
name = "static_assertions"
version = "1.1.0"

View File

@ -1,19 +1,19 @@
[workspace]
members = [
"crates/jet-space",
"crates/jet-api",
"crates/jet-bg",
"crates/jet-beat",
"crates/jet-contract",
"crates/jet-plug",
"crates/squadron-space",
"crates/squadron-api",
"crates/squadron-bg",
"crates/squadron-beat",
"crates/squadron-contract",
"crates/squadron-plug",
]
resolver = "2"
[workspace.dependencies]
jet-contract = { path = "./crates/jet-contract" }
jet-api = { path = "./crates/jet-api" }
jet-bg = { path = "./crates/jet-bg" }
jet-beat = { path = "./crates/jet-beat" }
jet-space = { path = "./crates/jet-space" }
jet-plug = { path = "./crates/jet-plug" }
squadron-contract = { path = "./crates/squadron-contract" }
squadron-api = { path = "./crates/squadron-api" }
squadron-bg = { path = "./crates/squadron-bg" }
squadron-beat = { path = "./crates/squadron-beat" }
squadron-space = { path = "./crates/squadron-space" }
squadron-plug = { path = "./crates/squadron-plug" }
entities = { path = "./crates/entities" }

View File

@ -1,5 +1,5 @@
[package]
name = "jet-api"
name = "squadron-api"
version = "0.1.0"
edition = "2021"
@ -16,7 +16,7 @@ sea-orm = { version = "0.12.11", features = ["postgres-array", "sqlx-all"] }
serde = "1.0.195"
serde_json = { version = "1.0.111", features = ["raw_value", "alloc"] }
tokio = { version = "1.35.1", features = ["full"] }
jet-contract = { workspace = true }
squadron-contract = { workspace = true }
uuid = { version = "1.7.0", features = ["v4", "serde"] }
entities = { workspace = true }
figment = { version = "0.10.14", features = ["env", "toml"] }

View File

@ -38,7 +38,7 @@ pub struct ApplicationConfig {
pub enable_magic_link_login: bool,
}
pub fn load(redis_client: jet_contract::redis::Client) -> ApplicationConfig {
pub fn load(redis_client: squadron_contract::redis::Client) -> ApplicationConfig {
let fields = serde_introspect::<ApplicationConfig>();
Figment::new()
.merge(Env::raw())
@ -49,13 +49,13 @@ pub fn load(redis_client: jet_contract::redis::Client) -> ApplicationConfig {
#[cfg(test)]
mod tests {
use jet_contract::redis::Commands;
use squadron_contract::redis::Commands;
use super::*;
#[test]
fn from_redis() {
let mut client = jet_contract::redis::Client::open("redis://0.0.0.0:6379")
let mut client = squadron_contract::redis::Client::open("redis://0.0.0.0:6379")
.expect("Can't connect to redis");
client
.mset::<_, _, ()>(&[

View File

@ -1,11 +1,11 @@
use figment::value::{Dict, Map};
use figment::{Error, Profile, Provider};
use jet_contract::redis;
use jet_contract::redis::Commands;
use squadron_contract::redis;
use squadron_contract::redis::Commands;
use tracing::debug;
pub struct Redis<'fields> {
conn: jet_contract::redis::Client,
conn: squadron_contract::redis::Client,
fields: &'fields [&'fields str],
}

View File

@ -438,7 +438,7 @@ pub mod password {
pub mod magic_link {
use actix_web::web::Data;
use jet_contract::*;
use squadron_contract::*;
use rand::prelude::*;
use redis::AsyncCommands;
@ -554,7 +554,7 @@ pub mod magic_link {
#[cfg(test)]
mod create_magic_link_tests {
use actix_web::web::Data;
use jet_contract::deadpool_redis;
use squadron_contract::deadpool_redis;
use super::*;

View File

@ -3,7 +3,7 @@ use actix_web::web::{Data, Path, ServiceConfig};
use actix_web::{get, HttpResponse};
use entities::api_tokens::*;
use entities::prelude::ApiTokens;
use jet_contract::{ApiTokenId, WorkspaceSlug};
use squadron_contract::{ApiTokenId, WorkspaceSlug};
use sea_orm::prelude::*;
use sea_orm::*;
use tracing::error;

View File

@ -103,7 +103,7 @@ mod tests {
use actix_web::http::header::ContentType;
use actix_web::web::Data;
use actix_web::{test, App};
use jet_contract::deadpool_redis;
use squadron_contract::deadpool_redis;
use reqwest::{Method, StatusCode};
use sea_orm::Database;
use tracing_test::traced_test;
@ -114,12 +114,12 @@ mod tests {
macro_rules! create_app {
($app: ident, $session_storage: ident, $db: ident) => {
std::env::set_var("DATABASE_URL", "postgres://postgres@0.0.0.0:5432/jet_test");
std::env::set_var("DATABASE_URL", "postgres://postgres@0.0.0.0:5432/squadron_test");
let redis = deadpool_redis::Config::from_url("redis://0.0.0.0:6379")
.create_pool(Some(deadpool_redis::Runtime::Tokio1))
.expect("Can't connect to redis");
let $db: sea_orm::prelude::DatabaseConnection =
Database::connect("postgres://postgres@0.0.0.0:5432/jet_test")
Database::connect("postgres://postgres@0.0.0.0:5432/squadron_test")
.await
.expect("Failed to connect to database");
let ($session_storage, factory) =

View File

@ -3,7 +3,7 @@ use actix_web::web::{Data, Json};
use actix_web::{post, HttpRequest, HttpResponse};
use entities::prelude::WorkspaceMemberInvites;
use entities::users::Model as User;
use jet_contract::event_bus::SignInMedium;
use squadron_contract::event_bus::SignInMedium;
use sea_orm::prelude::*;
use sea_orm::{DatabaseConnection, DatabaseTransaction, EntityTrait, QueryFilter};
use serde::{Deserialize, Serialize};
@ -70,7 +70,7 @@ async fn handle_existing_user(
event_bus: Data<EventBusClient>,
redis: Data<RedisClient>,
) -> Result<HttpResponse, Error> {
use jet_contract::event_bus::*;
use squadron_contract::event_bus::*;
let user_id = user.id;
let payload = payload.into_inner();
@ -190,7 +190,7 @@ async fn register(
.await
.map_err(|_| Error::DatabaseError)?;
{
use jet_contract::event_bus::*;
use squadron_contract::event_bus::*;
let user_id = user.id.clone().unwrap();
Msg::User(UserMsg::Created {
@ -224,7 +224,7 @@ async fn register(
return Err(AuthError::AttemptExhausted.into());
}
{
use jet_contract::event_bus::*;
use squadron_contract::event_bus::*;
Msg::Email(EmailMsg::MagicLink {
email,
key,

View File

@ -1,7 +1,7 @@
use actix_web::web::Json;
use actix_web::{post, HttpRequest, HttpResponse};
use entities::users::Column;
use jet_contract::event_bus::{EmailMsg, Topic};
use squadron_contract::event_bus::{EmailMsg, Topic};
use serde::{Deserialize, Serialize};
use serde_json::json;
use tracing::*;
@ -75,7 +75,7 @@ async fn try_forgot_password(
if let Err(e) = event_bus
.publish(
Topic::Email,
jet_contract::event_bus::Msg::Email(EmailMsg::ForgotPassword {
squadron_contract::event_bus::Msg::Email(EmailMsg::ForgotPassword {
current_site,
token,
uidb,
@ -108,7 +108,7 @@ mod tests {
use actix_web::body::to_bytes;
use actix_web::web::Data;
use actix_web::{test, App};
use jet_contract::deadpool_redis;
use squadron_contract::deadpool_redis;
use reqwest::{Method, StatusCode};
use sea_orm::Database;
use serde_json::json;
@ -122,12 +122,12 @@ mod tests {
macro_rules! create_app {
($app: ident, $session_storage: ident, $db: ident) => {
std::env::set_var("DATABASE_URL", "postgres://postgres@0.0.0.0:5432/jet_test");
std::env::set_var("DATABASE_URL", "postgres://postgres@0.0.0.0:5432/squadron_test");
let redis = deadpool_redis::Config::from_url("redis://0.0.0.0:6379")
.create_pool(Some(deadpool_redis::Runtime::Tokio1))
.expect("Can't connect to redis");
let $db: sea_orm::prelude::DatabaseConnection =
Database::connect("postgres://postgres@0.0.0.0:5432/jet_test")
Database::connect("postgres://postgres@0.0.0.0:5432/squadron_test")
.await
.expect("Failed to connect to database");
let ($session_storage, factory) =

View File

@ -1,6 +1,6 @@
use actix_web::web::{Data, Json};
use actix_web::{post, HttpRequest, HttpResponse};
use jet_contract::event_bus::{EmailMsg, Topic};
use squadron_contract::event_bus::{EmailMsg, Topic};
use sea_orm::prelude::*;
use sea_orm::{DatabaseConnection, DatabaseTransaction};
use serde::Deserialize;
@ -68,9 +68,9 @@ async fn try_create_magic_link(
if let Err(e) = event_bus
.publish(
Topic::Email,
jet_contract::event_bus::Msg::Email(EmailMsg::MagicLink {
squadron_contract::event_bus::Msg::Email(EmailMsg::MagicLink {
email,
key: jet_contract::MagicLinkKey::new(key.clone()),
key: squadron_contract::MagicLinkKey::new(key.clone()),
token,
current_site,
}),

View File

@ -1,8 +1,8 @@
use actix_jwt_session::SessionStorage;
use actix_web::web::{Data, Json};
use actix_web::{post, HttpRequest, HttpResponse};
use jet_contract::event_bus::{Msg, SignInMedium, Topic, UserMsg};
use jet_contract::redis::AsyncCommands;
use squadron_contract::event_bus::{Msg, SignInMedium, Topic, UserMsg};
use squadron_contract::redis::AsyncCommands;
use reqwest::StatusCode;
use rumqttc::QoS;
use sea_orm::prelude::*;
@ -76,7 +76,7 @@ async fn try_magic_sign_in(
.publish(
Topic::User,
Msg::User(UserMsg::SignIn {
user_id: jet_contract::UserId::new(user.id),
user_id: squadron_contract::UserId::new(user.id),
email,
user_agent,
ip,

View File

@ -121,7 +121,7 @@ mod tests {
use actix_web::http::header::ContentType;
use actix_web::web::Data;
use actix_web::{test, App};
use jet_contract::deadpool_redis;
use squadron_contract::deadpool_redis;
use reqwest::{Method, StatusCode};
use sea_orm::Database;
use tracing_test::traced_test;
@ -135,12 +135,12 @@ mod tests {
macro_rules! create_app {
($app: ident, $session_storage: ident, $db: ident) => {
std::env::set_var("DATABASE_URL", "postgres://postgres@0.0.0.0:5432/jet_test");
std::env::set_var("DATABASE_URL", "postgres://postgres@0.0.0.0:5432/squadron_test");
let redis = deadpool_redis::Config::from_url("redis://0.0.0.0:6379")
.create_pool(Some(deadpool_redis::Runtime::Tokio1))
.expect("Can't connect to redis");
let $db: sea_orm::prelude::DatabaseConnection =
Database::connect("postgres://postgres@0.0.0.0:5432/jet_test")
Database::connect("postgres://postgres@0.0.0.0:5432/squadron_test")
.await
.expect("Failed to connect to database");
let ($session_storage, factory) =

View File

@ -3,8 +3,8 @@ use actix_web::web::{Data, Json};
use actix_web::{post, HttpRequest, HttpResponse};
use entities::prelude::Users;
use entities::users::ActiveModel as UserModel;
use jet_contract::event_bus::{Msg, SignInMedium, Topic, UserMsg};
use jet_contract::UserId;
use squadron_contract::event_bus::{Msg, SignInMedium, Topic, UserMsg};
use squadron_contract::UserId;
use reqwest::StatusCode;
use rumqttc::QoS;
use sea_orm::*;

View File

@ -3,8 +3,8 @@ use actix_web::web::{Data, Json};
use actix_web::{post, HttpRequest, HttpResponse, ResponseError};
use entities::prelude::Users;
use entities::users::ActiveModel as UserModel;
use jet_contract::event_bus::{Msg, SignInMedium, Topic, UserMsg};
use jet_contract::UserId;
use squadron_contract::event_bus::{Msg, SignInMedium, Topic, UserMsg};
use squadron_contract::UserId;
use reqwest::StatusCode;
use rumqttc::QoS;
use sea_orm::{DatabaseConnection, *};

View File

@ -4,8 +4,8 @@ use actix_web::web::{self, Data, ServiceConfig};
use actix_web::{get, HttpRequest, HttpResponse};
use entities::users::ActiveModel as UserModel;
use http_api_isahc_client::IsahcClient;
use jet_contract::event_bus::{Msg, SignInMedium, Topic, UserMsg};
use jet_contract::UserId;
use squadron_contract::event_bus::{Msg, SignInMedium, Topic, UserMsg};
use squadron_contract::UserId;
use oauth2_amazon::{
AmazonExtensionsBuilder, AmazonProviderWithWebServices, AmazonScope, AmazonTokenUrlRegion,
};

View File

@ -3,8 +3,8 @@ use std::env;
use actix_jwt_session::*;
use actix_web::web::Data;
use actix_web::{App, HttpServer};
pub use jet_contract::event_bus::Client as EventBusClient;
pub use jet_contract::{deadpool_redis, redis, RedisClient};
pub use squadron_contract::event_bus::Client as EventBusClient;
pub use squadron_contract::{deadpool_redis, redis, RedisClient};
use models::PasswordResetSecret;
pub use sea_orm::{Database, DatabaseConnection};
@ -16,7 +16,7 @@ pub mod models;
pub mod session;
pub mod utils;
pub const APPLICATION_NAME: &str = "jet-api";
pub const APPLICATION_NAME: &str = "squadron-api";
#[actix_web::main]
async fn main() {
@ -38,7 +38,7 @@ async fn main() {
.create_pool(Some(deadpool_redis::Runtime::Tokio1))
.expect("Can't connect to redis");
let application_config = config::load(
jet_contract::redis::Client::open(redis_addr).expect("Can't connect to redis"),
squadron_contract::redis::Client::open(redis_addr).expect("Can't connect to redis"),
);
let db: sea_orm::prelude::DatabaseConnection = Database::connect(
env::var("DATABASE_URL")
@ -81,7 +81,7 @@ async fn main() {
let http_client = reqwest::Client::new();
let application_config = Data::new(application_config);
let event_bus = Data::new(jet_contract::event_bus::Client::new(eb_client));
let event_bus = Data::new(squadron_contract::event_bus::Client::new(eb_client));
let pass_reset_secret = Data::new(PasswordResetSecret::new(
env::var("PASSWORD_RESET_SECRET").expect("PASSWORD_RESET_SECRET must be provided"),
));

View File

@ -1,5 +1,5 @@
[package]
name = "jet-space"
name = "squadron-beat"
version = "0.1.0"
edition = "2021"

View File

@ -1,5 +1,5 @@
[package]
name = "jet-bg"
name = "squadron-bg"
version = "0.1.0"
edition = "2021"

View File

@ -1,5 +1,5 @@
[package]
name = "jet-contract"
name = "squadron-contract"
version = "0.1.0"
edition = "2021"

View File

@ -1,5 +1,5 @@
[package]
name = "jet-plug"
name = "squadron-plug"
version = "0.1.0"
edition = "2021"
@ -16,4 +16,4 @@ rust-s3 = { version = "0.33.0", features = ["tokio-rustls-tls", "futures-util",
serde = "1.0.195"
serde_json = "1.0.111"
tokio = { version = "1.35.1", features = ["full"] }
jet-contract = { workspace = true }
squadron-contract = { workspace = true }

View File

@ -5,7 +5,7 @@
//!
//! ```no_run
//! // binary name = gh_issue_mirror
//! use jet_plug::*;
//! use squadron_plug::*;
//! use async_trait::async_trait;
//!
//! #[derive(Default, Clone)]
@ -47,7 +47,7 @@
use actix_web::web::{Data, Json};
use actix_web::{post, App, HttpResponse, HttpServer};
pub use jet_contract::plugin::*;
pub use squadron_contract::plugin::*;
#[async_trait::async_trait]
pub trait Plugin {

View File

@ -1,5 +1,5 @@
[package]
name = "jet-beat"
name = "squadron-space"
version = "0.1.0"
edition = "2021"