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
seanaye/fix/ios payload uuid (#1400)
Sean Ayeba3bdf37bd30
diff --git a/js/app/packages/entity/src/extractors/entity-icon.tsx b/js/app/packages/entity/src/extractors/entity-icon.tsxindex 01f051bf84..e932fe6cad 100644--- a/js/app/packages/entity/src/extractors/entity-icon.tsx+++ b/js/app/packages/entity/src/extractors/entity-icon.tsx@@ -25,7 +25,7 @@ function DirectMessageIcon(props: { entity: ChannelEntity }) {<div class="bg-panel size-full rounded-full"><Showwhen={participantId()}- fallback={<CoreEntityIcon targetType="directMessage" size="fill" />}+ fallback={<CoreEntityIcon targetType="direct_message" size="fill" />}>{(id) => <UserIcon id={id()} isDeleted={false} size="fill" />}</Show>diff --git a/js/app/packages/service-clients/service-notification/generated/schemas/index.ts b/js/app/packages/service-clients/service-notification/generated/schemas/index.tsindex 9df349a1e6..20366dde80 100644--- a/js/app/packages/service-clients/service-notification/generated/schemas/index.ts+++ b/js/app/packages/service-clients/service-notification/generated/schemas/index.ts@@ -104,8 +104,6 @@ export * from './notificationTemporalDataDeletedAt';export * from './notificationTemporalDataUpdatedAt';export * from './notificationTemporalDataViewedAt';export * from './pushNotificationData';-export * from './pushNotificationDataAllOf';-export * from './pushNotificationDataAllOfSenderId';export * from './taskAssignedMetadata';export * from './taskAssignedMetadataTaskName';export * from './unsubscribeItemPathParams';diff --git a/js/app/packages/service-clients/service-notification/generated/schemas/pushNotificationData.ts b/js/app/packages/service-clients/service-notification/generated/schemas/pushNotificationData.tsindex 9dd3b2f726..99d807cf10 100644--- a/js/app/packages/service-clients/service-notification/generated/schemas/pushNotificationData.ts+++ b/js/app/packages/service-clients/service-notification/generated/schemas/pushNotificationData.ts@@ -4,7 +4,8 @@* notification_service* OpenAPI spec version: 0.1.0*/-import type { Entity } from './entity';-import type { PushNotificationDataAllOf } from './pushNotificationDataAllOf';-export type PushNotificationData = Entity & PushNotificationDataAllOf;+export interface PushNotificationData {+ /** The id of the notification record (UserNotification.id) */+ notificationId: string;+}diff --git a/js/app/packages/service-clients/service-notification/generated/schemas/pushNotificationDataAllOf.ts b/js/app/packages/service-clients/service-notification/generated/schemas/pushNotificationDataAllOf.tsdeleted file mode 100644index 20086d04b1..0000000000--- a/js/app/packages/service-clients/service-notification/generated/schemas/pushNotificationDataAllOf.ts+++ /dev/null@@ -1,17 +0,0 @@-/**- * Generated by orval v7.13.0 🍺- * Do not edit manually.- * notification_service- * OpenAPI spec version: 0.1.0- */-import type { PushNotificationDataAllOfSenderId } from './pushNotificationDataAllOfSenderId';--export type PushNotificationDataAllOf = {- /** The id of the notification record (UserNotification.id) */- notificationId: string;- /** The route to open the notification in the app-example: /channel/{channel_id} */- openRoute: string;- /** user id of the macro user who generated the notification */- senderId?: PushNotificationDataAllOfSenderId;-};diff --git a/js/app/packages/service-clients/service-notification/generated/schemas/pushNotificationDataAllOfSenderId.ts b/js/app/packages/service-clients/service-notification/generated/schemas/pushNotificationDataAllOfSenderId.tsdeleted file mode 100644index 0b813f0459..0000000000--- a/js/app/packages/service-clients/service-notification/generated/schemas/pushNotificationDataAllOfSenderId.ts+++ /dev/null@@ -1,11 +0,0 @@-/**- * Generated by orval v7.13.0 🍺- * Do not edit manually.- * notification_service- * OpenAPI spec version: 0.1.0- */--/**- * user id of the macro user who generated the notification- */-export type PushNotificationDataAllOfSenderId = string | null;diff --git a/js/app/packages/service-clients/service-notification/openapi.json b/js/app/packages/service-clients/service-notification/openapi.jsonindex cbadb63ca9..e63b9369d2 100644--- a/js/app/packages/service-clients/service-notification/openapi.json+++ b/js/app/packages/service-clients/service-notification/openapi.json@@ -1812,30 +1812,15 @@}},"PushNotificationData": {- "allOf": [- {- "$ref": "#/components/schemas/Entity"- },- {- "type": "object",- "required": ["notificationId", "openRoute"],- "properties": {- "notificationId": {- "type": "string",- "format": "uuid",- "description": "The id of the notification record (UserNotification.id)"- },- "openRoute": {- "type": "string",- "description": "The route to open the notification in the app\nexample: /channel/{channel_id}"- },- "senderId": {- "type": ["string", "null"],- "description": "user id of the macro user who generated the notification"- }- }+ "type": "object",+ "required": ["notificationId"],+ "properties": {+ "notificationId": {+ "type": "string",+ "format": "uuid",+ "description": "The id of the notification record (UserNotification.id)"}- ]+ }},"TaskAssignedMetadata": {"type": "object",diff --git a/rust/cloud-storage/ai_tools/src/lib.rs b/rust/cloud-storage/ai_tools/src/lib.rsindex ea12d83ffc..12a92ccc4a 100644--- a/rust/cloud-storage/ai_tools/src/lib.rs+++ b/rust/cloud-storage/ai_tools/src/lib.rs@@ -1,3 +1,5 @@+#![recursion_limit = "256"]+use ai_toolset::AsyncToolSet;use ai_toolset::schema::{ToolSchemaGenerator, ToolSchemas};pub mod code_execution;diff --git a/rust/cloud-storage/document_storage_service/src/api/annotations/mod.rs b/rust/cloud-storage/document_storage_service/src/api/annotations/mod.rsindex 3886f8eda6..61d44ac837 100644--- a/rust/cloud-storage/document_storage_service/src/api/annotations/mod.rs+++ b/rust/cloud-storage/document_storage_service/src/api/annotations/mod.rs@@ -24,11 +24,12 @@ use model_entity::EntityType;use notification::domain::models::{NotifCollapseKey, Notification, NotificationExtIos, RateLimitConfig, RateLimitKey,SendNotificationRequestBuilder,- apple::{APNSPushNotification, AlertDictionary, Aps},+ apple::{APNSPushNotification, AlertDictionary, Aps, PushNotificationData},};use serde::{Deserialize, Serialize};use tower::ServiceBuilder;use utoipa::ToSchema;+use uuid::Uuid;pub fn router(state: ApiContext) -> Router<ApiContext> {Router::new()@@ -195,7 +196,7 @@ impl Notification for DocumentMentionNotification {}impl NotificationExtIos for DocumentMentionNotification {- type NotifData = ();+ type NotifData = ::notification::domain::models::apple::PushNotificationData;fn collapse_key(&self, entity: &Entity<'_>) -> NotifCollapseKey {let entity_type: &'static str = entity.entity_type.into();@@ -205,11 +206,17 @@ impl NotificationExtIos for DocumentMentionNotification {fn into_apns<'a>(self,sender_id: Option<MacroUserIdStr<'a>>,+ _entity: &Entity<'_>,+ notification_id: Uuid,) -> Option<APNSPushNotification<Self::NotifData>> {let sender = sender_id?;- let file_type = self.file_type.as_ref()?;+ let file_type_str = self.file_type.as_ref()?;let title = sender.0.email_part().email_str().to_string();- let body = format!("You were mentioned in {}.{}", self.document_name, file_type);+ let body = format!(+ "You were mentioned in {}.{}",+ self.document_name, file_type_str+ );+Some(APNSPushNotification {aps: Aps {alert: Some(notification::domain::models::apple::Alert::Dictionary(@@ -221,7 +228,7 @@ impl NotificationExtIos for DocumentMentionNotification {)),..Default::default()},- push_notification_data: (),+ push_notification_data: PushNotificationData { notification_id },})}}diff --git a/rust/cloud-storage/document_storage_service/src/openapi.rs b/rust/cloud-storage/document_storage_service/src/openapi.rsindex cf946bb8a6..9a84857dc5 100644--- a/rust/cloud-storage/document_storage_service/src/openapi.rs+++ b/rust/cloud-storage/document_storage_service/src/openapi.rs@@ -1,4 +1,5 @@#![allow(unused)]+#![recursion_limit = "256"]mod api;mod config;diff --git a/rust/cloud-storage/model_notifications/Cargo.toml b/rust/cloud-storage/model_notifications/Cargo.tomlindex 62ffb79f76..8af2ea88ed 100644--- a/rust/cloud-storage/model_notifications/Cargo.toml+++ b/rust/cloud-storage/model_notifications/Cargo.toml@@ -11,9 +11,9 @@ doppleganger = { workspace = true }macro_user_id = { path = "../macro_user_id" }mention_utils = { path = "../mention_utils" }model-entity = { path = "../model-entity" }-notification = { path = "../notification" }models_comms = { path = "../models_comms" }models_pagination = { path = "../models_pagination" }+notification = { path = "../notification" }serde = { workspace = true }serde_json = { workspace = true }sqlx = { workspace = true }diff --git a/rust/cloud-storage/model_notifications/src/metadata.rs b/rust/cloud-storage/model_notifications/src/metadata.rsindex 987f691589..1533fad299 100644--- a/rust/cloud-storage/model_notifications/src/metadata.rs+++ b/rust/cloud-storage/model_notifications/src/metadata.rs@@ -8,10 +8,11 @@ use notification::domain::models::RateLimitConfig;use notification::domain::models::RateLimitKey;use notification::domain::models::{NotifCollapseKey, NotificationExtIos,- apple::{APNSPushNotification, AlertDictionary, Aps},+ apple::{APNSPushNotification, AlertDictionary, Aps, PushNotificationData},};use serde::{Deserialize, Serialize, de::DeserializeOwned};use utoipa::ToSchema;+use uuid::Uuid;#[derive(Debug, Clone, Copy, ToSchema, Doppleganger, Serialize, Deserialize)]#[dg(backward = models_comms::channel::ChannelType)]@@ -430,7 +431,11 @@ fn parse_message_plain_text(content: &str) -> Option<String> {}/// Helper to create an alert-style APNS notification with title and body.-fn alert_apns(title: String, body: String) -> APNSPushNotification<()> {+fn alert_apns(+ title: String,+ body: String,+ data: PushNotificationData,+) -> APNSPushNotification<PushNotificationData> {APNSPushNotification {aps: Aps {alert: Some(notification::domain::models::apple::Alert::Dictionary(@@ -442,12 +447,12 @@ fn alert_apns(title: String, body: String) -> APNSPushNotification<()> {)),..Default::default()},- push_notification_data: (),+ push_notification_data: data,}}impl NotificationExtIos for ChannelInviteMetadata {- type NotifData = ();+ type NotifData = ::notification::domain::models::apple::PushNotificationData;fn collapse_key(&self, entity: &Entity<'_>) -> NotifCollapseKey {let entity_type: &'static str = entity.entity_type.into();@@ -457,16 +462,19 @@ impl NotificationExtIos for ChannelInviteMetadata {fn into_apns<'a>(self,_sender_id: Option<MacroUserIdStr<'a>>,+ _entity: &Entity<'_>,+ notification_id: Uuid,) -> Option<APNSPushNotification<Self::NotifData>> {Some(alert_apns(format!("{} Invite", self.common.channel_name),format!("{} invited you to join the channel", self.invited_by),+ PushNotificationData { notification_id },))}}impl NotificationExtIos for ChannelMessageSendMetadata {- type NotifData = ();+ type NotifData = ::notification::domain::models::apple::PushNotificationData;fn collapse_key(&self, _entity: &Entity<'_>) -> NotifCollapseKey {NotifCollapseKey::new(&self.message_id)@@ -475,6 +483,8 @@ impl NotificationExtIos for ChannelMessageSendMetadata {fn into_apns<'a>(self,_sender_id: Option<MacroUserIdStr<'a>>,+ _entity: &Entity<'_>,+ notification_id: Uuid,) -> Option<APNSPushNotification<Self::NotifData>> {let title = match self.common.channel_type {ChannelType::DirectMessage => self.sender.email_part().local_part().to_string(),@@ -485,12 +495,16 @@ impl NotificationExtIos for ChannelMessageSendMetadata {),};let body = parse_message_plain_text(&self.message_content)?;- Some(alert_apns(title, body))+ Some(alert_apns(+ title,+ body,+ PushNotificationData { notification_id },+ ))}}impl NotificationExtIos for ChannelMentionMetadata {- type NotifData = ();+ type NotifData = ::notification::domain::models::apple::PushNotificationData;fn collapse_key(&self, _entity: &Entity<'_>) -> NotifCollapseKey {NotifCollapseKey::new(&self.message_id)@@ -499,6 +513,8 @@ impl NotificationExtIos for ChannelMentionMetadata {fn into_apns<'a>(self,sender_id: Option<MacroUserIdStr<'a>>,+ _entity: &Entity<'_>,+ notification_id: Uuid,) -> Option<APNSPushNotification<Self::NotifData>> {let sender = sender_id?;let title = match self.common.channel_type {@@ -512,12 +528,16 @@ impl NotificationExtIos for ChannelMentionMetadata {),};let body = parse_message_plain_text(&self.message_content)?;- Some(alert_apns(title, body))+ Some(alert_apns(+ title,+ body,+ PushNotificationData { notification_id },+ ))}}impl NotificationExtIos for ChannelReplyMetadata {- type NotifData = ();+ type NotifData = ::notification::domain::models::apple::PushNotificationData;fn collapse_key(&self, _entity: &Entity<'_>) -> NotifCollapseKey {NotifCollapseKey::new(&self.message_id)@@ -526,16 +546,22 @@ impl NotificationExtIos for ChannelReplyMetadata {fn into_apns<'a>(self,sender_id: Option<MacroUserIdStr<'a>>,+ _entity: &Entity<'_>,+ notification_id: Uuid,) -> Option<APNSPushNotification<Self::NotifData>> {let sender = sender_id?;let title = format!("{} Replied", sender.0.email_part().email_str());let body = parse_message_plain_text(&self.message_content)?;- Some(alert_apns(title, body))+ Some(alert_apns(+ title,+ body,+ PushNotificationData { notification_id },+ ))}}impl NotificationExtIos for DocumentMentionMetadata {- type NotifData = ();+ type NotifData = ::notification::domain::models::apple::PushNotificationData;fn collapse_key(&self, entity: &Entity<'_>) -> NotifCollapseKey {let entity_type: &'static str = entity.entity_type.into();@@ -545,12 +571,21 @@ impl NotificationExtIos for DocumentMentionMetadata {fn into_apns<'a>(self,sender_id: Option<MacroUserIdStr<'a>>,+ _entity: &Entity<'_>,+ notification_id: Uuid,) -> Option<APNSPushNotification<Self::NotifData>> {let sender = sender_id?;- let file_type = self.file_type.as_ref()?;+ let file_type_str = self.file_type.as_ref()?;let title = sender.0.email_part().email_str().to_string();- let body = format!("You were mentioned in {}.{}", self.document_name, file_type);- Some(alert_apns(title, body))+ let body = format!(+ "You were mentioned in {}.{}",+ self.document_name, file_type_str+ );+ Some(alert_apns(+ title,+ body,+ PushNotificationData { notification_id },+ ))}}@@ -567,7 +602,7 @@ impl notification::domain::models::Notification for TaskAssignedMetadata {}impl NotificationExtIos for TaskAssignedMetadata {- type NotifData = ();+ type NotifData = ::notification::domain::models::apple::PushNotificationData;fn collapse_key(&self, entity: &Entity<'_>) -> NotifCollapseKey {let entity_type: &'static str = entity.entity_type.into();@@ -577,6 +612,8 @@ impl NotificationExtIos for TaskAssignedMetadata {fn into_apns<'a>(self,_sender_id: Option<MacroUserIdStr<'a>>,+ _entity: &Entity<'_>,+ notification_id: Uuid,) -> Option<APNSPushNotification<Self::NotifData>> {let title = self.assigned_by.email_part().email_str().to_string();let body = if let Some(ref task_name) = self.task_name {@@ -584,18 +621,10 @@ impl NotificationExtIos for TaskAssignedMetadata {} else {"assigned you a task".to_string()};- Some(APNSPushNotification {- aps: Aps {- alert: Some(notification::domain::models::apple::Alert::Dictionary(- AlertDictionary {- title: Some(title),- body: Some(body),- ..Default::default()- },- )),- ..Default::default()- },- push_notification_data: (),- })+ Some(alert_apns(+ title,+ body,+ PushNotificationData { notification_id },+ ))}}diff --git a/rust/cloud-storage/notification/src/domain/models.rs b/rust/cloud-storage/notification/src/domain/models.rsindex c9eff8d03f..6a0fdc2544 100644--- a/rust/cloud-storage/notification/src/domain/models.rs+++ b/rust/cloud-storage/notification/src/domain/models.rs@@ -233,5 +233,7 @@ pub trait NotificationExtIos: Notification {fn into_apns<'a>(self,sender_id: Option<MacroUserIdStr<'a>>,+ entity: &Entity<'_>,+ notification_id: uuid::Uuid,) -> Option<APNSPushNotification<Self::NotifData>>;}diff --git a/rust/cloud-storage/notification/src/domain/models/apple.rs b/rust/cloud-storage/notification/src/domain/models/apple.rsindex 02280363ad..182b062ef0 100644--- a/rust/cloud-storage/notification/src/domain/models/apple.rs+++ b/rust/cloud-storage/notification/src/domain/models/apple.rs@@ -1,6 +1,7 @@//! Apple Push Notification Service (APNS) payload models.use serde::{Deserialize, Serialize};+use uuid::Uuid;/// The APNS payload container.#[derive(Serialize, Debug, Deserialize)]@@ -154,3 +155,12 @@ pub struct APNSPushNotification<T> {#[serde(flatten)]pub push_notification_data: T,}++/// the value we send as the payload in the ios notification+/// This data is accessible to the client+#[derive(Serialize, Deserialize, Debug, Clone)]+#[serde(rename_all = "camelCase")]+pub struct PushNotificationData {+ /// The id of the notification record (UserNotification.id)+ pub notification_id: Uuid,+}diff --git a/rust/cloud-storage/notification/src/domain/models/request.rs b/rust/cloud-storage/notification/src/domain/models/request.rsindex 130b06ff1c..b77d9b8653 100644--- a/rust/cloud-storage/notification/src/domain/models/request.rs+++ b/rust/cloud-storage/notification/src/domain/models/request.rs@@ -46,7 +46,7 @@ impl<'a, T> SendNotificationRequestBuilder<'a, T> {}type BuildApns<T, U> =- Box<dyn FnMut(T) -> Option<(APNSPushNotification<U>, MessageAttributes)> + Send>;+ Box<dyn FnMut(T, uuid::Uuid) -> Option<(APNSPushNotification<U>, MessageAttributes)> + Send>;/// Full notification request with optional delivery channel builders.///@@ -77,13 +77,13 @@ impl<'a, T: NotificationExtIos, U> SendNotificationRequest<'a, T, U> {SendNotificationRequest {req,- build_apns: Some(Box::new(move |notif: T| {+ build_apns: Some(Box::new(move |notif: T, notification_id: uuid::Uuid| {let collapse_key = notif.collapse_key(&entity).into_hashed().into_inner();let attrs = MessageAttributes {push_type: mobile::PushType::Alert,collapse_key,};- let apns = notif.into_apns(sender.clone())?;+ let apns = notif.into_apns(sender.clone(), &entity, notification_id)?;Some((apns, attrs))})),diff --git a/rust/cloud-storage/notification/src/domain/service/ingress.rs b/rust/cloud-storage/notification/src/domain/service/ingress.rsindex 9547a01484..66571d7c96 100644--- a/rust/cloud-storage/notification/src/domain/service/ingress.rs+++ b/rust/cloud-storage/notification/src/domain/service/ingress.rs@@ -417,7 +417,7 @@ whereif !ios_endpoints.is_empty()&& let Some((apns_notif, attributes)) =- build_apns(notification.req.notification.clone())+ build_apns(notification.req.notification.clone(), notification_id){apns_collapse_key = Some(attributes.collapse_key.clone());messages.push(QueueMessage {diff --git a/rust/cloud-storage/notification/src/domain/service/test.rs b/rust/cloud-storage/notification/src/domain/service/test.rsindex 003d749845..d998828e04 100644--- a/rust/cloud-storage/notification/src/domain/service/test.rs+++ b/rust/cloud-storage/notification/src/domain/service/test.rs@@ -58,6 +58,8 @@ impl NotificationExtIos for TestNotification {fn into_apns<'a>(self,_sender: Option<MacroUserIdStr<'a>>,+ _entity: &model_entity::Entity<'_>,+ _notification_id: uuid::Uuid,) -> Option<APNSPushNotification<Self::NotifData>> {Some(APNSPushNotification {aps: Default::default(),diff --git a/rust/cloud-storage/notification_service/src/notification/send/push/mod.rs b/rust/cloud-storage/notification_service/src/notification/send/push/mod.rsindex a90d8752d1..cff961a392 100644--- a/rust/cloud-storage/notification_service/src/notification/send/push/mod.rs+++ b/rust/cloud-storage/notification_service/src/notification/send/push/mod.rs@@ -7,12 +7,12 @@ use uuid::Uuid;pub struct PushNotificationData {/// The id of the notification record (UserNotification.id)pub notification_id: Uuid,- #[serde(flatten)]- pub notification_entity: model_entity::Entity<'static>,- /// user id of the macro user who generated the notification- #[serde(skip_serializing_if = "Option::is_none")]- pub sender_id: Option<String>,- /// The route to open the notification in the app- /// example: /channel/{channel_id}- pub open_route: String,+}++impl PushNotificationData {+ pub fn new_from_inner(val: notification::domain::models::apple::PushNotificationData) -> Self {+ Self {+ notification_id: val.notification_id,+ }+ }}diff --git a/rust/cloud-storage/properties/src/domain/ports.rs b/rust/cloud-storage/properties/src/domain/ports.rsindex 06aefb0b40..100c6ad695 100644--- a/rust/cloud-storage/properties/src/domain/ports.rs+++ b/rust/cloud-storage/properties/src/domain/ports.rs@@ -144,6 +144,10 @@ pub trait NotificationService: Send + Sync + 'static {/// Returns the notification ID if successful.fn send_notification<'a>(&self,- message: SendNotificationRequest<'a, TaskAssignedMetadata, ()>,+ message: SendNotificationRequest<+ 'a,+ TaskAssignedMetadata,+ notification::domain::models::apple::PushNotificationData,+ >,) -> impl Future<Output = Result<uuid::Uuid, Self::Err>> + Send;}diff --git a/rust/cloud-storage/properties/src/outbound/notification_service.rs b/rust/cloud-storage/properties/src/outbound/notification_service.rsindex bf14fb7f30..952b7f81e3 100644--- a/rust/cloud-storage/properties/src/outbound/notification_service.rs+++ b/rust/cloud-storage/properties/src/outbound/notification_service.rs@@ -32,7 +32,11 @@ where#[tracing::instrument(skip(self, message), err)]async fn send_notification(&self,- message: SendNotificationRequest<'_, TaskAssignedMetadata, ()>,+ message: SendNotificationRequest<+ '_,+ TaskAssignedMetadata,+ notification::domain::models::apple::PushNotificationData,+ >,) -> Result<Uuid, Self::Err> {let result = self.notification_client