Skip to content

Commit

Permalink
cli
Browse files Browse the repository at this point in the history
  • Loading branch information
Natoandro committed Feb 6, 2025
1 parent ed71bef commit e141f9a
Show file tree
Hide file tree
Showing 18 changed files with 43 additions and 70 deletions.
46 changes: 20 additions & 26 deletions Cargo.lock

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

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[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",
Expand All @@ -16,7 +16,7 @@ members = [
"src/substantial",
"src/metagen-client-rs",
"tests/metagen/typegraphs/sample/rs",
"tests/metagen/typegraphs/sample/rs_upload",
"tests/metagen/typegraphs/sample/rs_upload", "src/typegate_api",
]

exclude = [
Expand All @@ -34,13 +34,13 @@ 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" }
typegate_api = { path = "src/typegate_api" }
grpc_utils = { path = "src/utils/grpc" }
archive_utils = { path = "src/utils/archive" }

Expand Down
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
2 changes: 1 addition & 1 deletion src/meta-cli/src/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use std::env::{set_var, var};

use crate::config::VENV_FOLDERS;
use crate::fs::find_in_parents;
use common::node::BasicAuth as BasicAuthCommon;
use typegate_api::BasicAuth as BasicAuthCommon;

pub fn ensure_venv<P: AsRef<Path>>(dir: P) -> Result<()> {
if let Ok(active_venv) = var("VIRTUAL_ENV") {
Expand Down
1 change: 0 additions & 1 deletion src/typegate/engine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ tempfile.workspace = true

# internal
mt_deno.workspace = true
common.workspace = true
substantial.workspace = true

# runtimes
Expand Down
25 changes: 2 additions & 23 deletions src/common/Cargo.toml → src/typegate_api/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,38 +1,17 @@
[package]
name = "common"
name = "typegate_api"
version.workspace = true
edition.workspace = true

[dependencies]
# patterns
tg_schema.workspace = true
anyhow.workspace = true
itertools.workspace = true
indoc.workspace = true
thiserror.workspace = true

# encoding
base64.workspace = true
flate2.workspace = true
tar.workspace = true

serde.workspace = true
serde_json = { workspace = true, features = ["preserve_order"] }
serde_with.workspace = true

# ds
indexmap.workspace = true

# fs
ignore.workspace = true

# http
reqwest = { workspace = true, features = ["json"] }
url = { workspace = true, features = ["serde"] }

# grpc
protobuf.workspace = true
proto-parser.workspace = true

# cli
colored.workspace = true
async-trait.workspace = true
File renamed without changes.
2 changes: 2 additions & 0 deletions src/common/src/lib.rs → src/typegate_api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@

pub mod graphql;
pub mod node;

pub use node::{BasicAuth, Node};
6 changes: 2 additions & 4 deletions src/common/src/node.rs → src/typegate_api/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@ use reqwest::{Client, IntoUrl, RequestBuilder, Url};
use serde::Serialize;
use std::{collections::HashMap, sync::Arc, time::Duration};

use crate::{
graphql::{self, Query},
typegraph::Typegraph,
};
use crate::graphql::{self, Query};
use tg_schema::Typegraph;

#[derive(Debug, Serialize, Clone)]
pub struct BasicAuth {
Expand Down

0 comments on commit e141f9a

Please sign in to comment.