Skip to content

Commit

Permalink
Migrating from http 0.* to 1.*, and IOS v.3.0.0 (#7)
Browse files Browse the repository at this point in the history
* Migrating from http 0.* to 1.*, and IOS v.3.0.0

* Fixing format
  • Loading branch information
sagojez authored Apr 18, 2024
1 parent 9432b59 commit 0b93333
Show file tree
Hide file tree
Showing 58 changed files with 967 additions and 1,038 deletions.
561 changes: 480 additions & 81 deletions Cargo.lock

Large diffs are not rendered by default.

22 changes: 10 additions & 12 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
[workspace]

resolver = "2"

members = [
"api",
"event-core",
"gateway",
"watchdog"
"watchdog",
]

[workspace.dependencies]
anyhow = "1.0.75"
async-recursion = "1.0.5"
async-trait = "0.1.74"
axum = "0.6.20"
axum-macros = "0.3.8"
axum = {version = "0.7", features = ["macros"]}
base64 = "0.21.5"
base64ct = { version = "1.6.0", features = ["alloc"] }
bson = "2.7.0"
chrono = { version = "0.4.31", features = ["serde"] }
convert_case = "0.6.0"
dotenvy = "0.15.7"
envconfig = "0.10.0"
fake = { version = "=2.9.1", features = [
fake = { version = "2.9.2", features = [
"uuid",
"derive",
"dummy",
Expand All @@ -34,9 +32,9 @@ fake = { version = "=2.9.1", features = [
futures = "0.3.28"
futures-util = "0.3.28"
handlebars = "4.4.0"
http = "0.2.9"
http-serde-ext = "0.1.8"
integrationos-domain = "1.0.0"
http = "1.1.0"
http-serde-ext = "1.0.2"
integrationos-domain = "3.0.0"
js-sandbox-ios = "0.1.0"
jsonpath_lib = "0.3.0"
jsonwebtoken = "8.3.0"
Expand All @@ -48,7 +46,7 @@ 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 = [
reqwest = { version = "0.12.3", features = [
"json",
"rustls-tls",
], default-features = false }
Expand All @@ -64,7 +62,7 @@ tokio = { version = "1.33.0", features = [
"time",
"sync",
] }
tower-http = { version = "0.4.4", features = [
tower-http = { version = "0.5", features = [
"trace",
"cors",
"sensitive-headers",
Expand All @@ -76,4 +74,4 @@ uuid = { version = "1.5.0", features = ["v4", "serde"] }
validator = { version = "0.16.1", features = ["derive"] }

[profile.release]
lto = true
lto = "thin"
9 changes: 3 additions & 6 deletions api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,14 @@ convert_case.workspace = true
dotenvy.workspace = true
envconfig.workspace = true
fake = { workspace = true, optional = true }
futures.workspace = true
futures-util.workspace = true
futures.workspace = true
handlebars.workspace = true
http-serde-ext.workspace = true
http.workspace = true
hyper = "0.14.27"
indexmap = "2.1.0"
integrationos-domain = { workspace = true, features = [
"unified",
"metrics",
"axum-error",
] }
integrationos-domain = { workspace = true, features = [ "unified", "metrics", "axum-error", ] }
jsonwebtoken.workspace = true
moka.workspace = true
mongodb.workspace = true
Expand All @@ -43,6 +39,7 @@ strum.workspace = true
tokio.workspace = true
tower = { version = "0.4.13", features = ["filter"] }
tower-http.workspace = true
tower_governor = "0.3.2"
tracing-subscriber.workspace = true
tracing.workspace = true
validator.workspace = true
Expand Down
7 changes: 6 additions & 1 deletion api/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::{

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

Expand Down Expand Up @@ -55,6 +55,11 @@ pub struct Config {
default = "2thZ2UiOnsibmFtZSI6IlN0YXJ0dXBsa3NoamRma3NqZGhma3NqZGhma3NqZG5jhYtggfaP9ubmVjdGlvbnMiOjUwMDAwMCwibW9kdWxlcyI6NSwiZW5kcG9pbnRzIjo3b4e05e2-f050-401f-9822-44f43f71753c"
)]
pub jwt_secret: String,
#[envconfig(from = "BURST_RATE_LIMIT", default = "1")]
pub burst_rate_limit: u64,
/// Burst size limit
#[envconfig(from = "BURST_SIZE_LIMIT", default = "30")]
pub burst_size: u32,
#[envconfig(from = "API_VERSION", default = "v1")]
pub api_version: String,
#[envconfig(from = "MOCK_LLM", default = "false")]
Expand Down
38 changes: 15 additions & 23 deletions api/src/endpoints/common_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,9 @@ use axum::{
use integrationos_domain::{
algebra::{MongoStore, StoreExt},
api_model_config::Lang,
common::{
common_model::{CommonModel, Field},
event_access::EventAccess,
json_schema::JsonSchema,
},
common_model::{CommonModel, Field},
id::{prefix::IdPrefix, Id},
json_schema::JsonSchema,
IntegrationOSError,
};
use mongodb::bson::doc;
Expand Down Expand Up @@ -83,33 +80,28 @@ impl CrudHook<CommonModel> for CreateRequest {

impl CrudRequest for CreateRequest {
type Output = CommonModel;
type Error = ();

fn into_public(self) -> Result<Self::Output, Self::Error> {
fn output(&self) -> Option<Self::Output> {
let mut record = Self::Output {
id: Id::now(IdPrefix::CommonModel),
name: self.name,
fields: self.fields,
sample: self.sample,
category: self.category,
name: self.name.clone(),
fields: self.fields.clone(),
sample: self.sample.clone(),
category: self.category.clone(),
primary: self.primary,
interface: Default::default(),
record_metadata: Default::default(),
};
record.record_metadata.version = self.version;
Ok(record)
record.record_metadata.version = self.version.clone();
Some(record)
}

fn into_with_event_access(self, _event_access: Arc<EventAccess>) -> Self::Output {
unimplemented!()
}

fn update(self, record: &mut Self::Output) {
record.name = self.name;
record.record_metadata.version = self.version;
record.fields = self.fields;
record.category = self.category;
record.sample = self.sample;
fn update(&self, record: &mut Self::Output) {
record.name = self.name.clone();
record.record_metadata.version = self.version.clone();
record.fields = self.fields.clone();
record.category = self.category.clone();
record.sample = self.sample.clone();
}

fn get_store(stores: AppStores) -> MongoStore<Self::Output> {
Expand Down
22 changes: 5 additions & 17 deletions api/src/endpoints/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ use convert_case::{Case, Casing};
use http::HeaderMap;
use integrationos_domain::{
algebra::{MongoStore, StoreExt},
common::{
connection_definition::ConnectionDefinition, event_access::EventAccess,
record_metadata::RecordMetadata, settings::Settings, Connection, Throughput,
},
connection_definition::ConnectionDefinition,
event_access::EventAccess,
id::{prefix::IdPrefix, Id},
record_metadata::RecordMetadata,
settings::Settings,
Connection, Throughput,
};
use mongodb::bson::doc;
use mongodb::bson::Regex;
Expand Down Expand Up @@ -93,23 +94,10 @@ async fn test_connection(

impl CrudRequest for CreateConnectionPayload {
type Output = Connection;
type Error = ();

fn into_with_event_access(self, _event_access: Arc<EventAccess>) -> Self::Output {
unimplemented!()
}

fn update(self, _record: &mut Self::Output) {
unimplemented!()
}

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

fn into_public(self) -> Result<Self::Output, Self::Error> {
unimplemented!()
}
}

pub async fn create_connection(
Expand Down
66 changes: 29 additions & 37 deletions api/src/endpoints/connection_definition.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::{
create, delete, update, ApiResult, CachedRequest, CrudHook, CrudRequest, ReadResponse,
create, delete, update, ApiResult, CachedRequest, CrudHook, CrudRequest, ReadResponse, Unit,
};
use crate::{
internal_server_error, not_found,
Expand All @@ -12,19 +12,16 @@ use axum::{
};
use integrationos_domain::{
algebra::{MongoStore, StoreExt},
common::{
api_model_config::AuthMethod,
connection_definition::{
AuthSecret, ConnectionDefinition, ConnectionDefinitionType, ConnectionForm,
FormDataItem, Frontend, Paths, Spec,
},
event_access::EventAccess,
record_metadata::RecordMetadata,
settings::Settings,
},
api_model_config::AuthMethod,
connection_definition::ConnectionStatus,
connection_definition::{
AuthSecret, ConnectionDefinition, ConnectionDefinitionType, ConnectionForm, FormDataItem,
Frontend, Paths, Spec,
},
connection_model_definition::{ConnectionModelDefinition, CrudAction},
id::{prefix::IdPrefix, Id},
record_metadata::RecordMetadata,
settings::Settings,
};
use moka::future::Cache;
use mongodb::bson::doc;
Expand Down Expand Up @@ -255,9 +252,8 @@ pub async fn public_get_connection_details(

impl CrudRequest for CreateRequest {
type Output = ConnectionDefinition;
type Error = ();

fn into_public(self) -> Result<Self::Output, Self::Error> {
fn output(&self) -> Option<Self::Output> {
let auth_secrets: Vec<AuthSecret> = self
.authentication
.iter()
Expand Down Expand Up @@ -287,48 +283,44 @@ impl CrudRequest for CreateRequest {

let mut record = Self::Output {
id: Id::now(IdPrefix::ConnectionDefinition),
platform_version: self.platform_version,
platform_version: self.platform_version.clone(),
platform: self.platform.clone(),
status: self.status,
r#type: self.r#type,
status: self.status.clone(),
r#type: self.r#type.clone(),
name: self.name.clone(),
key,
frontend: Frontend {
spec: Spec {
title: self.name,
description: self.description,
platform: self.platform,
category: self.category,
image: self.image,
tags: self.tags,
title: self.name.clone(),
description: self.description.clone(),
platform: self.platform.clone(),
category: self.category.clone(),
image: self.image.clone(),
tags: self.tags.clone(),
},
connection_form,
},
test_connection: self.test_connection,
auth_secrets,
auth_method: self.auth_method,
paths: self.paths,
settings: self.settings,
auth_method: self.auth_method.clone(),
paths: self.paths.clone(),
settings: self.settings.clone(),
hidden: false,
record_metadata: RecordMetadata::default(),
};

record.record_metadata.active = self.active;
Ok(record)
}

fn into_with_event_access(self, _event_access: Arc<EventAccess>) -> Self::Output {
unimplemented!()
Some(record)
}

fn update(self, record: &mut Self::Output) {
record.name = self.name;
record.frontend.spec.description = self.description;
record.frontend.spec.category = self.category;
record.frontend.spec.image = self.image;
record.frontend.spec.tags = self.tags;
fn update(&self, record: &mut Self::Output) -> Unit {
record.name = self.name.clone();
record.frontend.spec.description = self.description.clone();
record.frontend.spec.category = self.category.clone();
record.frontend.spec.image = self.image.clone();
record.frontend.spec.tags = self.tags.clone();
record.test_connection = self.test_connection;
record.platform = self.platform;
record.platform = self.platform.clone();
record.record_metadata.active = self.active;
}

Expand Down
Loading

0 comments on commit 0b93333

Please sign in to comment.