Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: break up the common crate into smaller ones #977

Merged
merged 8 commits into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 60 additions & 28 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 9 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
[workspace]
resolver = "2"
members = [
"src/common",
"src/meta-cli",
"src/metagen",
"src/metagen/src/fdk_rs/static",
"src/mt_deno",
"src/typegate/engine",
"src/typegate/standalone",
"src/typegate_api",
"src/typegraph/core",
"src/typegraph/schema",
"src/xtask",
"src/utils/grpc",
"src/utils/archive",
"src/substantial",
"src/metagen-client-rs",
"tests/metagen/typegraphs/sample/rs",
Expand All @@ -31,12 +34,15 @@ edition = "2021"

# internal crates
mt_deno = { path = "src/mt_deno/" }
common = { path = "src/common/" }
tg_schema = { path = "src/typegraph/schema" }
typegraph_core = { path = "src/typegraph/core" }
substantial = { path = "src/substantial/" }
metagen = { path = "src/metagen/" }
metagen-client = { path = "src/metagen-client-rs" }
typegate_engine = { path = "src/typegate/engine" }
typegraph_core = { path = "src/typegraph/core" }
typegate_api = { path = "src/typegate_api" }
grpc_utils = { path = "src/utils/grpc" }
archive_utils = { path = "src/utils/archive" }

# cli
clap = "=4.5.13"
Expand Down
14 changes: 0 additions & 14 deletions src/common/src/lib.rs

This file was deleted.

4 changes: 3 additions & 1 deletion src/meta-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ typegate = ["dep:typegate_engine"]

# internal
typegraph_core.workspace = true
tg_schema.workspace = true
typegate_engine = { workspace = true, optional = true }
common.workspace = true
typegate_api.workspace = true
metagen.workspace = true
archive_utils.workspace = true

# data structures
chrono = { workspace = true, features = ["serde"] }
Expand Down
2 changes: 1 addition & 1 deletion src/meta-cli/src/cli/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::deploy::actors::console::ConsoleActor;
use crate::interlude::*;
use crate::secrets::{RawSecrets, Secrets};
use clap::Parser;
use common::node::Node;
use typegate_api::Node;

#[derive(Parser, Debug)]
pub struct DeploySubcommand {
Expand Down
4 changes: 2 additions & 2 deletions src/meta-cli/src/cli/gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ use crate::interlude::*;
use crate::{config::Config, deploy::actors::console::ConsoleActor};
use actix::Actor;
use clap::Parser;
use common::typegraph::Typegraph;
use dashmap::DashMap;
use futures_concurrency::future::FutureGroup;
use metagen::*;
use tg_schema::Typegraph;

#[derive(Parser, Debug, Clone)]
pub struct Gen {
Expand Down Expand Up @@ -105,7 +105,7 @@ impl Action for Gen {
#[derive(Debug)]
struct MetagenCtx {
config: Arc<Config>,
typegate: Arc<common::node::Node>,
typegate: Arc<typegate_api::Node>,
dir: PathBuf,
typegraph_cache: DashMap<String, Arc<Typegraph>>,
}
Expand Down
3 changes: 1 addition & 2 deletions src/meta-cli/src/cli/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ use crate::interlude::*;
use anyhow::Result;
use async_trait::async_trait;
use clap::Parser;
use common::graphql::Query;
use common::node::Node;
use serde::Deserialize;
use tabled::{settings::Style, Table, Tabled};
use typegate_api::{graphql::Query, Node};

#[derive(Parser, Debug)]
pub struct List {
Expand Down
2 changes: 1 addition & 1 deletion src/meta-cli/src/cli/serialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ use crate::deploy::actors::task::TaskFinishStatus;
use crate::deploy::actors::task_manager::{Report, StopReason, TaskManagerInit, TaskSource};
use crate::interlude::*;
use clap::Parser;
use common::typegraph::Typegraph;
use core::fmt::Debug;
use std::io::{self, Write};
use tg_schema::Typegraph;
use tokio::io::AsyncWriteExt;

#[derive(Parser, Debug)]
Expand Down
2 changes: 1 addition & 1 deletion src/meta-cli/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ use crate::interlude::*;
use crate::cli::NodeArgs;
use crate::fs::find_in_parents;
use crate::utils::BasicAuth;
use common::node::Node;
use globset::{Glob, GlobSet, GlobSetBuilder};
use reqwest::Url;
use std::fs::{self, File};
use std::io;
use std::slice;
use std::str::FromStr;
use typegate_api::Node;

pub const METATYPE_FILES: &[&str] = &["metatype.yml", "metatype.yaml"];
pub const VENV_FOLDERS: &[&str] = &[".venv"];
Expand Down
2 changes: 1 addition & 1 deletion src/meta-cli/src/deploy/actors/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ use crate::deploy::actors::task_io::TaskIoActor;
use crate::interlude::*;
use action::{get_typegraph_name, TaskActionGenerator};
use colored::OwoColorize;
use common::typegraph::Typegraph;
use indexmap::IndexMap;
use process_wrap::tokio::TokioChildWrapper;
use serde::Deserialize;
use std::time::Duration;
use tg_schema::Typegraph;
use tokio::process::Command;

pub mod message {
Expand Down
2 changes: 1 addition & 1 deletion src/meta-cli/src/deploy/actors/task/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ use crate::typegraph::rpc::{RpcCall as TypegraphRpcCall, RpcDispatch};
use artifacts::ArtifactUploader;
use base64::prelude::*;
use color_eyre::owo_colors::OwoColorize;
use common::node::Node;
use reqwest::header::{self, HeaderMap, HeaderValue};
use reqwest::Client;
use serde::Deserialize;
use std::{path::Path, sync::Arc};
use tokio::process::Command;
use typegate_api::Node;
use typegraph_core::sdk::core::{Artifact, Handler as _, PrismaMigrationConfig, SerializeParams};
use typegraph_core::sdk::utils::{Handler as _, QueryDeployParams};
use typegraph_core::Lib;
Expand Down
2 changes: 1 addition & 1 deletion src/meta-cli/src/deploy/actors/task/deploy/migrations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ impl DeployActionInner {

for migration in migrations.iter() {
let dest = migdir.join(&migration.runtime);
if let Err(err) = common::archive::unpack(&dest, Some(&migration.archive)) {
if let Err(err) = archive_utils::unpack(&dest, Some(&migration.archive)) {
ctx.console.error(format!(
"{scope} error while unpacking migrations into {:?}",
migdir
Expand Down
2 changes: 1 addition & 1 deletion src/meta-cli/src/deploy/actors/task/serialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ use crate::deploy::actors::task_manager::TaskRef;
use crate::interlude::*;
use crate::typegraph::rpc::{RpcCall as TypegraphRpcCall, RpcDispatch};
use color_eyre::owo_colors::OwoColorize;
use common::typegraph::Typegraph;
use serde::Deserialize;
use std::sync::Arc;
use tg_schema::Typegraph;
use tokio::process::Command;
use typegraph_core::sdk::core::{Handler, SerializeParams};
use typegraph_core::Lib;
Expand Down
4 changes: 2 additions & 2 deletions src/meta-cli/src/typegraph/rpc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ pub trait RpcDispatch {
#[enum_dispatch(RpcDispatch)]
#[serde(untagged)]
pub enum RpcCall {
Aws(aws::RpcCall),
Utils(utils::RpcCall),
Core(core::RpcCall),
Aws(aws::RpcCall),
Runtimes(runtimes::RpcCall),
Utils(utils::RpcCall),
}
Loading
Loading