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.

feat: add static entity (#2887)

Eric Hayes301632ca3e05
diff --git a/js/app/packages/queries/notification/user-notifications.ts b/js/app/packages/queries/notification/user-notifications.ts
index 317cbf895b..ca4c7c71a9 100644
--- a/js/app/packages/queries/notification/user-notifications.ts
+++ b/js/app/packages/queries/notification/user-notifications.ts
@@ -426,7 +426,7 @@ function notificationEntityTypeToSoupTag(
.with('channel', () => 'channel' as const)
.with('project', () => 'project' as const)
.with('email_thread', () => 'emailThread' as const)
- .with(P.union('user', 'team', 'call'), () => null)
+ .with(P.union('user', 'team', 'call', 'static_file'), () => null)
.exhaustive();
}
diff --git a/js/app/packages/service-clients/service-connection/generated/schemas/entityType.ts b/js/app/packages/service-clients/service-connection/generated/schemas/entityType.ts
index d6db9cd1c3..9fd4930034 100644
--- a/js/app/packages/service-clients/service-connection/generated/schemas/entityType.ts
+++ b/js/app/packages/service-clients/service-connection/generated/schemas/entityType.ts
@@ -20,4 +20,5 @@ export const EntityType = {
email_thread: 'email_thread',
team: 'team',
call: 'call',
+ static_file: 'static_file',
} as const;
diff --git a/js/app/packages/service-clients/service-connection/openapi.json b/js/app/packages/service-clients/service-connection/openapi.json
index a5e118dac0..d4adf5ef31 100644
--- a/js/app/packages/service-clients/service-connection/openapi.json
+++ b/js/app/packages/service-clients/service-connection/openapi.json
@@ -237,7 +237,8 @@
"project",
"email_thread",
"team",
- "call"
+ "call",
+ "static_file"
]
},
"GenericErrorResponse": {
diff --git a/js/app/packages/service-clients/service-notification/generated/schemas/entityType.ts b/js/app/packages/service-clients/service-notification/generated/schemas/entityType.ts
index d47fb132ca..c9aa0310c0 100644
--- a/js/app/packages/service-clients/service-notification/generated/schemas/entityType.ts
+++ b/js/app/packages/service-clients/service-notification/generated/schemas/entityType.ts
@@ -20,4 +20,5 @@ export const EntityType = {
email_thread: 'email_thread',
team: 'team',
call: 'call',
+ static_file: 'static_file',
} as const;
diff --git a/js/app/packages/service-clients/service-notification/generated/zod.ts b/js/app/packages/service-clients/service-notification/generated/zod.ts
index 9be269aef9..c653eccfc2 100644
--- a/js/app/packages/service-clients/service-notification/generated/zod.ts
+++ b/js/app/packages/service-clients/service-notification/generated/zod.ts
@@ -116,6 +116,7 @@ export const listTypedNotificationsResponse = zod
'email_thread',
'team',
'call',
+ 'static_file',
])
.describe('The type of an entity in Macro'),
})
@@ -554,6 +555,7 @@ export const bulkGetTypedNotificationsByEventItemIdsResponse = zod
'email_thread',
'team',
'call',
+ 'static_file',
])
.describe('The type of an entity in Macro'),
})
@@ -986,6 +988,7 @@ export const getTypedNotificationsByEventItemIdResponse = zod
'email_thread',
'team',
'call',
+ 'static_file',
])
.describe('The type of an entity in Macro'),
})
@@ -1429,6 +1432,7 @@ export const getTypedNotificationByIdResponse = zod
'email_thread',
'team',
'call',
+ 'static_file',
])
.describe('The type of an entity in Macro'),
})
diff --git a/js/app/packages/service-clients/service-notification/openapi.json b/js/app/packages/service-clients/service-notification/openapi.json
index dd6d697406..a6fcd698e4 100644
--- a/js/app/packages/service-clients/service-notification/openapi.json
+++ b/js/app/packages/service-clients/service-notification/openapi.json
@@ -1453,7 +1453,8 @@
"project",
"email_thread",
"team",
- "call"
+ "call",
+ "static_file"
]
},
"ErrorResponse": {
diff --git a/rust/cloud-storage/entity_access/src/domain/service.rs b/rust/cloud-storage/entity_access/src/domain/service.rs
index fafaf0ba2b..92cf41e019 100644
--- a/rust/cloud-storage/entity_access/src/domain/service.rs
+++ b/rust/cloud-storage/entity_access/src/domain/service.rs
@@ -139,6 +139,8 @@ where
.await
}
EntityType::Channel => self.get_channel_access(entity_id, user_id).await,
+ // Static files are always viewable. This is wrong for owners
+ EntityType::StaticFile => Ok(Some(AccessLevel::View)),
// These entity types don't have access checks implemented yet.
EntityType::Team | EntityType::User => Ok(None),
}
diff --git a/rust/cloud-storage/entity_access_db_utils/src/lib.rs b/rust/cloud-storage/entity_access_db_utils/src/lib.rs
index d63587dd43..3d74967612 100644
--- a/rust/cloud-storage/entity_access_db_utils/src/lib.rs
+++ b/rust/cloud-storage/entity_access_db_utils/src/lib.rs
@@ -220,7 +220,7 @@ pub async fn update_entity_access_channel_share_permissions(
// We need to remove all required items from entity_access for the given entity id for all channels
if !remove_channel_ids.is_empty() {
match entity_type {
- EntityType::User | EntityType::Team | EntityType::Channel => {
+ EntityType::User | EntityType::Team | EntityType::Channel | EntityType::StaticFile => {
unreachable!()
}
EntityType::Project => {
@@ -275,7 +275,7 @@ pub async fn update_entity_access_channel_share_permissions(
// We need to upsert all required items into entity_access for all channels with the desired access level
if !upsert_channel_ids.is_empty() {
match entity_type {
- EntityType::User | EntityType::Team | EntityType::Channel => {
+ EntityType::User | EntityType::Team | EntityType::Channel | EntityType::StaticFile => {
unreachable!()
}
EntityType::Project => {
diff --git a/rust/cloud-storage/macro_db_client/src/item_access/delete.rs b/rust/cloud-storage/macro_db_client/src/item_access/delete.rs
index 39d1e72bf1..d6f10c24c3 100644
--- a/rust/cloud-storage/macro_db_client/src/item_access/delete.rs
+++ b/rust/cloud-storage/macro_db_client/src/item_access/delete.rs
@@ -33,7 +33,7 @@ pub async fn delete_user_entity_access_bulk(
}
let result = match entity_type {
- EntityType::User | EntityType::Team | EntityType::Channel => {
+ EntityType::User | EntityType::Team | EntityType::Channel | EntityType::StaticFile => {
anyhow::bail!("invalid entity type")
}
EntityType::Project => {
diff --git a/rust/cloud-storage/model-entity/src/lib.rs b/rust/cloud-storage/model-entity/src/lib.rs
index 1f349fd3cd..5d5ec2d59a 100644
--- a/rust/cloud-storage/model-entity/src/lib.rs
+++ b/rust/cloud-storage/model-entity/src/lib.rs
@@ -48,6 +48,8 @@ pub enum EntityType {
Team,
/// The entity is a voice/video call
Call,
+ /// A public file in the static file service
+ StaticFile,
}
impl EntityType {
@@ -65,6 +67,7 @@ impl EntityType {
// Calls are handled by entity_access by resolving through the call's
// owning channel (access is inherited from channel membership).
EntityType::Call => true,
+ EntityType::StaticFile => false,
}
}
/// provide an entity string slice to upgrade this type into an [Entity]