Skip to content

Commit

Permalink
Migration to IOS v1.0.0 (#5)
Browse files Browse the repository at this point in the history
* Migration to IOS v1.0.0

* Removing failed imports on test
  • Loading branch information
sagojez authored Apr 12, 2024
1 parent 1aabece commit 9432b59
Show file tree
Hide file tree
Showing 46 changed files with 344 additions and 569 deletions.
35 changes: 8 additions & 27 deletions Cargo.lock

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

7 changes: 3 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ members = [
"api",
"event-core",
"gateway",
"google-token-fetcher",
"redis-retry",
"watchdog",
"watchdog"
]

[workspace.dependencies]
Expand Down Expand Up @@ -38,7 +36,7 @@ futures-util = "0.3.28"
handlebars = "4.4.0"
http = "0.2.9"
http-serde-ext = "0.1.8"
integrationos-domain = "0.1.5"
integrationos-domain = "1.0.0"
js-sandbox-ios = "0.1.0"
jsonpath_lib = "0.3.0"
jsonwebtoken = "8.3.0"
Expand All @@ -48,6 +46,7 @@ mongodb = "2.7.0"
once_cell = "1.18.0"
openapiv3 = { version = "2.0.0", features = ["skip_serializing_defaults"] }
rand = "0.8.5"
redis = { version = "0.23.3", features = ["connection-manager", "tokio-comp"] }
regex = "1.10.2"
reqwest = { version = "0.11.22", features = [
"json",
Expand Down
2 changes: 1 addition & 1 deletion api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ mongodb.workspace = true
num_cpus = "1"
openapiv3.workspace = true
rand.workspace = true
redis-retry = { path = "../redis-retry" }
redis.workspace = true
reqwest.workspace = true
segment = "0.2.3"
semver.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion api/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ use std::{
};

use envconfig::Envconfig;
use integrationos_domain::cache::CacheConfig as RedisConfig;
use integrationos_domain::common::{
claude::ClaudeConfig, database::DatabaseConfig, openai::OpenAiConfig, secrets::SecretsConfig,
};
use redis_retry::Config as RedisConfig;

#[derive(Envconfig, Clone)]
pub struct Config {
Expand Down
4 changes: 1 addition & 3 deletions api/src/endpoints/common_enum.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
use super::{ApiError, ReadResponse};
use crate::{internal_server_error, server::AppState, util::shape_mongo_filter};

use axum::{
extract::{Query, State},
Json,
};
use integrationos_domain::{algebra::adapter::StoreAdapter, common_model::CommonEnum};

use integrationos_domain::{algebra::StoreExt, common_model::CommonEnum};
use shape_mongo_filter::DELETED_STR;
use std::{collections::BTreeMap, sync::Arc};
use tokio::try_join;
Expand Down
7 changes: 3 additions & 4 deletions api/src/endpoints/common_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@ use axum::{
Router,
};
use integrationos_domain::{
algebra::adapter::StoreAdapter,
algebra::{MongoStore, StoreExt},
api_model_config::Lang,
common::{
common_model::{CommonModel, Field},
event_access::EventAccess,
json_schema::JsonSchema,
mongo::MongoDbStore,
},
id::{prefix::IdPrefix, Id},
IntegrationOSError,
Expand Down Expand Up @@ -113,7 +112,7 @@ impl CrudRequest for CreateRequest {
record.sample = self.sample;
}

fn get_store(stores: AppStores) -> MongoDbStore<Self::Output> {
fn get_store(stores: AppStores) -> MongoStore<Self::Output> {
stores.common_model.clone()
}
}
Expand Down Expand Up @@ -161,7 +160,7 @@ async fn as_json_schema(path: Path<Id>, state: State<Arc<AppState>>) -> ApiResul
async fn update_interface(
interface: HashMap<Lang, String>,
record: &CommonModel,
cm_store: &MongoDbStore<CommonModel>,
cm_store: &MongoStore<CommonModel>,
) -> Result<(), IntegrationOSError> {
match bson::to_bson(&interface) {
Ok(interface) => {
Expand Down
28 changes: 12 additions & 16 deletions api/src/endpoints/connection.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
use std::{collections::HashMap, sync::Arc};

use super::{delete, read, CrudRequest};
use crate::{
api_payloads::{DeleteResponse, ErrorResponse, UpdateResponse},
bad_request,
endpoints::event_access::{generate_event_access, CreateEventAccessPayloadWithOwnership},
internal_server_error, not_found,
server::{AppState, AppStores},
};
use anyhow::{bail, Result};
use axum::{
extract::{Path, State},
Expand All @@ -11,31 +17,21 @@ use chrono::Utc;
use convert_case::{Case, Casing};
use http::HeaderMap;
use integrationos_domain::{
algebra::adapter::StoreAdapter,
algebra::{MongoStore, StoreExt},
common::{
connection_definition::ConnectionDefinition, event_access::EventAccess,
mongo::MongoDbStore, record_metadata::RecordMetadata, settings::Settings, Connection,
Throughput,
record_metadata::RecordMetadata, settings::Settings, Connection, Throughput,
},
id::{prefix::IdPrefix, Id},
};
use mongodb::bson::doc;
use mongodb::bson::Regex;
use serde::{Deserialize, Serialize};
use serde_json::Value;
use std::{collections::HashMap, sync::Arc};
use tracing::error;
use validator::Validate;

use crate::{
api_payloads::{DeleteResponse, ErrorResponse, UpdateResponse},
bad_request,
endpoints::event_access::{generate_event_access, CreateEventAccessPayloadWithOwnership},
internal_server_error, not_found,
server::{AppState, AppStores},
};

use super::{delete, read, CrudRequest};

pub fn get_router() -> Router<Arc<AppState>> {
Router::new()
.route("/", post(create_connection))
Expand Down Expand Up @@ -107,7 +103,7 @@ impl CrudRequest for CreateConnectionPayload {
unimplemented!()
}

fn get_store(stores: AppStores) -> MongoDbStore<Self::Output> {
fn get_store(stores: AppStores) -> MongoStore<Self::Output> {
stores.connection
}

Expand Down
7 changes: 2 additions & 5 deletions api/src/endpoints/connection_definition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@ use axum::{
Json, Router,
};
use integrationos_domain::{
algebra::adapter::StoreAdapter,
algebra::{MongoStore, StoreExt},
common::{
api_model_config::AuthMethod,
connection_definition::{
AuthSecret, ConnectionDefinition, ConnectionDefinitionType, ConnectionForm,
FormDataItem, Frontend, Paths, Spec,
},
event_access::EventAccess,
mongo::MongoDbStore,
record_metadata::RecordMetadata,
settings::Settings,
},
Expand Down Expand Up @@ -333,14 +332,12 @@ impl CrudRequest for CreateRequest {
record.record_metadata.active = self.active;
}

fn get_store(stores: AppStores) -> MongoDbStore<Self::Output> {
fn get_store(stores: AppStores) -> MongoStore<Self::Output> {
stores.connection_config
}
}

impl CachedRequest for CreateRequest {
type Output = ConnectionDefinition;

fn get_cache(
state: Arc<AppState>,
) -> Arc<Cache<Option<BTreeMap<String, String>>, Arc<ReadResponse<Self::Output>>>> {
Expand Down
5 changes: 2 additions & 3 deletions api/src/endpoints/connection_model_definition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use bson::SerializerOptions;
use chrono::Utc;
use http::HeaderMap;
use integrationos_domain::{
algebra::adapter::StoreAdapter,
algebra::{MongoStore, StoreExt},
common::{
api_model_config::{
ApiModelConfig, AuthMethod, ModelPaths, ResponseBody, SamplesInput, SchemasInput,
Expand All @@ -25,7 +25,6 @@ use integrationos_domain::{
TestConnection, TestConnectionState,
},
event_access::EventAccess,
mongo::MongoDbStore,
},
get_secret_request::GetSecretRequest,
id::{prefix::IdPrefix, Id},
Expand Down Expand Up @@ -393,7 +392,7 @@ impl CrudRequest for CreateRequest {
record.record_metadata.version = self.version;
}

fn get_store(stores: AppStores) -> MongoDbStore<Self::Output> {
fn get_store(stores: AppStores) -> MongoStore<Self::Output> {
stores.model_config.clone()
}
}
7 changes: 3 additions & 4 deletions api/src/endpoints/connection_model_schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@ use axum::{
};
use http::StatusCode;
use integrationos_domain::{
algebra::adapter::StoreAdapter,
algebra::{MongoStore, StoreExt},
common::{
connection_model_schema::{
ConnectionModelSchema, Mappings, PublicConnectionModelSchema, SchemaPaths,
},
event_access::EventAccess,
json_schema::JsonSchema,
mongo::MongoDbStore,
},
id::{prefix::IdPrefix, Id},
};
Expand Down Expand Up @@ -161,7 +160,7 @@ impl CrudRequest for PublicGetConnectionModelSchema {
unimplemented!()
}

fn get_store(stores: AppStores) -> MongoDbStore<Self::Output> {
fn get_store(stores: AppStores) -> MongoStore<Self::Output> {
stores.public_model_schema.clone()
}
}
Expand Down Expand Up @@ -230,7 +229,7 @@ impl CrudRequest for CreateRequest {
record.mapping = self.mapping;
}

fn get_store(stores: AppStores) -> MongoDbStore<Self::Output> {
fn get_store(stores: AppStores) -> MongoStore<Self::Output> {
stores.model_schema.clone()
}
}
Loading

0 comments on commit 9432b59

Please sign in to comment.