Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

chore: isolate ConnectionGatewayClient (#1822)

Will Hutchinson1504fca9a266
diff --git a/js/app/packages/service-clients/service-connection/generated/schemas/batchSendMessageBody.ts b/js/app/packages/service-clients/service-connection/generated/schemas/batchSendMessageBody.ts
index 12a93b85a1..18b1a31357 100644
--- a/js/app/packages/service-clients/service-connection/generated/schemas/batchSendMessageBody.ts
+++ b/js/app/packages/service-clients/service-connection/generated/schemas/batchSendMessageBody.ts
@@ -6,6 +6,9 @@
*/
import type { Entity } from './entity';
+/**
+ * The body of a batch send message request.
+ */
export interface BatchSendMessageBody {
/** all entities to send the message to */
entities: Entity[];
diff --git a/js/app/packages/service-clients/service-connection/generated/schemas/messageReceipt.ts b/js/app/packages/service-clients/service-connection/generated/schemas/messageReceipt.ts
index 426852b0ea..cadae2c2a0 100644
--- a/js/app/packages/service-clients/service-connection/generated/schemas/messageReceipt.ts
+++ b/js/app/packages/service-clients/service-connection/generated/schemas/messageReceipt.ts
@@ -5,6 +5,9 @@
* OpenAPI spec version: 0.1.0
*/
+/**
+ * A receipt for a message that was sent to a user.
+ */
export interface MessageReceipt {
/** If one of those connections was active for the entity */
active: boolean;
diff --git a/js/app/packages/service-clients/service-connection/generated/schemas/sendMessageBody.ts b/js/app/packages/service-clients/service-connection/generated/schemas/sendMessageBody.ts
index 9541d7a648..407f08c42c 100644
--- a/js/app/packages/service-clients/service-connection/generated/schemas/sendMessageBody.ts
+++ b/js/app/packages/service-clients/service-connection/generated/schemas/sendMessageBody.ts
@@ -5,7 +5,12 @@
* OpenAPI spec version: 0.1.0
*/
+/**
+ * The body of a send message request.
+ */
export interface SendMessageBody {
+ /** the message to send */
message: unknown;
+ /** the type of the message we are sending */
message_type: string;
}
diff --git a/js/app/packages/service-clients/service-connection/generated/schemas/sendMessageResponse.ts b/js/app/packages/service-clients/service-connection/generated/schemas/sendMessageResponse.ts
index 0538abed2f..6003445e90 100644
--- a/js/app/packages/service-clients/service-connection/generated/schemas/sendMessageResponse.ts
+++ b/js/app/packages/service-clients/service-connection/generated/schemas/sendMessageResponse.ts
@@ -6,6 +6,10 @@
*/
import type { MessageReceipt } from './messageReceipt';
+/**
+ * The response from sending a message.
+ */
export interface SendMessageResponse {
+ /** the receipts for each message sent */
receipts: MessageReceipt[];
}
diff --git a/js/app/packages/service-clients/service-connection/openapi.json b/js/app/packages/service-clients/service-connection/openapi.json
index 781df600fe..b0d978d1f4 100644
--- a/js/app/packages/service-clients/service-connection/openapi.json
+++ b/js/app/packages/service-clients/service-connection/openapi.json
@@ -192,6 +192,7 @@
"schemas": {
"BatchSendMessageBody": {
"type": "object",
+ "description": "The body of a batch send message request.",
"required": ["message", "entities", "message_type"],
"properties": {
"entities": {
@@ -254,6 +255,7 @@
},
"MessageReceipt": {
"type": "object",
+ "description": "A receipt for a message that was sent to a user.",
"required": ["user_id", "delivery_count", "active"],
"properties": {
"active": {
@@ -274,23 +276,29 @@
},
"SendMessageBody": {
"type": "object",
+ "description": "The body of a send message request.",
"required": ["message", "message_type"],
"properties": {
- "message": {},
+ "message": {
+ "description": "the message to send"
+ },
"message_type": {
- "type": "string"
+ "type": "string",
+ "description": "the type of the message we are sending"
}
}
},
"SendMessageResponse": {
"type": "object",
+ "description": "The response from sending a message.",
"required": ["receipts"],
"properties": {
"receipts": {
"type": "array",
"items": {
"$ref": "#/components/schemas/MessageReceipt"
- }
+ },
+ "description": "the receipts for each message sent"
}
}
},
diff --git a/rust/cloud-storage/Cargo.lock b/rust/cloud-storage/Cargo.lock
index ed1eaa36ed..2a2912daa2 100644
--- a/rust/cloud-storage/Cargo.lock
+++ b/rust/cloud-storage/Cargo.lock
@@ -1978,7 +1978,7 @@ dependencies = [
"chrono",
"comms",
"comms_db_client",
- "connection_gateway",
+ "connection_gateway_client",
"doppleganger",
"frecency",
"futures",
@@ -2055,6 +2055,8 @@ dependencies = [
"aws-sdk-secretsmanager",
"axum",
"chrono",
+ "connection_gateway_client",
+ "connection_gateway_models",
"cool_asserts",
"cowlike",
"dashmap",
@@ -2076,7 +2078,6 @@ dependencies = [
"model-entity",
"models_bulk_upload",
"redis",
- "reqwest",
"secretsmanager_client",
"serde",
"serde_dynamo",
@@ -2096,6 +2097,29 @@ dependencies = [
"uuid",
]
+[[package]]
+name = "connection_gateway_client"
+version = "0.1.0"
+dependencies = [
+ "anyhow",
+ "connection_gateway_models",
+ "model-entity",
+ "reqwest",
+ "serde",
+ "serde_json",
+ "tracing",
+]
+
+[[package]]
+name = "connection_gateway_models"
+version = "0.1.0"
+dependencies = [
+ "model-entity",
+ "serde",
+ "serde_json",
+ "utoipa",
+]
+
[[package]]
name = "console_error_panic_hook"
version = "0.1.7"
@@ -2168,7 +2192,7 @@ dependencies = [
"aws-sdk-secretsmanager",
"aws-sdk-sqs",
"axum",
- "connection_gateway",
+ "connection_gateway_client",
"contacts_db_client",
"http-body-util",
"macro_auth",
@@ -2886,7 +2910,7 @@ dependencies = [
"comms",
"comms_db_client",
"comms_service",
- "connection_gateway",
+ "connection_gateway_client",
"cool_asserts",
"cowlike",
"document_sub_type",
@@ -3452,7 +3476,7 @@ dependencies = [
"bytes",
"chrono",
"cloudfront_sign",
- "connection_gateway",
+ "connection_gateway_client",
"document_storage_service_client",
"doppleganger",
"ego-tree",
@@ -10390,7 +10414,7 @@ dependencies = [
"aws-sdk-sqs",
"aws_lambda_events",
"chrono",
- "connection_gateway",
+ "connection_gateway_client",
"document_storage_service_client",
"dynamodb_client",
"futures",
diff --git a/rust/cloud-storage/Cargo.toml b/rust/cloud-storage/Cargo.toml
index be67b00943..1279dba9f7 100644
--- a/rust/cloud-storage/Cargo.toml
+++ b/rust/cloud-storage/Cargo.toml
@@ -14,6 +14,8 @@ members = [
"comms_service",
"comms_service_client",
"connection_gateway",
+ "connection_gateway_client",
+ "connection_gateway_models",
"contacts_db_client",
"contacts_service",
"convert_service",
diff --git a/rust/cloud-storage/comms_service/Cargo.toml b/rust/cloud-storage/comms_service/Cargo.toml
index 8d09fe6f88..303e3e81e7 100644
--- a/rust/cloud-storage/comms_service/Cargo.toml
+++ b/rust/cloud-storage/comms_service/Cargo.toml
@@ -35,7 +35,7 @@ axum-macros = { workspace = true }
chrono = { workspace = true }
comms = { path = "../comms", features = ["inbound", "outbound"] }
comms_db_client = { path = "../comms_db_client", optional = true }
-connection_gateway = { path = "../connection_gateway" }
+connection_gateway_client = { path = "../connection_gateway_client" }
doppleganger = { workspace = true }
frecency = { path = "../frecency", features = ["postgres"] }
futures = { workspace = true }
diff --git a/rust/cloud-storage/connection_gateway/Cargo.toml b/rust/cloud-storage/connection_gateway/Cargo.toml
index 8efe53e30e..2ab2cacfdc 100644
--- a/rust/cloud-storage/connection_gateway/Cargo.toml
+++ b/rust/cloud-storage/connection_gateway/Cargo.toml
@@ -5,7 +5,7 @@ publish = false
version = "0.1.0"
[lib]
-name = "connection_gateway_client"
+name = "connection_gateway"
path = "src/lib.rs"
[[bin]]
@@ -26,6 +26,8 @@ aws-sdk-dynamodb = { workspace = true }
aws-sdk-secretsmanager = { workspace = true }
axum = { workspace = true, features = ["macros", "tower-log", "ws"] }
chrono = { workspace = true }
+connection_gateway_client = { path = "../connection_gateway_client" }
+connection_gateway_models = { path = "../connection_gateway_models" }
cowlike = { path = "../cowlike" }
dashmap = { workspace = true }
ensure_exists = { path = "../ensure_exists", features = ["dynamodb"] }
@@ -54,7 +56,6 @@ redis = { workspace = true, features = [
"tokio-comp",
"tokio-native-tls-comp",
] }
-reqwest.workspace = true
secretsmanager_client = { path = "../secretsmanager_client" }
serde = { workspace = true }
serde_dynamo = { workspace = true }
diff --git a/rust/cloud-storage/connection_gateway/src/api/message/mod.rs b/rust/cloud-storage/connection_gateway/src/api/message/mod.rs
index 1dc411d61a..4cc7e33e9e 100644
--- a/rust/cloud-storage/connection_gateway/src/api/message/mod.rs
+++ b/rust/cloud-storage/connection_gateway/src/api/message/mod.rs
@@ -1,21 +1,17 @@
-use crate::model::message::UniqueMessage;
-use crate::{
- context::AppState,
- model::{message::Message, sender::MessageReceipt},
- service::sender::send_message_to_entity,
-};
-use anyhow::Result;
+use crate::{context::AppState, model::message::Message, service::sender::send_message_to_entity};
use axum::{
Json as JsonResponse, Router,
extract::{Json, Path, State},
http::StatusCode,
routing::post,
};
+use connection_gateway_models::{
+ BatchSendMessageBody, BatchSendUniqueMessagesBody, SendMessageBody, SendMessageResponse,
+};
use futures::future::try_join_all;
use macro_middleware::auth;
use model_entity::Entity;
use std::time::Instant;
-use utoipa::ToSchema;
pub fn router<S>(state: AppState) -> Router<S>
where
@@ -35,17 +31,6 @@ where
.with_state(state)
}
-#[derive(serde::Serialize, Debug, ToSchema)]
-pub struct SendMessageResponse {
- pub receipts: Vec<MessageReceipt>,
-}
-
-#[derive(serde::Deserialize, serde::Serialize, Debug, ToSchema)]
-pub struct SendMessageBody {
- pub message: serde_json::Value,
- pub message_type: String,
-}
-
#[utoipa::path(
post,
path = "/message/send/{entity_type}/{entity_id}",
@@ -90,16 +75,6 @@ pub async fn send_message_handler(
))
}
-#[derive(serde::Deserialize, serde::Serialize, Debug, ToSchema)]
-pub struct BatchSendMessageBody<'a> {
- /// the message to send
- pub message: serde_json::Value,
- /// all entities to send the message to
- pub entities: Vec<Entity<'a>>,
- /// the type of the message we are sending
- pub message_type: String,
-}
-
#[utoipa::path(
post,
path = "/batch_send",
@@ -145,11 +120,6 @@ pub async fn batch_send_message_handler(
))
}
-#[derive(serde::Deserialize, serde::Serialize, Debug, ToSchema)]
-pub struct BatchSendUniqueMessagesBody {
- pub messages: Vec<UniqueMessage>,
-}
-
// Send unique (different) messages to multiple entities
#[utoipa::path(
post,
diff --git a/rust/cloud-storage/connection_gateway/src/api/mod.rs b/rust/cloud-storage/connection_gateway/src/api/mod.rs
index 3a561cf055..3ada56b5e9 100644
--- a/rust/cloud-storage/connection_gateway/src/api/mod.rs
+++ b/rust/cloud-storage/connection_gateway/src/api/mod.rs
@@ -1,8 +1,10 @@
use crate::context::AppState;
use axum::Router;
-use macro_middleware::auth::{attach_user, initialize_user_context};
#[allow(unused_imports)]
-pub use message::{BatchSendMessageBody, BatchSendUniqueMessagesBody, SendMessageBody};
+pub use connection_gateway_models::{
+ BatchSendMessageBody, BatchSendUniqueMessagesBody, SendMessageBody,
+};
+use macro_middleware::auth::{attach_user, initialize_user_context};
use tower::ServiceBuilder;
use utoipa::OpenApi;
use utoipa_swagger_ui::SwaggerUi;
diff --git a/rust/cloud-storage/connection_gateway/src/api/swagger.rs b/rust/cloud-storage/connection_gateway/src/api/swagger.rs
index 623c9e79b7..0dbb93789d 100644
--- a/rust/cloud-storage/connection_gateway/src/api/swagger.rs
+++ b/rust/cloud-storage/connection_gateway/src/api/swagger.rs
@@ -1,10 +1,11 @@
use super::entities;
use super::message;
-use super::message::{BatchSendMessageBody, SendMessageBody, SendMessageResponse};
use crate::model::connection::StoredConnectionEntity;
-use crate::model::sender::MessageReceipt;
use crate::model::tracking::TrackAction;
use crate::model::websocket::{ToWebsocketMessage, TrackEntityMessage};
+use connection_gateway_models::{
+ BatchSendMessageBody, MessageReceipt, SendMessageBody, SendMessageResponse,
+};
use model::response::{GenericErrorResponse, StringIDResponse};
use model_entity::{Entity, EntityType};
use models_bulk_upload::UploadFolderStatusUpdate;
diff --git a/rust/cloud-storage/connection_gateway/src/lib.rs b/rust/cloud-storage/connection_gateway/src/lib.rs
index 8b9662ba9c..a45f479e1b 100644
--- a/rust/cloud-storage/connection_gateway/src/lib.rs
+++ b/rust/cloud-storage/connection_gateway/src/lib.rs
@@ -1,9 +1,9 @@
pub mod api;
-pub mod client;
pub mod config;
pub mod constants;
pub mod context;
pub mod model;
pub mod service;
-pub use client::ConnectionGatewayClient;
+pub use connection_gateway_client::{self, ConnectionGatewayClient};
+pub use connection_gateway_models;
diff --git a/rust/cloud-storage/connection_gateway/src/model/message.rs b/rust/cloud-storage/connection_gateway/src/model/message.rs
index 9270076b88..aad366b6e6 100644
--- a/rust/cloud-storage/connection_gateway/src/model/message.rs
+++ b/rust/cloud-storage/connection_gateway/src/model/message.rs
@@ -1,8 +1,6 @@
use anyhow::Result;
-use model_entity::Entity;
use serde::{Deserialize, Serialize};
use stream::domain::StreamEvent;
-use utoipa::ToSchema;
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct Message {
@@ -30,17 +28,6 @@ pub enum OutgoingMessage {
Message(Message),
}
-// Represents a single unique message sent to a recipient
-#[derive(serde::Deserialize, serde::Serialize, Debug, ToSchema)]
-pub struct UniqueMessage {
- /// the message to send
- pub message_content: serde_json::Value,
- /// all entity to send the message to
- pub entity: Entity<'static>,
- /// the type of the message we are sending
- pub message_type: String,
-}
-
impl TryFrom<Message> for axum::extract::ws::Message {
type Error = anyhow::Error;
diff --git a/rust/cloud-storage/connection_gateway/src/model/sender.rs b/rust/cloud-storage/connection_gateway/src/model/sender.rs
index c06d22d38e..792d940906 100644
--- a/rust/cloud-storage/connection_gateway/src/model/sender.rs
+++ b/rust/cloud-storage/connection_gateway/src/model/sender.rs
@@ -1,11 +1 @@
-use utoipa::ToSchema;
-
-#[derive(serde::Serialize, serde::Deserialize, Debug, ToSchema)]
-pub struct MessageReceipt {
- /// The user id of the user who received the message
- pub user_id: String,
- /// The numer of times the message was delivered to the user
- pub delivery_count: u64,
- /// If one of those connections was active for the entity
- pub active: bool,
-}
+pub use connection_gateway_models::MessageReceipt;
diff --git a/rust/cloud-storage/connection_gateway_client/Cargo.toml b/rust/cloud-storage/connection_gateway_client/Cargo.toml
new file mode 100644
index 0000000000..aaac4ebb8c
--- /dev/null
+++ b/rust/cloud-storage/connection_gateway_client/Cargo.toml
@@ -0,0 +1,14 @@
+[package]
+edition = "2024"
+name = "connection_gateway_client"
+publish = false
+version = "0.1.0"
+
+[dependencies]
+anyhow = { workspace = true }
+connection_gateway_models = { path = "../connection_gateway_models" }
+model-entity = { path = "../model-entity" }
+reqwest = { workspace = true }
+serde = { workspace = true }
+serde_json = { workspace = true }
+tracing = { workspace = true, features = ["attributes"] }
diff --git a/rust/cloud-storage/connection_gateway/src/client/email.rs b/rust/cloud-storage/connection_gateway_client/src/client/email.rs
similarity index 80%
rename from rust/cloud-storage/connection_gateway/src/client/email.rs
rename to rust/cloud-storage/connection_gateway_client/src/client/email.rs
index 71c9bafab1..5782c62c77 100644
--- a/rust/cloud-storage/connection_gateway/src/client/email.rs
+++ b/rust/cloud-storage/connection_gateway_client/src/client/email.rs
@@ -1,8 +1,9 @@
-use crate::{client::ConnectionGatewayClient, model::sender::MessageReceipt};
+use super::ConnectionGatewayClient;
+use connection_gateway_models::MessageReceipt;
use serde_json::json;
impl ConnectionGatewayClient {
- // trigger refresh of the user's emails
+ /// Trigger refresh of the user's emails
#[tracing::instrument(skip(self))]
pub async fn refresh_email(
&self,
@@ -18,6 +19,7 @@ impl ConnectionGatewayClient {
.await
}
+ /// Invalidate a user's contacts cache
#[tracing::instrument(skip(self), err)]
pub async fn invalidate_contacts(&self, user_id: &str) -> anyhow::Result<Vec<MessageReceipt>> {
self.send_message(
diff --git a/rust/cloud-storage/connection_gateway/src/client/mod.rs b/rust/cloud-storage/connection_gateway_client/src/client/mod.rs
similarity index 87%
rename from rust/cloud-storage/connection_gateway/src/client/mod.rs
rename to rust/cloud-storage/connection_gateway_client/src/client/mod.rs
index 35fe280969..236c58f930 100644
--- a/rust/cloud-storage/connection_gateway/src/client/mod.rs
+++ b/rust/cloud-storage/connection_gateway_client/src/client/mod.rs
@@ -1,13 +1,15 @@
-use crate::api::BatchSendMessageBody;
-use crate::api::BatchSendUniqueMessagesBody;
-use crate::api::SendMessageBody;
-use crate::model::message::UniqueMessage;
-use crate::model::sender::MessageReceipt;
+//! Connection gateway HTTP client.
+
+use connection_gateway_models::{
+ BatchSendMessageBody, BatchSendUniqueMessagesBody, MessageReceipt, SendMessageBody,
+ UniqueMessage,
+};
use model_entity::Entity;
mod email;
mod project;
+/// HTTP client for communicating with the connection gateway service.
#[derive(Clone, Debug)]
pub struct ConnectionGatewayClient {
connection_gateway_url: String,
@@ -15,11 +17,12 @@ pub struct ConnectionGatewayClient {
}
#[derive(serde::Deserialize, Debug)]
-pub struct Response {
+struct Response {
receipts: Vec<MessageReceipt>,
}
impl ConnectionGatewayClient {
+ /// Create a new connection gateway client.
pub fn new(internal_auth_key: String, connection_gateway_url: String) -> Self {
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-internal-auth-key", internal_auth_key.parse().unwrap());
@@ -65,7 +68,7 @@ impl ConnectionGatewayClient {
Ok(receipts.receipts)
}
- /// send a message to multiple entities
+ /// Send a message to multiple entities
pub async fn batch_send_message(
&self,
message_type: String,
@@ -94,7 +97,7 @@ impl ConnectionGatewayClient {
Ok(receipts.receipts)
}
- /// send unique messages to multiple entities
+ /// Send unique messages to multiple entities
pub async fn batch_send_unique_messages(
&self,
messages: Vec<UniqueMessage>,
@@ -117,7 +120,7 @@ impl ConnectionGatewayClient {
Ok(receipts.receipts)
}
- /// get users who are interacting with a given item
+ /// Get users who are interacting with a given item
pub async fn track_entity_users(
&self,
entity_type: String,
diff --git a/rust/cloud-storage/connection_gateway/src/client/project.rs b/rust/cloud-storage/connection_gateway_client/src/client/project.rs
similarity index 83%
rename from rust/cloud-storage/connection_gateway/src/client/project.rs
rename to rust/cloud-storage/connection_gateway_client/src/client/project.rs
index e2c88e3a6c..c7f4418c16 100644
--- a/rust/cloud-storage/connection_gateway/src/client/project.rs
+++ b/rust/cloud-storage/connection_gateway_client/src/client/project.rs
@@ -1,8 +1,9 @@
use super::ConnectionGatewayClient;
-use crate::model::sender::MessageReceipt;
+use connection_gateway_models::MessageReceipt;
use serde_json::json;
impl ConnectionGatewayClient {
+ /// Send a project update notification
#[tracing::instrument(skip(self))]
pub async fn project_update(&self, project_id: &str) -> anyhow::Result<Vec<MessageReceipt>> {
tracing::info!(project_id, "sending project update");
diff --git a/rust/cloud-storage/connection_gateway_client/src/lib.rs b/rust/cloud-storage/connection_gateway_client/src/lib.rs
new file mode 100644
index 0000000000..663ee506fe
--- /dev/null
+++ b/rust/cloud-storage/connection_gateway_client/src/lib.rs
@@ -0,0 +1,7 @@
+#![deny(missing_docs)]
+//! HTTP client for the connection gateway service.
+
+pub mod client;
+
+pub use client::ConnectionGatewayClient;
+pub use connection_gateway_models as models;
diff --git a/rust/cloud-storage/connection_gateway_models/Cargo.toml b/rust/cloud-storage/connection_gateway_models/Cargo.toml
new file mode 100644
index 0000000000..e3c980c71e
--- /dev/null
+++ b/rust/cloud-storage/connection_gateway_models/Cargo.toml
@@ -0,0 +1,11 @@
+[package]
+edition = "2024"
+name = "connection_gateway_models"
+publish = false
+version = "0.1.0"
+
+[dependencies]
+model-entity = { path = "../model-entity" }
+serde = { workspace = true }
+serde_json = { workspace = true }
+utoipa = { workspace = true }
diff --git a/rust/cloud-storage/connection_gateway_models/src/lib.rs b/rust/cloud-storage/connection_gateway_models/src/lib.rs
new file mode 100644
index 0000000000..13b39e8898
--- /dev/null
+++ b/rust/cloud-storage/connection_gateway_models/src/lib.rs
@@ -0,0 +1,62 @@
+#![deny(missing_docs)]
+//! Shared types for the connection gateway service and client.
+
+use model_entity::Entity;
+use serde::{Deserialize, Serialize};
+use utoipa::ToSchema;
+
+/// A receipt for a message that was sent to a user.
+#[derive(Serialize, Deserialize, Debug, ToSchema)]
+pub struct MessageReceipt {
+ /// The user id of the user who received the message
+ pub user_id: String,
+ /// The numer of times the message was delivered to the user
+ pub delivery_count: u64,
+ /// If one of those connections was active for the entity
+ pub active: bool,
+}
+
+/// Represents a single unique message sent to a recipient.
+#[derive(Deserialize, Serialize, Debug, ToSchema)]
+pub struct UniqueMessage {
+ /// the message to send
+ pub message_content: serde_json::Value,
+ /// all entity to send the message to
+ pub entity: Entity<'static>,
+ /// the type of the message we are sending
+ pub message_type: String,
+}
+
+/// The body of a send message request.
+#[derive(Deserialize, Serialize, Debug, ToSchema)]
+pub struct SendMessageBody {
+ /// the message to send
+ pub message: serde_json::Value,
+ /// the type of the message we are sending
+ pub message_type: String,
+}
+
+/// The body of a batch send message request.
+#[derive(Deserialize, Serialize, Debug, ToSchema)]
+pub struct BatchSendMessageBody<'a> {
+ /// the message to send
+ pub message: serde_json::Value,
+ /// all entities to send the message to
+ pub entities: Vec<Entity<'a>>,
+ /// the type of the message we are sending
+ pub message_type: String,
+}
+
+/// The body of a batch send unique messages request.
+#[derive(Deserialize, Serialize, Debug, ToSchema)]
+pub struct BatchSendUniqueMessagesBody {
+ /// the messages to send
+ pub messages: Vec<UniqueMessage>,
+}
+
+/// The response from sending a message.
+#[derive(Serialize, Debug, ToSchema)]
+pub struct SendMessageResponse {
+ /// the receipts for each message sent
+ pub receipts: Vec<MessageReceipt>,
+}
diff --git a/rust/cloud-storage/contacts_service/Cargo.toml b/rust/cloud-storage/contacts_service/Cargo.toml
index 021a1409ab..2ec05f36f5 100644
--- a/rust/cloud-storage/contacts_service/Cargo.toml
+++ b/rust/cloud-storage/contacts_service/Cargo.toml
@@ -20,7 +20,7 @@ aws-sdk-secretsmanager = { workspace = true }
macro_aws_config = { path = "../macro_aws_config" }
aws-sdk-sqs = { workspace = true }
axum = { workspace = true }
-connection_gateway = { path = "../connection_gateway" }
+connection_gateway_client = { path = "../connection_gateway_client" }
contacts_db_client = { path = "../contacts_db_client" }
http-body-util = { workspace = true }
macro_auth = { path = "../macro_auth" }
diff --git a/rust/cloud-storage/document_cognition_service/src/api/context/mod.rs b/rust/cloud-storage/document_cognition_service/src/api/context/mod.rs
index 05e218ceb3..5d3e331cba 100644
--- a/rust/cloud-storage/document_cognition_service/src/api/context/mod.rs
+++ b/rust/cloud-storage/document_cognition_service/src/api/context/mod.rs
@@ -1,7 +1,7 @@
use crate::config::Config;
use ai_tools::{ToolDocumentToolContext, ToolSoupService};
use axum::extract::FromRef;
-use connection_gateway_client::service::connection::ConnectionRepo;
+use connection_gateway::service::connection::ConnectionRepo;
use document_storage_service_client::DocumentStorageServiceClient;
use macro_auth::middleware::decode_jwt::JwtValidationArgs;
use macro_middleware::auth::internal_access::InternalApiSecretKey;
diff --git a/rust/cloud-storage/document_cognition_service/src/api/context/test.rs b/rust/cloud-storage/document_cognition_service/src/api/context/test.rs
index 683bf80abe..576c56d2db 100644
--- a/rust/cloud-storage/document_cognition_service/src/api/context/test.rs
+++ b/rust/cloud-storage/document_cognition_service/src/api/context/test.rs
@@ -1,7 +1,7 @@
use super::*;
-use connection_gateway_client::model::connection::StoredConnectionEntity;
-use connection_gateway_client::model::tracking::{EntityConnection, UserEntityConnection};
-use connection_gateway_client::service::connection::ConnectionRepo;
+use connection_gateway::model::connection::StoredConnectionEntity;
+use connection_gateway::model::tracking::{EntityConnection, UserEntityConnection};
+use connection_gateway::service::connection::ConnectionRepo;
use std::sync::Arc;
use stream::domain::{
ItemId, ItemStream, Result as StreamResult, StreamEvent, StreamId, StreamRepo,
diff --git a/rust/cloud-storage/document_cognition_service/src/main.rs b/rust/cloud-storage/document_cognition_service/src/main.rs
index 3d0aa3e58a..fdad8df024 100644
--- a/rust/cloud-storage/document_cognition_service/src/main.rs
+++ b/rust/cloud-storage/document_cognition_service/src/main.rs
@@ -197,11 +197,9 @@ async fn main() -> anyhow::Result<()> {
tracing::info!("initialized stream repo");
let connection_manager =
- connection_gateway_client::service::dynamodb::create_dynamo_db_connection_manager(
- dynamodb_client,
- )
- .await
- .context("failed to create connection manager")?;
+ connection_gateway::service::dynamodb::create_dynamo_db_connection_manager(dynamodb_client)
+ .await
+ .context("failed to create connection manager")?;
tracing::info!("initialized connection repo");
diff --git a/rust/cloud-storage/document_cognition_service/src/service/notification.rs b/rust/cloud-storage/document_cognition_service/src/service/notification.rs
index d6149506ea..07208eea2a 100644
--- a/rust/cloud-storage/document_cognition_service/src/service/notification.rs
+++ b/rust/cloud-storage/document_cognition_service/src/service/notification.rs
@@ -1,7 +1,7 @@
use std::collections::HashSet;
use std::sync::Arc;
-use connection_gateway_client::service::connection::ConnectionRepo;
+use connection_gateway::service::connection::ConnectionRepo;
use macro_user_id::user_id::MacroUserIdStr;
use model_entity::EntityType;
use model_notifications::AiResponseMetadata;
diff --git a/rust/cloud-storage/document_storage_service/Cargo.toml b/rust/cloud-storage/document_storage_service/Cargo.toml
index 6453e185b5..c1e356f874 100644
--- a/rust/cloud-storage/document_storage_service/Cargo.toml
+++ b/rust/cloud-storage/document_storage_service/Cargo.toml
@@ -47,7 +47,7 @@ clap = { workspace = true }
cloudfront_sign = { workspace = true }
channels = { path = "../channels", features = ["inbound", "outbound"] }
comms = { path = "../comms", features = ["outbound"] }
-connection_gateway = { path = "../connection_gateway" }
+connection_gateway_client = { path = "../connection_gateway_client" }
document_sub_type = { path = "../document_sub_type" }
documents_hex = { path = "../documents", package = "documents" }
dynamodb_client = { path = "../dynamodb_client" }
@@ -138,4 +138,4 @@ frecency = { path = "../frecency", features = ["mock"] }
ordered-float = { workspace = true }
[package.metadata.cargo-machete]
-ignored = ["connection_gateway"]
+ignored = ["connection_gateway_client"]
diff --git a/rust/cloud-storage/email_service/Cargo.toml b/rust/cloud-storage/email_service/Cargo.toml
index 4832f43e4a..69fd0bcff0 100644
--- a/rust/cloud-storage/email_service/Cargo.toml
+++ b/rust/cloud-storage/email_service/Cargo.toml
@@ -77,7 +77,7 @@ base64 = { workspace = true }
bytes = { workspace = true }
chrono = { workspace = true }
cloudfront_sign = { workspace = true }
-connection_gateway = { path = "../connection_gateway" }
+connection_gateway_client = { path = "../connection_gateway_client" }
document_storage_service_client = { path = "../document_storage_service_client" }
doppleganger = { workspace = true }
ego-tree = { workspace = true }
diff --git a/rust/cloud-storage/target/lambda/upload_extractor_lambda_handler/bootstrap.zip b/rust/cloud-storage/target/lambda/upload_extractor_lambda_handler/bootstrap.zip
index 928ec27c37..53bef4945a 100644
Binary files a/rust/cloud-storage/target/lambda/upload_extractor_lambda_handler/bootstrap.zip and b/rust/cloud-storage/target/lambda/upload_extractor_lambda_handler/bootstrap.zip differ
diff --git a/rust/cloud-storage/upload_extractor_lambda_handler/Cargo.toml b/rust/cloud-storage/upload_extractor_lambda_handler/Cargo.toml
index b38534a369..f9b5c20b63 100644
--- a/rust/cloud-storage/upload_extractor_lambda_handler/Cargo.toml
+++ b/rust/cloud-storage/upload_extractor_lambda_handler/Cargo.toml
@@ -13,7 +13,7 @@ aws-sdk-s3 = { workspace = true }
aws-sdk-sqs = { workspace = true }
aws_lambda_events = { workspace = true, features = ["sqs"] }
chrono = { workspace = true }
-connection_gateway = { path = "../connection_gateway" }
+connection_gateway_client = { path = "../connection_gateway_client" }
document_storage_service_client = { path = "../document_storage_service_client" }
dynamodb_client = { path = "../dynamodb_client" }
futures = { workspace = true }
@@ -37,4 +37,4 @@ walkdir = "2.3.2"
zip = { workspace = true }
[package.metadata.cargo-machete]
-ignored = ["connection_gateway", "openssl"]
+ignored = ["connection_gateway_client", "openssl"]