Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
refactor(search): remove use of service_clients from search in step to make hexifying easier (#1109)
Will Hutchinson113fe958568b
diff --git a/rust/cloud-storage/Cargo.lock b/rust/cloud-storage/Cargo.lockindex 7ec3ad0439..3d2a951be3 100644--- a/rust/cloud-storage/Cargo.lock+++ b/rust/cloud-storage/Cargo.lock@@ -7653,11 +7653,10 @@ dependencies = ["aws-sdk-secretsmanager","axum","chrono",- "comms_service_client",- "document_storage_service_client",+ "comms_db_client","document_sub_type","email_contact_search",- "email_service_client",+ "email_db_client","futures","http-body-util","indexmap 2.12.1",diff --git a/rust/cloud-storage/comms_service_client/src/lib.rs b/rust/cloud-storage/comms_service_client/src/lib.rsindex a51450cc29..f167da2567 100644--- a/rust/cloud-storage/comms_service_client/src/lib.rs+++ b/rust/cloud-storage/comms_service_client/src/lib.rs@@ -10,7 +10,6 @@ pub mod messages;pub mod organization;pub mod participants;pub mod permissions;-pub mod user_channels;#[derive(Clone)]pub struct CommsServiceClient {diff --git a/rust/cloud-storage/comms_service_client/src/user_channels.rs b/rust/cloud-storage/comms_service_client/src/user_channels.rsdeleted file mode 100644index 5d691fdd2e..0000000000--- a/rust/cloud-storage/comms_service_client/src/user_channels.rs+++ /dev/null@@ -1,32 +0,0 @@-use super::CommsServiceClient;-use crate::error::{ClientError, ResponseExt};--impl CommsServiceClient {- /// Get the channel ids that a user is a member of- #[tracing::instrument(skip(self))]- pub async fn get_user_channel_ids(- &self,- user_id: &str,- user_org_id: Option<i32>,- ) -> Result<Vec<uuid::Uuid>, ClientError> {- let url = if let Some(user_org_id) = user_org_id {- format!(- "{}/internal/user_channels/{}?org_id={}",- self.url, user_id, user_org_id- )- } else {- format!("{}/internal/user_channels/{}", self.url, user_id)- };-- let response = self.client.get(url).send().await.map_client_error().await?;-- let result = response.json::<Vec<uuid::Uuid>>().await.map_err(|e| {- ClientError::Generic(anyhow::anyhow!(- "unable to parse response from get_user_channel_ids: {}",- e.to_string()- ))- })?;-- Ok(result)- }-}diff --git a/rust/cloud-storage/document_storage_service_client/src/item_ids.rs b/rust/cloud-storage/document_storage_service_client/src/item_ids.rsdeleted file mode 100644index 1756240365..0000000000--- a/rust/cloud-storage/document_storage_service_client/src/item_ids.rs+++ /dev/null@@ -1,60 +0,0 @@-use crate::DocumentStorageServiceClient;-use crate::constants::MACRO_INTERNAL_USER_ID_HEADER_KEY;-use model::{- document_storage_service_internal::{- GetItemIDsResponse, ValidateItemIDsRequest, ValidateItemIDsResponse,- },- item::{ShareableItem, UserAccessibleItem},-};--impl DocumentStorageServiceClient {- /// Gets the ids of the items the user has access to- #[tracing::instrument(skip(self), err)]- pub async fn get_user_accessible_item_ids(- &self,- user_id: &str,- item_type: Option<String>,- exclude_owned: Option<bool>,- ) -> anyhow::Result<GetItemIDsResponse> {- let mut req = self- .client- .get(format!("{}/internal/item_ids", self.url))- .header(MACRO_INTERNAL_USER_ID_HEADER_KEY, user_id);-- // Add query parameters if provided- if let Some(item_type) = &item_type {- req = req.query(&[("item_type", item_type)]);- }-- if let Some(exclude_owned) = exclude_owned {- req = req.query(&[("exclude_owned", exclude_owned.to_string())]);- }-- let res = req.send().await?.error_for_status()?;-- let response = res.json::<GetItemIDsResponse>().await?;-- Ok(response)- }-- /// Validates the list of item to see if the user has access to- #[tracing::instrument(skip(self), err)]- pub async fn validate_user_accessible_item_ids(- &self,- user_id: &str,- items: Vec<ShareableItem>,- ) -> anyhow::Result<Vec<UserAccessibleItem>> {- let res = self- .client- .post(format!("{}/internal/validate_item_ids", self.url))- .header(MACRO_INTERNAL_USER_ID_HEADER_KEY, user_id)- .json(&ValidateItemIDsRequest { items })- .send()- .await?- .error_for_status()?;-- let response = res.json::<ValidateItemIDsResponse>().await?;-- Ok(response.items)- }-}diff --git a/rust/cloud-storage/document_storage_service_client/src/lib.rs b/rust/cloud-storage/document_storage_service_client/src/lib.rsindex ac6de185cd..b57356ad9f 100644--- a/rust/cloud-storage/document_storage_service_client/src/lib.rs+++ b/rust/cloud-storage/document_storage_service_client/src/lib.rs@@ -4,7 +4,6 @@ pub(crate) mod constants;pub mod delete;pub mod document;pub mod error;-pub mod item_ids;pub mod notification;pub mod project;pub mod thread;diff --git a/rust/cloud-storage/email_service_client/src/get_thread_histories.rs b/rust/cloud-storage/email_service_client/src/get_thread_histories.rsdeleted file mode 100644index 1252e69533..0000000000--- a/rust/cloud-storage/email_service_client/src/get_thread_histories.rs+++ /dev/null@@ -1,30 +0,0 @@-use crate::EmailServiceClient;-use models_email::service::message::{ThreadHistoryRequest, ThreadHistoryResponse};--impl EmailServiceClient {- pub async fn get_thread_histories(- &self,- request: ThreadHistoryRequest,- ) -> anyhow::Result<ThreadHistoryResponse> {- let res = self- .client- .post(format!("{}/internal/threads/histories", self.url))- .json(&request)- .send()- .await?;-- match res.status() {- reqwest::StatusCode::OK => {- let result = res.json::<ThreadHistoryResponse>().await?;- Ok(result)- }- status_code => {- let body: String = res.text().await?;- anyhow::bail!(format!(- "unexpected response from email service status code {}: {}",- status_code, body- ))- }- }- }-}diff --git a/rust/cloud-storage/email_service_client/src/lib.rs b/rust/cloud-storage/email_service_client/src/lib.rsindex 48a744e9f1..286bd8d58a 100644--- a/rust/cloud-storage/email_service_client/src/lib.rs+++ b/rust/cloud-storage/email_service_client/src/lib.rs@@ -6,7 +6,6 @@ mod external;pub mod get_message_by_id;pub mod get_message_senders;pub mod get_messages_by_thread_id;-pub mod get_thread_histories;pub mod get_thread_owner;pub use external::*;diff --git a/rust/cloud-storage/search_service/Cargo.toml b/rust/cloud-storage/search_service/Cargo.tomlindex 676c5b9732..c156151f0e 100644--- a/rust/cloud-storage/search_service/Cargo.toml+++ b/rust/cloud-storage/search_service/Cargo.toml@@ -18,11 +18,10 @@ aws-config = { workspace = true }aws-sdk-secretsmanager = { workspace = true }axum = { workspace = true }chrono = { workspace = true }-comms_service_client = { path = "../comms_service_client" }-document_storage_service_client = { path = "../document_storage_service_client" }+comms_db_client = { path = "../comms_db_client" }document_sub_type = { path = "../document_sub_type" }email_contact_search = { path = "../email_contact_search" }-email_service_client = { path = "../email_service_client" }+email_db_client = { path = "../email_db_client" }futures = { workspace = true }http-body-util = { workspace = true }indexmap = "2"diff --git a/rust/cloud-storage/search_service/src/api/context.rs b/rust/cloud-storage/search_service/src/api/context.rsindex 5334caed01..e0bb94fbf5 100644--- a/rust/cloud-storage/search_service/src/api/context.rs+++ b/rust/cloud-storage/search_service/src/api/context.rs@@ -11,9 +11,6 @@ use std::sync::Arc;pub(crate) struct ApiContext {pub db: PgPool,pub opensearch_client: Arc<OpensearchClient>,- pub comms_service_client: Arc<comms_service_client::CommsServiceClient>,- pub dss_client: Arc<document_storage_service_client::DocumentStorageServiceClient>,- pub email_service_client: Arc<email_service_client::EmailServiceClient>,pub jwt_args: JwtValidationArgs,pub internal_auth_key: LocalOrRemoteSecret<InternalApiSecretKey>,pub config: Arc<Config>,diff --git a/rust/cloud-storage/search_service/src/api/search/channel.rs b/rust/cloud-storage/search_service/src/api/search/channel.rsindex 29771fc097..bf9eb91556 100644--- a/rust/cloud-storage/search_service/src/api/search/channel.rs+++ b/rust/cloud-storage/search_service/src/api/search/channel.rs@@ -3,7 +3,7 @@ use indexmap::IndexMap;use std::collections::HashMap;use crate::api::ApiContext;-use model::comms::{ChannelHistoryInfo, GetChannelsHistoryRequest};+use model::comms::ChannelHistoryInfo;use models_search::channel::{ChannelSearchResponseItem, ChannelSearchResponseItemWithMetadata, ChannelSearchResult,};@@ -29,19 +29,18 @@ pub(in crate::api::search) async fn enrich_channels(// Extract channel IDs from resultslet channel_ids: Vec<Uuid> = results.iter().map(|r| r.entity_id).collect();- // Fetch channel metadata from comms service- let channel_histories = ctx- .comms_service_client- .get_channels_history(GetChannelsHistoryRequest {- user_id: user_id.to_string(),- channel_ids,- })- .await- .map_err(|e| SearchError::InternalError(e.into()))?;+ // Fetch channel metadata directly from DB+ let channel_histories = comms_db_client::activity::get_activity::get_channel_history_info(+ &ctx.db,+ user_id,+ &channel_ids,+ )+ .await+ .map_err(|e| SearchError::InternalError(e.into()))?;// Construct enriched results- let enriched_results = construct_search_result(results, channel_histories.channels_history)- .map_err(SearchError::InternalError)?;+ let enriched_results =+ construct_search_result(results, channel_histories).map_err(SearchError::InternalError)?;Ok(enriched_results)}diff --git a/rust/cloud-storage/search_service/src/api/search/email.rs b/rust/cloud-storage/search_service/src/api/search/email.rsindex e27df80401..d61bf5cc57 100644--- a/rust/cloud-storage/search_service/src/api/search/email.rs+++ b/rust/cloud-storage/search_service/src/api/search/email.rs@@ -1,15 +1,13 @@use crate::api::ApiContext;use crate::api::search::simple::SearchError;use indexmap::IndexMap;-use models_email::service::message::{- MessageSenderInfo, MessageSendersRequest, ThreadHistoryInfo, ThreadHistoryRequest,-};+use models_email::service::message::{MessageSenderInfo, ThreadHistoryInfo};use models_search::email::{EmailSearchResponseItem, EmailSearchResponseItemWithMetadata, EmailSearchResult,};use opensearch_client::search::model::SearchGotoContent;use sqlx::types::Uuid;-use std::collections::{HashMap, HashSet};+use std::collections::HashMap;/// Enriches email search results with metadata#[tracing::instrument(skip(ctx, results), err)]@@ -27,20 +25,22 @@ pub(in crate::api::search) async fn enrich_emails(return Ok(vec![]);}+ // Get the email link for this user+ let link = email_db_client::links::get::fetch_link_by_macro_id(&ctx.db, user_id)+ .await+ .map_err(SearchError::InternalError)?+ .ok_or_else(|| SearchError::InternalError(anyhow::anyhow!("Link not found for user")))?;+// Extract thread IDs from resultslet thread_ids: Vec<Uuid> = results.iter().map(|r| r.entity_id).collect();- // Fetch email thread metadata from email service- let thread_histories = ctx- .email_service_client- .get_thread_histories(ThreadHistoryRequest {- user_id: user_id.to_string(),- thread_ids,- })- .await- .map_err(SearchError::InternalError)?;+ // Fetch email thread metadata directly from DB+ let thread_histories =+ email_db_client::user_history::get_thread_summary_info(&ctx.db, link.id, &thread_ids)+ .await+ .map_err(SearchError::InternalError)?;- let message_senders: HashSet<Uuid> = results+ let message_ids: Vec<Uuid> = results.iter().filter_map(|r| {if let Some(goto) = &r.goto {@@ -55,23 +55,18 @@ pub(in crate::api::search) async fn enrich_emails(}).collect();- let message_senders_map = ctx- .email_service_client- .get_message_senders(MessageSendersRequest {- user_id: user_id.to_string(),- message_ids: message_senders.into_iter().collect(),- })- .await- .map_err(SearchError::InternalError)?;-- // Construct enriched results- let enriched_results = construct_search_result(- results,- thread_histories.history_map,- message_senders_map.sender_map,+ let message_senders_map = email_db_client::messages::get::get_message_sender_and_pretty_sender(+ &ctx.db,+ link.id,+ &message_ids,)+ .await.map_err(SearchError::InternalError)?;+ // Construct enriched results+ let enriched_results = construct_search_result(results, thread_histories, message_senders_map)+ .map_err(SearchError::InternalError)?;+Ok(enriched_results)}diff --git a/rust/cloud-storage/search_service/src/api/search/simple/simple_channel.rs b/rust/cloud-storage/search_service/src/api/search/simple/simple_channel.rsindex aa75fabb36..05b65f9d92 100644--- a/rust/cloud-storage/search_service/src/api/search/simple/simple_channel.rs+++ b/rust/cloud-storage/search_service/src/api/search/simple/simple_channel.rs@@ -14,12 +14,14 @@ pub(in crate::api::search) async fn filter_channels(organization_id: Option<i32>,filters: &ChannelFilters,) -> Result<FilterChannelResponse, SearchError> {- // Get all channel ids for the user- let channel_ids = ctx- .comms_service_client- .get_user_channel_ids(user_id, organization_id)- .await- .map_err(|e| SearchError::InternalError(e.into()))?;+ // Get all channel ids for the user directly from DB+ let channel_ids = comms_db_client::channels::get_channels::get_user_channel_ids(+ &ctx.db,+ user_id,+ organization_id.map(|id| id as i64),+ )+ .await+ .map_err(|e| SearchError::InternalError(e.into()))?;// If the user has no channels, return an empty responseif channel_ids.is_empty() {diff --git a/rust/cloud-storage/search_service/src/api/search/simple/simple_chat.rs b/rust/cloud-storage/search_service/src/api/search/simple/simple_chat.rsindex 2ac9797259..ecc71b6ba9 100644--- a/rust/cloud-storage/search_service/src/api/search/simple/simple_chat.rs+++ b/rust/cloud-storage/search_service/src/api/search/simple/simple_chat.rs@@ -1,7 +1,7 @@use crate::api::search::simple::SearchError;use item_filters::ChatFilters;use macro_user_id::user_id::MacroUserId;-use model::item::{ShareableItem, ShareableItemType};+use model::item::{ShareableItem, ShareableItemType, UserAccessibleItem};use opensearch_client::search::model::{Highlight, SearchHit};use sqlx::{Pool, Postgres, types::Uuid};@@ -18,36 +18,35 @@ pub(in crate::api::search) async fn filter_chats(user_id: &str,filters: &ChatFilters,) -> Result<FilterChatResponse, SearchError> {- let chat_ids_response = if !filters.chat_ids.is_empty() {+ let chat_ids_response: Vec<UserAccessibleItem> = if !filters.chat_ids.is_empty() {// Item ids are provided, we want to get the list of those that are accessible to the user- ctx.dss_client- .validate_user_accessible_item_ids(- user_id,- filters- .chat_ids- .iter()- .map(|id| ShareableItem {- item_id: id.to_string(),- item_type: ShareableItemType::Chat,- })- .collect(),- )- .await- .map_err(SearchError::InternalError)?+ macro_db_client::item_access::validate_user_accessible_items(+ &ctx.db,+ user_id,+ filters+ .chat_ids+ .iter()+ .map(|id| ShareableItem {+ item_id: id.to_string(),+ item_type: ShareableItemType::Chat,+ })+ .collect(),+ )+ .await+ .map_err(SearchError::InternalError)?} else {// If both the project_ids and owners are empty, we want to get the list of everything the has access to but does not own// Otherwise, we need a list of all items the user has access to including what they ownlet should_exclude_owner = filters.project_ids.is_empty() && filters.owners.is_empty();// No filters are provided, we want to get the list of everything the has access to but does not own- ctx.dss_client- .get_user_accessible_item_ids(- user_id,- Some("chat".to_string()),- Some(should_exclude_owner),- )- .await- .map_err(SearchError::InternalError)?- .items+ macro_db_client::item_access::get_accessible_items::get_user_accessible_items(+ &ctx.db,+ user_id,+ Some("chat".to_string()),+ should_exclude_owner,+ )+ .await+ .map_err(SearchError::InternalError)?};let chat_ids: Vec<String> = chat_ids_responsediff --git a/rust/cloud-storage/search_service/src/api/search/simple/simple_document.rs b/rust/cloud-storage/search_service/src/api/search/simple/simple_document.rsindex a6f55d9453..a9db8a13eb 100644--- a/rust/cloud-storage/search_service/src/api/search/simple/simple_document.rs+++ b/rust/cloud-storage/search_service/src/api/search/simple/simple_document.rs@@ -1,7 +1,7 @@use crate::api::search::simple::SearchError;use item_filters::DocumentFilters;use macro_user_id::{lowercased::Lowercase, user_id::MacroUserId};-use model::item::{ShareableItem, ShareableItemType};+use model::item::{ShareableItem, ShareableItemType, UserAccessibleItem};use opensearch_client::search::model::{Highlight, SearchHit};use sqlx::{Pool, Postgres, types::Uuid};@@ -18,22 +18,22 @@ pub(in crate::api::search) async fn filter_documents(user_id: &str,filters: &DocumentFilters,) -> Result<FilterDocumentResponse, SearchError> {- let document_ids_response = if !filters.document_ids.is_empty() {+ let document_ids_response: Vec<UserAccessibleItem> = if !filters.document_ids.is_empty() {// Item ids are provided, we want to get the list of those that are accessible to the user- ctx.dss_client- .validate_user_accessible_item_ids(- user_id,- filters- .document_ids- .iter()- .map(|id| ShareableItem {- item_id: id.to_string(),- item_type: ShareableItemType::Document,- })- .collect(),- )- .await- .map_err(SearchError::InternalError)?+ macro_db_client::item_access::validate_user_accessible_items(+ &ctx.db,+ user_id,+ filters+ .document_ids+ .iter()+ .map(|id| ShareableItem {+ item_id: id.to_string(),+ item_type: ShareableItemType::Document,+ })+ .collect(),+ )+ .await+ .map_err(SearchError::InternalError)?} else {// If both the project_ids and owners are empty, we want to get the list of everything the has access to but does not own// Otherwise, we need a list of all items the user has access to including what they own@@ -42,15 +42,14 @@ pub(in crate::api::search) async fn filter_documents(&& filters.file_types.is_empty();// No filters are provided, we want to get the list of everything the has access to but does not own- ctx.dss_client- .get_user_accessible_item_ids(- user_id,- Some("document".to_string()),- Some(should_exclude_owner),- )- .await- .map_err(SearchError::InternalError)?- .items+ macro_db_client::item_access::get_accessible_items::get_user_accessible_items(+ &ctx.db,+ user_id,+ Some("document".to_string()),+ should_exclude_owner,+ )+ .await+ .map_err(SearchError::InternalError)?};let document_ids: Vec<String> = document_ids_responsediff --git a/rust/cloud-storage/search_service/src/api/search/simple/simple_project.rs b/rust/cloud-storage/search_service/src/api/search/simple/simple_project.rsindex 0f3a708c55..ce2613dea4 100644--- a/rust/cloud-storage/search_service/src/api/search/simple/simple_project.rs+++ b/rust/cloud-storage/search_service/src/api/search/simple/simple_project.rs@@ -20,41 +20,40 @@ pub(in crate::api::search) async fn filter_projects() -> Result<FilterProjectResponse, SearchError> {let project_ids: Vec<String> = if !filters.project_ids.is_empty() {// Item ids are provided, we want to get the list of those that are accessible to the user- ctx.dss_client- .validate_user_accessible_item_ids(- user_id,- filters- .project_ids- .iter()- .map(|id| ShareableItem {- item_id: id.to_string(),- item_type: ShareableItemType::Project,- })- .collect(),- )- .await- .map_err(SearchError::InternalError)?- .into_iter()- .map(|a| a.item_id)- .collect()+ macro_db_client::item_access::validate_user_accessible_items(+ &ctx.db,+ user_id,+ filters+ .project_ids+ .iter()+ .map(|id| ShareableItem {+ item_id: id.to_string(),+ item_type: ShareableItemType::Project,+ })+ .collect(),+ )+ .await+ .map_err(SearchError::InternalError)?+ .into_iter()+ .map(|a| a.item_id)+ .collect()} else {// If both the project_ids and owners are empty, we want to get the list of everything the has access to but does not own// Otherwise, we need a list of all items the user has access to including what they ownlet should_exclude_owner = filters.project_ids.is_empty() && filters.owners.is_empty();// No filters are provided, we want to get the list of everything the has access to but does not own- ctx.dss_client- .get_user_accessible_item_ids(- user_id,- Some("project".to_string()),- Some(should_exclude_owner),- )- .await- .map_err(SearchError::InternalError)?- .items- .into_iter()- .map(|a| a.item_id)- .collect()+ macro_db_client::item_access::get_accessible_items::get_user_accessible_items(+ &ctx.db,+ user_id,+ Some("project".to_string()),+ should_exclude_owner,+ )+ .await+ .map_err(SearchError::InternalError)?+ .into_iter()+ .map(|a| a.item_id)+ .collect()};let ids_only = !filters.project_ids.is_empty() || !filters.owners.is_empty();diff --git a/rust/cloud-storage/search_service/src/config.rs b/rust/cloud-storage/search_service/src/config.rsindex bea108230f..4df66accbe 100644--- a/rust/cloud-storage/search_service/src/config.rs+++ b/rust/cloud-storage/search_service/src/config.rs@@ -20,12 +20,6 @@ pub struct Config {/// The internal auth keypub internal_auth_key: LocalOrRemoteSecret<InternalApiSecretKey>,-- pub comms_service_url: String,-- pub email_service_url: String,-- pub dss_url: String,}impl Config {@@ -49,14 +43,6 @@ impl Config {let internal_auth_key = LocalOrRemoteSecret::Local(InternalApiSecretKey::new()?);- let comms_service_url =- std::env::var("COMMS_SERVICE_URL").context("COMMS_SERVICE_URL must be provided")?;-- let email_service_url =- std::env::var("EMAIL_SERVICE_URL").context("EMAIL_SERVICE_URL must be provided")?;-- let dss_url = std::env::var("DOCUMENT_STORAGE_SERVICE_URL")- .context("DOCUMENT_STORAGE_SERVICE_URL must be provided")?;Ok(Config {port,environment,@@ -65,9 +51,6 @@ impl Config {opensearch_username,opensearch_password,internal_auth_key,- comms_service_url,- email_service_url,- dss_url,})}}diff --git a/rust/cloud-storage/search_service/src/main.rs b/rust/cloud-storage/search_service/src/main.rsindex 80c11752ab..58e41be710 100644--- a/rust/cloud-storage/search_service/src/main.rs+++ b/rust/cloud-storage/search_service/src/main.rs@@ -1,9 +1,6 @@use crate::api::context::ApiContext;use anyhow::Context;-use comms_service_client::CommsServiceClient;use config::{Config, Environment};-use document_storage_service_client::DocumentStorageServiceClient;-use email_service_client::EmailServiceClient;use macro_auth::middleware::decode_jwt::JwtValidationArgs;use macro_entrypoint::MacroEntrypoint;use macro_middleware::auth::internal_access::InternalApiSecretKey;@@ -66,21 +63,6 @@ async fn main() -> anyhow::Result<()> {return Err(e);}- let comms_service_client = CommsServiceClient::new(- config.internal_auth_key.as_ref().to_string(),- config.comms_service_url.clone(),- );-- let dss_client = DocumentStorageServiceClient::new(- config.internal_auth_key.as_ref().to_string(),- config.dss_url.clone(),- );-- let email_service_client = EmailServiceClient::new(- config.internal_auth_key.as_ref().to_string(),- config.email_service_url.clone(),- );-let jwt_args =JwtValidationArgs::new_with_secret_manager(config.environment, &secretsmanager_client).await?;@@ -88,9 +70,6 @@ async fn main() -> anyhow::Result<()> {api::setup_and_serve(ApiContext {db,opensearch_client: Arc::new(opensearch_client),- comms_service_client: Arc::new(comms_service_client),- dss_client: Arc::new(dss_client),- email_service_client: Arc::new(email_service_client),jwt_args,internal_auth_key: secretsmanager_client::LocalOrRemoteSecret::Local(InternalApiSecretKey::new()?,