Skip to content

Commit

Permalink
refactor: cleanup and rewrite of unified function (#212)
Browse files Browse the repository at this point in the history
  • Loading branch information
sagojez authored Jan 23, 2025
1 parent 6c8a3a1 commit 02c179c
Show file tree
Hide file tree
Showing 59 changed files with 1,486 additions and 1,730 deletions.
139 changes: 73 additions & 66 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ bson = "2.13.0"
chrono = { version = "0.4.38", features = ["serde"] }
convert_case = "0.6.0"
dotenvy = "0.15.7"
derive_builder = "0.20.0"
envconfig = "0.10.0"
fake = { version = "2.10.0", features = [
"uuid",
Expand Down
9 changes: 5 additions & 4 deletions integrationos-api/src/logic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use axum::{
};
use bson::doc;
use http::{HeaderMap, HeaderValue};
use integrationos_cache::local::connection_cache::ConnectionCacheArcStrHeaderKey;
use integrationos_cache::local::{ConnectionHeaderCache, LocalCacheExt};
use integrationos_domain::{
algebra::MongoStore, event_access::EventAccess, ApplicationError, Connection,
IntegrationOSError, InternalError, OAuth, Store, Unit,
Expand Down Expand Up @@ -42,7 +42,7 @@ pub mod schema_generator;
pub mod secrets;
pub mod transactions;
pub mod unified;
pub mod utils;
pub mod utility;
pub mod vault_connection;

const INTEGRATION_OS_PASSTHROUGH_HEADER: &str = "x-pica-passthrough";
Expand Down Expand Up @@ -322,11 +322,11 @@ async fn get_connection(
access: &EventAccess,
connection_key: &HeaderValue,
stores: &AppStores,
cache: &ConnectionCacheArcStrHeaderKey,
cache: &ConnectionHeaderCache,
) -> Result<Arc<Connection>, IntegrationOSError> {
let connection = cache
.get_or_insert_with_filter(
(access.ownership.id.clone(), connection_key.clone()),
&(access.ownership.id.clone(), connection_key.clone()),
stores.connection.clone(),
doc! {
"key": connection_key.to_str().map_err(|_| {
Expand All @@ -335,6 +335,7 @@ async fn get_connection(
"ownership.buildableId": access.ownership.id.as_ref(),
"deleted": false
},
None,
)
.await?;

Expand Down
2 changes: 1 addition & 1 deletion integrationos-api/src/logic/passthrough.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ pub async fn passthrough_request(

let model_execution_result = state
.extractor_caller
.send_to_destination(
.dispatch_destination_request(
Some(connection.clone()),
&destination,
headers,
Expand Down
Loading

0 comments on commit 02c179c

Please sign in to comment.