Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: cleanup and rewrite of unified function #212

Merged
merged 23 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading