Skip to content

Commit

Permalink
Fixing backward compatibility problems (#29)
Browse files Browse the repository at this point in the history
* Fixing backward compatibility problems

* FIxing tests

* Remove tracing error

---------

Co-authored-by: Paul Krishnamurthy <[email protected]>
  • Loading branch information
sagojez and paulkr authored May 16, 2024
1 parent d44fb5a commit b806a77
Show file tree
Hide file tree
Showing 22 changed files with 33 additions and 37 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ futures-util = "0.3.28"
handlebars = "4.4.0"
http = "1.1.0"
http-serde-ext = "1.0.2"
integrationos-domain = "4.0.0"
integrationos-domain = "4.1.1"
js-sandbox-ios = "0.1.0"
jsonpath_lib = "0.3.0"
jsonwebtoken = "8.3.0"
Expand Down
12 changes: 3 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,22 +148,16 @@ View the full guide [here](https://docs.integrationos.com/docs/quickstart).
```shell
docker-compose up -d
```

3. Load seed data

```shell
source .env
docker-compose exec mongo mongorestore --host localhost --nsFrom="seed_db.*" --nsTo="events-service.*" --authenticationDatabase admin -u integrationos -p $MONGO_PASSWORD /seed-data
```

4. Run migrations
3. Run migrations

```shell
source .env
docker-compose -f docker-compose.data.yml run --rm migrate-before
docker-compose -f docker-compose.data.yml run --rm migrate-after
```

**Note:** If you want to run the latest version of the docker image, you can use the latest git commit hash as the tag. For example, `integrationos/integrationos:<commit-hash>`.

## Other actions

Connecting to a MongoDB shell
Expand Down
5 changes: 1 addition & 4 deletions api/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::{
use envconfig::Envconfig;
use integrationos_domain::cache::CacheConfig as RedisConfig;
use integrationos_domain::{
claude::ClaudeConfig, database::DatabaseConfig, openai::OpenAiConfig, secrets::SecretsConfig,
database::DatabaseConfig, openai::OpenAiConfig, secrets::SecretsConfig,
};

#[derive(Envconfig, Clone)]
Expand Down Expand Up @@ -69,8 +69,6 @@ pub struct Config {
#[envconfig(nested = true)]
pub db_config: DatabaseConfig,
#[envconfig(nested = true)]
pub claude_config: ClaudeConfig,
#[envconfig(nested = true)]
pub openai_config: OpenAiConfig,
#[envconfig(nested = true)]
pub redis_config: RedisConfig,
Expand Down Expand Up @@ -118,7 +116,6 @@ impl Display for Config {
writeln!(f, "MOCK_LLM: {}", self.mock_llm)?;
writeln!(f, "{}", self.headers)?;
writeln!(f, "{}", self.db_config)?;
writeln!(f, "{}", self.claude_config)?;
writeln!(f, "{}", self.openai_config)?;
writeln!(f, "{}", self.redis_config)
}
Expand Down
2 changes: 1 addition & 1 deletion api/src/endpoints/common_enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use axum::{
extract::{Query, State},
Json,
};
use integrationos_domain::{algebra::StoreExt, common_model::CommonEnum};
use integrationos_domain::common_model::CommonEnum;
use shape_mongo_filter::DELETED_STR;
use std::{collections::BTreeMap, sync::Arc};
use tokio::try_join;
Expand Down
2 changes: 1 addition & 1 deletion api/src/endpoints/common_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use axum::{
Router,
};
use integrationos_domain::{
algebra::{MongoStore, StoreExt},
algebra::MongoStore,
api_model_config::Lang,
common_model::{CommonModel, Field},
id::{prefix::IdPrefix, Id},
Expand Down
2 changes: 1 addition & 1 deletion api/src/endpoints/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use chrono::Utc;
use convert_case::{Case, Casing};
use http::HeaderMap;
use integrationos_domain::{
algebra::{MongoStore, StoreExt},
algebra::MongoStore,
connection_definition::ConnectionDefinition,
domain::connection::SanitizedConnection,
event_access::EventAccess,
Expand Down
2 changes: 1 addition & 1 deletion api/src/endpoints/connection_definition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use axum::{
Json, Router,
};
use integrationos_domain::{
algebra::{MongoStore, StoreExt},
algebra::MongoStore,
api_model_config::AuthMethod,
connection_definition::ConnectionStatus,
connection_definition::{
Expand Down
2 changes: 1 addition & 1 deletion 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::{MongoStore, StoreExt},
algebra::MongoStore,
api_model_config::{
ApiModelConfig, AuthMethod, ModelPaths, ResponseBody, SamplesInput, SchemasInput,
},
Expand Down
2 changes: 1 addition & 1 deletion api/src/endpoints/connection_model_schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use axum::{
Json, Router,
};
use integrationos_domain::{
algebra::{MongoStore, StoreExt},
algebra::MongoStore,
connection_model_schema::{ConnectionModelSchema, Mappings, SchemaPaths},
id::{prefix::IdPrefix, Id},
json_schema::JsonSchema,
Expand Down
2 changes: 1 addition & 1 deletion api/src/endpoints/event_access.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use axum::{
use integrationos_domain::{
access_key_data::AccessKeyData,
access_key_prefix::AccessKeyPrefix,
algebra::{MongoStore, StoreExt},
algebra::MongoStore,
connection_definition::{ConnectionDefinitionType, Paths},
environment::Environment,
event_access::EventAccess,
Expand Down
5 changes: 2 additions & 3 deletions api/src/endpoints/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ use axum::{
use bson::{doc, SerializerOptions};
use http::{HeaderMap, HeaderValue, StatusCode};
use integrationos_domain::{
algebra::{MongoStore, StoreExt},
event_access::EventAccess,
ApplicationError, Connection, IntegrationOSError, InternalError, OAuth, Store,
algebra::MongoStore, event_access::EventAccess, ApplicationError, Connection,
IntegrationOSError, InternalError, OAuth, Store,
};
use moka::future::Cache;
use mongodb::options::FindOneOptions;
Expand Down
3 changes: 1 addition & 2 deletions api/src/endpoints/oauth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use axum::{
use chrono::{Duration, Utc};
use http::{HeaderMap, HeaderName, HeaderValue};
use integrationos_domain::{
algebra::{MongoStore, StoreExt, TemplateExt},
algebra::{MongoStore, TemplateExt},
api_model_config::ContentType,
connection_definition::ConnectionDefinition,
connection_oauth_definition::{
Expand All @@ -32,7 +32,6 @@ use std::{
};
use tracing::{debug, error};

// TODO: Write documentation
pub fn get_router() -> Router<Arc<AppState>> {
Router::new().route("/:platform", post(oauth_handler))
}
Expand Down
2 changes: 1 addition & 1 deletion api/src/endpoints/openapi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use futures::{Stream, StreamExt, TryStreamExt};
use http::StatusCode;
use indexmap::IndexMap;
use integrationos_domain::{
algebra::{MongoStore, StoreExt, TimedExt},
algebra::{MongoStore, TimedExt},
common_model::{CommonEnum, CommonModel},
};
use mongodb::error::Error as MongoError;
Expand Down
2 changes: 1 addition & 1 deletion api/src/endpoints/platform_page.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use axum::{
};
use convert_case::{Case, Casing};
use integrationos_domain::{
algebra::{MongoStore, StoreExt},
algebra::MongoStore,
event_access::EventAccess,
hashed_secret::HashedSecret,
id::{prefix::IdPrefix, Id},
Expand Down
2 changes: 1 addition & 1 deletion api/src/middleware/auth.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::{endpoints::ApiError, internal_server_error, server::AppState, unauthorized};
use axum::{body::Body, extract::State, middleware::Next, response::Response};
use http::Request;
use integrationos_domain::{algebra::StoreExt, ApplicationError, InternalError};
use integrationos_domain::{ApplicationError, InternalError};
use mongodb::bson::doc;
use std::sync::Arc;
use tracing::error;
Expand Down
2 changes: 1 addition & 1 deletion api/src/routes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ pub async fn get_router(state: &Arc<AppState>) -> Router<Arc<AppState>> {
let path = format!("/{}", state.config.api_version);
let public_path = format!("{path}/public");
Router::new()
.nest(&path, protected::get_router(state).await)
.nest(&public_path, public::get_router(state))
.nest(&path, protected::get_router(state).await)
.nest(&path, authenticated::get_router(state).await)
.route("/", get(get_root))
.fallback(not_found_handler)
Expand Down
4 changes: 2 additions & 2 deletions api/tests/api_tests/test_server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use http::{header::AUTHORIZATION, Method};
use integrationos_domain::{
access_key_data::AccessKeyData,
access_key_prefix::AccessKeyPrefix,
algebra::{CryptoExt, MongoStore, StoreExt},
algebra::{CryptoExt, MongoStore},
api_model_config::{AuthMethod, SamplesInput, SchemasInput},
connection_definition::{ConnectionDefinition, ConnectionDefinitionType},
connection_model_definition::{
Expand Down Expand Up @@ -155,7 +155,7 @@ impl TestServer {

// Random database name
let db_name = db_name.unwrap_or_else(|| Uuid::new_v4().to_string());
let token_secret = "atveroeosetaccusamusetiustoodiodignissimosducimus".to_string();
let token_secret = "Qsfb9YUkdjwUULX.u96HdTCX4q7GuB".to_string();

let config = Config::init_from_hashmap(&HashMap::from([
("CONTROL_DATABASE_URL".to_string(), db.clone()),
Expand Down
7 changes: 7 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,15 @@ services:
environment:
- MONGO_INITDB_ROOT_PASSWORD=${MONGO_PASSWORD}
- MONGO_INITDB_ROOT_USERNAME=integrationos

setup:
image: mongo:6.0
depends_on:
- mongo
restart: "no"
volumes:
- ./seed-data:/seed-data:ro
entrypoint: ["/bin/bash", "-c", "sleep 10 && mongorestore --host mongo --nsFrom='seed_db.*' --nsTo='events-service.*' --authenticationDatabase admin -u integrationos -p ${MONGO_PASSWORD} /seed-data"]

redis:
image: redis:7.0
2 changes: 1 addition & 1 deletion event-core/src/mongo_control_data_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use futures::future::join_all;
use handlebars::Handlebars;
use http::header::AUTHORIZATION;
use integrationos_domain::{
algebra::{CryptoExt, FecherExt, GoogleTokenFetcher, MongoStore, StoreExt},
algebra::{CryptoExt, FecherExt, GoogleTokenFetcher, MongoStore},
client::unified_destination_client::UnifiedDestination,
duplicates::Duplicates,
encrypted_access_key::EncryptedAccessKey,
Expand Down
2 changes: 1 addition & 1 deletion event-core/tests/mock_destination.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ pub async fn seed_db(config: &EventCoreConfig, base_url: String) -> Id {
id: Id::new_with_uuid(IdPrefix::Connection, ts, uuid),
platform_version: "platformVersion".to_string(),
connection_definition_id: Id::new_with_uuid(IdPrefix::ConnectionDefinition, ts, uuid),
r#type: ConnectionType::Api,
r#type: ConnectionType::Api {},
name: "name".to_string(),
key: "key".into(),
group: "group".to_string(),
Expand Down
2 changes: 1 addition & 1 deletion gateway/src/finalizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::{config::Config, finalize_event::FinalizeEvent};
use anyhow::{bail, Context, Result};
use async_trait::async_trait;
use integrationos_domain::{
algebra::{MongoStore, RedisCache, StoreExt},
algebra::{MongoStore, RedisCache},
{
encrypted_access_key::EncryptedAccessKey, event_with_context::EventWithContext, Event,
RootContext, Store,
Expand Down

0 comments on commit b806a77

Please sign in to comment.