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.

Seanaye/feat/soup extra fields (#4824)

Sean Aye0913e7d02e6f
diff --git a/.gitattributes b/.gitattributes
index d9751bb11d..049ad3d68a 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,6 +1,11 @@
# Mark .sqlx files as generated so they're excluded from PR diff stats
**/.sqlx/** linguist-generated=true
+# API clients and schemas are generated from service contracts. Collapse them in
+# PR diffs and exclude them from language stats.
+apps/web/src/lib/service-clients/**/generated/** linguist-generated=true
+apps/web/src/lib/service-clients/**/openapi.json linguist-generated=true
+
# Workflows generated by `cargo x workflows` (xtask). Collapse them in PR diffs
# and exclude from language stats; edit the Rust source, not the YAML.
.github/workflows/code_check_cloud_storage.yml linguist-generated=true
diff --git a/Cargo.lock b/Cargo.lock
index 0287f6c9a9..a44c9f8a2c 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2861,6 +2861,8 @@ dependencies = [
"model-entity",
"model_user",
"models_pagination",
+ "models_properties",
+ "serde",
"soup",
"tokio",
"uuid",
diff --git a/apps/web/src/lib/queries/soup/transform-utils.ts b/apps/web/src/lib/queries/soup/transform-utils.ts
index ec04b05b46..adc33184f0 100644
--- a/apps/web/src/lib/queries/soup/transform-utils.ts
+++ b/apps/web/src/lib/queries/soup/transform-utils.ts
@@ -40,7 +40,6 @@ import type {
import type {
GithubPullRequest,
SoupApiItem,
- SoupDocument,
SoupPage,
} from '@service-storage/generated/schemas';
import type { ChannelType } from '@service-storage/generated/schemas/channelType';
@@ -58,6 +57,7 @@ type InnerSearchResult =
| CallRecordSearchResult;
type DisplayableSoupItem = SoupPage['items'][number];
+type SoupDocument = Extract<DisplayableSoupItem, { tag: 'document' }>['data'];
type SoupEntity =
| DocumentEntity
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/index.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/index.ts
index 5be11740ba..914979f853 100644
--- a/apps/web/src/lib/service-clients/service-storage/generated/schemas/index.ts
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/index.ts
@@ -858,14 +858,16 @@ export * from './soupAttachmentFilename';
export * from './soupAttachmentMimeType';
export * from './soupAttachmentProviderAttachmentId';
export * from './soupAttachmentSizeBytes';
-export * from './soupCallRecord';
-export * from './soupCallRecordChannelName';
-export * from './soupCallRecordCustomName';
-export * from './soupCallRecordDurationMs';
-export * from './soupCallRecordEndedAt';
export * from './soupCallRecordParticipant';
export * from './soupCallRecordParticipantLeftAt';
-export * from './soupCallRecordSummary';
+export * from './soupCallRecordSoupPropertiesField';
+export * from './soupCallRecordSoupPropertiesFieldAllOf';
+export * from './soupCallRecordSoupPropertiesFieldAllOfTwo';
+export * from './soupCallRecordSoupPropertiesFieldAllOfTwoChannelName';
+export * from './soupCallRecordSoupPropertiesFieldAllOfTwoCustomName';
+export * from './soupCallRecordSoupPropertiesFieldAllOfTwoDurationMs';
+export * from './soupCallRecordSoupPropertiesFieldAllOfTwoEndedAt';
+export * from './soupCallRecordSoupPropertiesFieldAllOfTwoSummary';
export * from './soupChannel';
export * from './soupChannelAllOf';
export * from './soupChannelAllOfInteractedAt';
@@ -873,35 +875,41 @@ export * from './soupChannelAllOfViewedAt';
export * from './soupChannelThread';
export * from './soupChannelThreadDeletedAt';
export * from './soupChannelThreadEditedAt';
-export * from './soupChat';
-export * from './soupChatDeletedAt';
-export * from './soupChatProjectId';
-export * from './soupChatViewedAt';
+export * from './soupChatSoupPropertiesField';
+export * from './soupChatSoupPropertiesFieldAllOf';
+export * from './soupChatSoupPropertiesFieldAllOfTwo';
+export * from './soupChatSoupPropertiesFieldAllOfTwoDeletedAt';
+export * from './soupChatSoupPropertiesFieldAllOfTwoProjectId';
+export * from './soupChatSoupPropertiesFieldAllOfTwoViewedAt';
export * from './soupContact';
export * from './soupContactEmailAddress';
export * from './soupContactName';
export * from './soupContactSfsPhotoUrl';
export * from './soupCountedReaction';
-export * from './soupCrmCompany';
-export * from './soupCrmCompanyDescription';
-export * from './soupCrmCompanyName';
-export * from './soupCrmCompanyViewedAt';
+export * from './soupCrmCompanySoupPropertiesField';
+export * from './soupCrmCompanySoupPropertiesFieldAllOf';
+export * from './soupCrmCompanySoupPropertiesFieldAllOfTwo';
+export * from './soupCrmCompanySoupPropertiesFieldAllOfTwoDescription';
+export * from './soupCrmCompanySoupPropertiesFieldAllOfTwoName';
+export * from './soupCrmCompanySoupPropertiesFieldAllOfTwoViewedAt';
export * from './soupCrmDomain';
-export * from './soupDocument';
-export * from './soupDocumentBranchedFromId';
-export * from './soupDocumentBranchedFromVersionId';
-export * from './soupDocumentDeletedAt';
-export * from './soupDocumentDocumentFamilyId';
-export * from './soupDocumentFileType';
-export * from './soupDocumentProjectId';
-export * from './soupDocumentSha';
+export * from './soupDocumentSoupPropertiesField';
+export * from './soupDocumentSoupPropertiesFieldAllOf';
+export * from './soupDocumentSoupPropertiesFieldAllOfTwo';
+export * from './soupDocumentSoupPropertiesFieldAllOfTwoBranchedFromId';
+export * from './soupDocumentSoupPropertiesFieldAllOfTwoBranchedFromVersionId';
+export * from './soupDocumentSoupPropertiesFieldAllOfTwoDeletedAt';
+export * from './soupDocumentSoupPropertiesFieldAllOfTwoDocumentFamilyId';
+export * from './soupDocumentSoupPropertiesFieldAllOfTwoFileType';
+export * from './soupDocumentSoupPropertiesFieldAllOfTwoProjectId';
+export * from './soupDocumentSoupPropertiesFieldAllOfTwoSha';
+export * from './soupDocumentSoupPropertiesFieldAllOfTwoSubType';
+export * from './soupDocumentSoupPropertiesFieldAllOfTwoViewedAt';
export * from './soupDocumentSubType';
export * from './soupDocumentSubTypeOneOf';
export * from './soupDocumentSubTypeOneOfThree';
export * from './soupDocumentSubTypeOneOfThreeType';
export * from './soupDocumentSubTypeOneOfType';
-export * from './soupDocumentSubTypeProperty';
-export * from './soupDocumentViewedAt';
export * from './soupEmailThreadPreview';
export * from './soupEmailThreadPreviewName';
export * from './soupEmailThreadPreviewProjectId';
@@ -911,8 +919,9 @@ export * from './soupEmailThreadPreviewSenderName';
export * from './soupEmailThreadPreviewSenderPhotoUrl';
export * from './soupEmailThreadPreviewSnippet';
export * from './soupEmailThreadPreviewViewedAt';
-export * from './soupEnrichedEmailThreadPreview';
-export * from './soupEnrichedEmailThreadPreviewAllOf';
+export * from './soupEnrichedEmailThreadPreviewSoupPropertiesField';
+export * from './soupEnrichedEmailThreadPreviewSoupPropertiesFieldAllOf';
+export * from './soupEnrichedEmailThreadPreviewSoupPropertiesFieldAllOfTwo';
export * from './soupForeignEntity';
export * from './soupForeignEntityMetadata';
export * from './soupItem';
@@ -947,10 +956,13 @@ export * from './soupMessageSenderName';
export * from './soupMessageSenderType';
export * from './soupPage';
export * from './soupPageNextCursor';
-export * from './soupProject';
-export * from './soupProjectDeletedAt';
-export * from './soupProjectParentId';
-export * from './soupProjectViewedAt';
+export * from './soupProjectSoupPropertiesField';
+export * from './soupProjectSoupPropertiesFieldAllOf';
+export * from './soupProjectSoupPropertiesFieldAllOfTwo';
+export * from './soupProjectSoupPropertiesFieldAllOfTwoDeletedAt';
+export * from './soupProjectSoupPropertiesFieldAllOfTwoParentId';
+export * from './soupProjectSoupPropertiesFieldAllOfTwoViewedAt';
+export * from './soupPropertiesField';
export * from './soupProperty';
export * from './soupPropertyValue';
export * from './soupThreadInfo';
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCallRecordSoupPropertiesField.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCallRecordSoupPropertiesField.ts
new file mode 100644
index 0000000000..1f2fc55af3
--- /dev/null
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCallRecordSoupPropertiesField.ts
@@ -0,0 +1,16 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+import type { SoupCallRecordSoupPropertiesFieldAllOf } from './soupCallRecordSoupPropertiesFieldAllOf';
+import type { SoupCallRecordSoupPropertiesFieldAllOfTwo } from './soupCallRecordSoupPropertiesFieldAllOfTwo';
+
+/**
+ * A call record as displayed in Soup. Excludes room_name, egress_id,
+and transcript — fields that are irrelevant for the soup feed.
+ */
+export type SoupCallRecordSoupPropertiesField =
+ SoupCallRecordSoupPropertiesFieldAllOf &
+ SoupCallRecordSoupPropertiesFieldAllOfTwo;
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCallRecordSoupPropertiesFieldAllOf.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCallRecordSoupPropertiesFieldAllOf.ts
new file mode 100644
index 0000000000..5f824da56f
--- /dev/null
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCallRecordSoupPropertiesFieldAllOf.ts
@@ -0,0 +1,15 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+import type { SoupProperty } from './soupProperty';
+
+/**
+ * Property fields that can be flattened into property-bearing Soup items.
+ */
+export type SoupCallRecordSoupPropertiesFieldAllOf = {
+ /** Properties attached to the entity. */
+ properties: SoupProperty[];
+};
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCallRecord.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCallRecordSoupPropertiesFieldAllOfTwo.ts
similarity index 54%
rename from apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCallRecord.ts
rename to apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCallRecordSoupPropertiesFieldAllOfTwo.ts
index a3ae1d59a5..2c00f459d6 100644
--- a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCallRecord.ts
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCallRecordSoupPropertiesFieldAllOfTwo.ts
@@ -6,19 +6,14 @@
*/
import type { CallStatus } from './callStatus';
-import type { SoupCallRecordChannelName } from './soupCallRecordChannelName';
-import type { SoupCallRecordCustomName } from './soupCallRecordCustomName';
-import type { SoupCallRecordDurationMs } from './soupCallRecordDurationMs';
-import type { SoupCallRecordEndedAt } from './soupCallRecordEndedAt';
import type { SoupCallRecordParticipant } from './soupCallRecordParticipant';
-import type { SoupCallRecordSummary } from './soupCallRecordSummary';
-import type { SoupProperty } from './soupProperty';
+import type { SoupCallRecordSoupPropertiesFieldAllOfTwoChannelName } from './soupCallRecordSoupPropertiesFieldAllOfTwoChannelName';
+import type { SoupCallRecordSoupPropertiesFieldAllOfTwoCustomName } from './soupCallRecordSoupPropertiesFieldAllOfTwoCustomName';
+import type { SoupCallRecordSoupPropertiesFieldAllOfTwoDurationMs } from './soupCallRecordSoupPropertiesFieldAllOfTwoDurationMs';
+import type { SoupCallRecordSoupPropertiesFieldAllOfTwoEndedAt } from './soupCallRecordSoupPropertiesFieldAllOfTwoEndedAt';
+import type { SoupCallRecordSoupPropertiesFieldAllOfTwoSummary } from './soupCallRecordSoupPropertiesFieldAllOfTwoSummary';
-/**
- * A call record as displayed in Soup. Excludes room_name, egress_id,
-and transcript — fields that are irrelevant for the soup feed.
- */
-export interface SoupCallRecord {
+export type SoupCallRecordSoupPropertiesFieldAllOfTwo = {
/** Whether the requesting user attended this call. Kept for compatibility
and derived from `status == ATTENDED`. */
attended: boolean;
@@ -27,21 +22,19 @@ and derived from `status == ATTENDED`. */
/** The channel this call belongs to. */
channelId: string;
/** Resolved display name for the channel. */
- channelName?: SoupCallRecordChannelName;
+ channelName?: SoupCallRecordSoupPropertiesFieldAllOfTwoChannelName;
/** User who created the call. */
createdBy: string;
/** User-supplied or AI-generated display name for the call. */
- customName?: SoupCallRecordCustomName;
+ customName?: SoupCallRecordSoupPropertiesFieldAllOfTwoCustomName;
/** Call duration in milliseconds (None if still active). */
- durationMs?: SoupCallRecordDurationMs;
+ durationMs?: SoupCallRecordSoupPropertiesFieldAllOfTwoDurationMs;
/** When the call ended (None if still active). */
- endedAt?: SoupCallRecordEndedAt;
+ endedAt?: SoupCallRecordSoupPropertiesFieldAllOfTwoEndedAt;
/** Whether the call is currently active. */
isActive: boolean;
/** Participants in the call. */
participants: SoupCallRecordParticipant[];
- /** Entity properties (e.g. tags). Populated after fetch by the soup repo. */
- properties: SoupProperty[];
/** When the call started. */
startedAt: string;
/** Viewer-relative call status for the requesting user. */
@@ -49,5 +42,5 @@ and derived from `status == ATTENDED`. */
/** AI-generated summary of the call. Only set on archived
`call_records` once summarization has run; active calls always
return `None`. */
- summary?: SoupCallRecordSummary;
-}
+ summary?: SoupCallRecordSoupPropertiesFieldAllOfTwoSummary;
+};
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCallRecordChannelName.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCallRecordSoupPropertiesFieldAllOfTwoChannelName.ts
similarity index 66%
rename from apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCallRecordChannelName.ts
rename to apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCallRecordSoupPropertiesFieldAllOfTwoChannelName.ts
index 2ceae5c56c..81ce63c43e 100644
--- a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCallRecordChannelName.ts
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCallRecordSoupPropertiesFieldAllOfTwoChannelName.ts
@@ -8,4 +8,6 @@
/**
* Resolved display name for the channel.
*/
-export type SoupCallRecordChannelName = string | null;
+export type SoupCallRecordSoupPropertiesFieldAllOfTwoChannelName =
+ | string
+ | null;
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCallRecordCustomName.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCallRecordSoupPropertiesFieldAllOfTwoCustomName.ts
similarity index 70%
rename from apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCallRecordCustomName.ts
rename to apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCallRecordSoupPropertiesFieldAllOfTwoCustomName.ts
index bdf98e3da5..6d411387fe 100644
--- a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCallRecordCustomName.ts
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCallRecordSoupPropertiesFieldAllOfTwoCustomName.ts
@@ -8,4 +8,4 @@
/**
* User-supplied or AI-generated display name for the call.
*/
-export type SoupCallRecordCustomName = string | null;
+export type SoupCallRecordSoupPropertiesFieldAllOfTwoCustomName = string | null;
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCallRecordDurationMs.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCallRecordSoupPropertiesFieldAllOfTwoDurationMs.ts
similarity index 70%
rename from apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCallRecordDurationMs.ts
rename to apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCallRecordSoupPropertiesFieldAllOfTwoDurationMs.ts
index 99901ff0f6..4081033688 100644
--- a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCallRecordDurationMs.ts
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCallRecordSoupPropertiesFieldAllOfTwoDurationMs.ts
@@ -8,4 +8,4 @@
/**
* Call duration in milliseconds (None if still active).
*/
-export type SoupCallRecordDurationMs = number | null;
+export type SoupCallRecordSoupPropertiesFieldAllOfTwoDurationMs = number | null;
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCallRecordEndedAt.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCallRecordSoupPropertiesFieldAllOfTwoEndedAt.ts
similarity index 70%
rename from apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCallRecordEndedAt.ts
rename to apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCallRecordSoupPropertiesFieldAllOfTwoEndedAt.ts
index 0e784f3813..9a6376dd04 100644
--- a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCallRecordEndedAt.ts
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCallRecordSoupPropertiesFieldAllOfTwoEndedAt.ts
@@ -8,4 +8,4 @@
/**
* When the call ended (None if still active).
*/
-export type SoupCallRecordEndedAt = string | null;
+export type SoupCallRecordSoupPropertiesFieldAllOfTwoEndedAt = string | null;
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCallRecordSummary.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCallRecordSoupPropertiesFieldAllOfTwoSummary.ts
similarity index 77%
rename from apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCallRecordSummary.ts
rename to apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCallRecordSoupPropertiesFieldAllOfTwoSummary.ts
index e8fe4e19eb..31a3d5c805 100644
--- a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCallRecordSummary.ts
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCallRecordSoupPropertiesFieldAllOfTwoSummary.ts
@@ -10,4 +10,4 @@
`call_records` once summarization has run; active calls always
return `None`.
*/
-export type SoupCallRecordSummary = string | null;
+export type SoupCallRecordSoupPropertiesFieldAllOfTwoSummary = string | null;
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupChat.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupChat.ts
deleted file mode 100644
index 33ae67a09f..0000000000
--- a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupChat.ts
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- * Generated by orval v7.21.0 🍺
- * Do not edit manually.
- * document_storage_service
- * OpenAPI spec version: 0.1.0
- */
-import type { SoupChatDeletedAt } from './soupChatDeletedAt';
-import type { SoupChatProjectId } from './soupChatProjectId';
-import type { SoupChatViewedAt } from './soupChatViewedAt';
-import type { SoupProperty } from './soupProperty';
-
-/**
- * A chat as displayed in Soup.
- */
-export interface SoupChat {
- /** The time the chat was created */
- createdAt: string;
- /** The time the chat was deleted */
- deletedAt?: SoupChatDeletedAt;
- /** The chat uuid */
- id: string;
- /** Whether the chat is persistent or not */
- isPersistent: boolean;
- /** The name of the chat */
- name: string;
- /** Who the chat belongs to */
- ownerId: string;
- /** The project id of the chat */
- projectId?: SoupChatProjectId;
- /** Properties */
- properties: SoupProperty[];
- /** The time the chat was last updated */
- updatedAt: string;
- /** The time the chat was last viewed */
- viewedAt?: SoupChatViewedAt;
-}
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupChatSoupPropertiesField.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupChatSoupPropertiesField.ts
new file mode 100644
index 0000000000..f70f48a0a5
--- /dev/null
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupChatSoupPropertiesField.ts
@@ -0,0 +1,14 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+import type { SoupChatSoupPropertiesFieldAllOf } from './soupChatSoupPropertiesFieldAllOf';
+import type { SoupChatSoupPropertiesFieldAllOfTwo } from './soupChatSoupPropertiesFieldAllOfTwo';
+
+/**
+ * A chat as displayed in Soup.
+ */
+export type SoupChatSoupPropertiesField = SoupChatSoupPropertiesFieldAllOf &
+ SoupChatSoupPropertiesFieldAllOfTwo;
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupChatSoupPropertiesFieldAllOf.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupChatSoupPropertiesFieldAllOf.ts
new file mode 100644
index 0000000000..4fef342dfe
--- /dev/null
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupChatSoupPropertiesFieldAllOf.ts
@@ -0,0 +1,15 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+import type { SoupProperty } from './soupProperty';
+
+/**
+ * Property fields that can be flattened into property-bearing Soup items.
+ */
+export type SoupChatSoupPropertiesFieldAllOf = {
+ /** Properties attached to the entity. */
+ properties: SoupProperty[];
+};
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupChatSoupPropertiesFieldAllOfTwo.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupChatSoupPropertiesFieldAllOfTwo.ts
new file mode 100644
index 0000000000..34777ae5f2
--- /dev/null
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupChatSoupPropertiesFieldAllOfTwo.ts
@@ -0,0 +1,30 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+import type { SoupChatSoupPropertiesFieldAllOfTwoDeletedAt } from './soupChatSoupPropertiesFieldAllOfTwoDeletedAt';
+import type { SoupChatSoupPropertiesFieldAllOfTwoProjectId } from './soupChatSoupPropertiesFieldAllOfTwoProjectId';
+import type { SoupChatSoupPropertiesFieldAllOfTwoViewedAt } from './soupChatSoupPropertiesFieldAllOfTwoViewedAt';
+
+export type SoupChatSoupPropertiesFieldAllOfTwo = {
+ /** The time the chat was created */
+ createdAt: string;
+ /** The time the chat was deleted */
+ deletedAt?: SoupChatSoupPropertiesFieldAllOfTwoDeletedAt;
+ /** The chat uuid */
+ id: string;
+ /** Whether the chat is persistent or not */
+ isPersistent: boolean;
+ /** The name of the chat */
+ name: string;
+ /** Who the chat belongs to */
+ ownerId: string;
+ /** The project id of the chat */
+ projectId?: SoupChatSoupPropertiesFieldAllOfTwoProjectId;
+ /** The time the chat was last updated */
+ updatedAt: string;
+ /** The time the chat was last viewed */
+ viewedAt?: SoupChatSoupPropertiesFieldAllOfTwoViewedAt;
+};
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupChatDeletedAt.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupChatSoupPropertiesFieldAllOfTwoDeletedAt.ts
similarity index 69%
rename from apps/web/src/lib/service-clients/service-storage/generated/schemas/soupChatDeletedAt.ts
rename to apps/web/src/lib/service-clients/service-storage/generated/schemas/soupChatSoupPropertiesFieldAllOfTwoDeletedAt.ts
index c9f03ac9b6..a5c7e1ecec 100644
--- a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupChatDeletedAt.ts
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupChatSoupPropertiesFieldAllOfTwoDeletedAt.ts
@@ -8,4 +8,4 @@
/**
* The time the chat was deleted
*/
-export type SoupChatDeletedAt = string | null;
+export type SoupChatSoupPropertiesFieldAllOfTwoDeletedAt = string | null;
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupChatProjectId.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupChatSoupPropertiesFieldAllOfTwoProjectId.ts
similarity index 69%
rename from apps/web/src/lib/service-clients/service-storage/generated/schemas/soupChatProjectId.ts
rename to apps/web/src/lib/service-clients/service-storage/generated/schemas/soupChatSoupPropertiesFieldAllOfTwoProjectId.ts
index 4e3d1dedcd..b24463d81c 100644
--- a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupChatProjectId.ts
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupChatSoupPropertiesFieldAllOfTwoProjectId.ts
@@ -8,4 +8,4 @@
/**
* The project id of the chat
*/
-export type SoupChatProjectId = string | null;
+export type SoupChatSoupPropertiesFieldAllOfTwoProjectId = string | null;
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupChatViewedAt.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupChatSoupPropertiesFieldAllOfTwoViewedAt.ts
similarity index 70%
rename from apps/web/src/lib/service-clients/service-storage/generated/schemas/soupChatViewedAt.ts
rename to apps/web/src/lib/service-clients/service-storage/generated/schemas/soupChatSoupPropertiesFieldAllOfTwoViewedAt.ts
index fdb542151f..ed640b8c32 100644
--- a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupChatViewedAt.ts
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupChatSoupPropertiesFieldAllOfTwoViewedAt.ts
@@ -8,4 +8,4 @@
/**
* The time the chat was last viewed
*/
-export type SoupChatViewedAt = string | null;
+export type SoupChatSoupPropertiesFieldAllOfTwoViewedAt = string | null;
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCrmCompanySoupPropertiesField.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCrmCompanySoupPropertiesField.ts
new file mode 100644
index 0000000000..ac3c249278
--- /dev/null
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCrmCompanySoupPropertiesField.ts
@@ -0,0 +1,17 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+import type { SoupCrmCompanySoupPropertiesFieldAllOf } from './soupCrmCompanySoupPropertiesFieldAllOf';
+import type { SoupCrmCompanySoupPropertiesFieldAllOfTwo } from './soupCrmCompanySoupPropertiesFieldAllOfTwo';
+
+/**
+ * A CRM company as displayed in Soup. Carries the core company
+fields plus display metadata resolved from `crm_domain_directory`
+against the primary (earliest-created) domain.
+ */
+export type SoupCrmCompanySoupPropertiesField =
+ SoupCrmCompanySoupPropertiesFieldAllOf &
+ SoupCrmCompanySoupPropertiesFieldAllOfTwo;
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCrmCompanySoupPropertiesFieldAllOf.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCrmCompanySoupPropertiesFieldAllOf.ts
new file mode 100644
index 0000000000..b57322b7e5
--- /dev/null
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCrmCompanySoupPropertiesFieldAllOf.ts
@@ -0,0 +1,15 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+import type { SoupProperty } from './soupProperty';
+
+/**
+ * Property fields that can be flattened into property-bearing Soup items.
+ */
+export type SoupCrmCompanySoupPropertiesFieldAllOf = {
+ /** Properties attached to the entity. */
+ properties: SoupProperty[];
+};
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCrmCompany.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCrmCompanySoupPropertiesFieldAllOfTwo.ts
similarity index 58%
rename from apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCrmCompany.ts
rename to apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCrmCompanySoupPropertiesFieldAllOfTwo.ts
index 1c1cc18d3f..930e4f1619 100644
--- a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCrmCompany.ts
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCrmCompanySoupPropertiesFieldAllOfTwo.ts
@@ -4,22 +4,16 @@
* document_storage_service
* OpenAPI spec version: 0.1.0
*/
-import type { SoupCrmCompanyDescription } from './soupCrmCompanyDescription';
-import type { SoupCrmCompanyName } from './soupCrmCompanyName';
-import type { SoupCrmCompanyViewedAt } from './soupCrmCompanyViewedAt';
+import type { SoupCrmCompanySoupPropertiesFieldAllOfTwoDescription } from './soupCrmCompanySoupPropertiesFieldAllOfTwoDescription';
+import type { SoupCrmCompanySoupPropertiesFieldAllOfTwoName } from './soupCrmCompanySoupPropertiesFieldAllOfTwoName';
+import type { SoupCrmCompanySoupPropertiesFieldAllOfTwoViewedAt } from './soupCrmCompanySoupPropertiesFieldAllOfTwoViewedAt';
import type { SoupCrmDomain } from './soupCrmDomain';
-import type { SoupProperty } from './soupProperty';
-/**
- * A CRM company as displayed in Soup. Carries the core company
-fields plus display metadata resolved from `crm_domain_directory`
-against the primary (earliest-created) domain.
- */
-export interface SoupCrmCompany {
+export type SoupCrmCompanySoupPropertiesFieldAllOfTwo = {
/** When the company was created. */
createdAt: string;
/** Display description from the primary domain's directory entry. */
- description?: SoupCrmCompanyDescription;
+ description?: SoupCrmCompanySoupPropertiesFieldAllOfTwoDescription;
/** Domains associated with this company, ordered by creation time
ascending (primary first). */
domains: SoupCrmDomain[];
@@ -32,15 +26,12 @@ these out by default. */
id: string;
/** Display name from the primary domain's directory entry, or
`None` when unresolved. */
- name?: SoupCrmCompanyName;
- /** Properties attached to this company (system CRM properties like
-Stage / Owner / Revenue plus any custom ones). */
- properties?: SoupProperty[];
+ name?: SoupCrmCompanySoupPropertiesFieldAllOfTwoName;
/** The id of the team that owns this company record. */
teamId: string;
/** When the company was last updated. */
updatedAt: string;
/** When the requesting user last viewed this company, or `None` if
never viewed. Mirrors the `viewed_at` other soup entities carry. */
- viewedAt?: SoupCrmCompanyViewedAt;
-}
+ viewedAt?: SoupCrmCompanySoupPropertiesFieldAllOfTwoViewedAt;
+};
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCrmCompanyDescription.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCrmCompanySoupPropertiesFieldAllOfTwoDescription.ts
similarity index 69%
rename from apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCrmCompanyDescription.ts
rename to apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCrmCompanySoupPropertiesFieldAllOfTwoDescription.ts
index 1cc232bd46..1d0dc0b088 100644
--- a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCrmCompanyDescription.ts
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCrmCompanySoupPropertiesFieldAllOfTwoDescription.ts
@@ -8,4 +8,6 @@
/**
* Display description from the primary domain's directory entry.
*/
-export type SoupCrmCompanyDescription = string | null;
+export type SoupCrmCompanySoupPropertiesFieldAllOfTwoDescription =
+ | string
+ | null;
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCrmCompanyName.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCrmCompanySoupPropertiesFieldAllOfTwoName.ts
similarity index 74%
rename from apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCrmCompanyName.ts
rename to apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCrmCompanySoupPropertiesFieldAllOfTwoName.ts
index c3206846e8..e133319fba 100644
--- a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCrmCompanyName.ts
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCrmCompanySoupPropertiesFieldAllOfTwoName.ts
@@ -9,4 +9,4 @@
* Display name from the primary domain's directory entry, or
`None` when unresolved.
*/
-export type SoupCrmCompanyName = string | null;
+export type SoupCrmCompanySoupPropertiesFieldAllOfTwoName = string | null;
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCrmCompanyViewedAt.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCrmCompanySoupPropertiesFieldAllOfTwoViewedAt.ts
similarity index 77%
rename from apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCrmCompanyViewedAt.ts
rename to apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCrmCompanySoupPropertiesFieldAllOfTwoViewedAt.ts
index d41026c190..af34c642f9 100644
--- a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCrmCompanyViewedAt.ts
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupCrmCompanySoupPropertiesFieldAllOfTwoViewedAt.ts
@@ -9,4 +9,4 @@
* When the requesting user last viewed this company, or `None` if
never viewed. Mirrors the `viewed_at` other soup entities carry.
*/
-export type SoupCrmCompanyViewedAt = string | null;
+export type SoupCrmCompanySoupPropertiesFieldAllOfTwoViewedAt = string | null;
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocument.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocument.ts
deleted file mode 100644
index c9b23e63a8..0000000000
--- a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocument.ts
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
- * Generated by orval v7.21.0 🍺
- * Do not edit manually.
- * document_storage_service
- * OpenAPI spec version: 0.1.0
- */
-import type { SoupDocumentBranchedFromId } from './soupDocumentBranchedFromId';
-import type { SoupDocumentBranchedFromVersionId } from './soupDocumentBranchedFromVersionId';
-import type { SoupDocumentDeletedAt } from './soupDocumentDeletedAt';
-import type { SoupDocumentDocumentFamilyId } from './soupDocumentDocumentFamilyId';
-import type { SoupDocumentFileType } from './soupDocumentFileType';
-import type { SoupDocumentProjectId } from './soupDocumentProjectId';
-import type { SoupDocumentSha } from './soupDocumentSha';
-import type { SoupDocumentSubTypeProperty } from './soupDocumentSubTypeProperty';
-import type { SoupDocumentViewedAt } from './soupDocumentViewedAt';
-import type { SoupProperty } from './soupProperty';
-
-/**
- * A document as displayed in Soup.
- */
-export interface SoupDocument {
- /** The id of the document this document branched from */
- branchedFromId?: SoupDocumentBranchedFromId;
- /** The id of the version this document branched from
-This could be either DocumentInstance or DocumentBom id depending on the file type */
- branchedFromVersionId?: SoupDocumentBranchedFromVersionId;
- /** The time the document was created */
- createdAt: string;
- /** The time the document was deleted */
- deletedAt?: SoupDocumentDeletedAt;
- /** The id of the document family this document belongs to */
- documentFamilyId?: SoupDocumentDocumentFamilyId;
- /** The version of the document
-This could be the document_instance_id or document_bom_id depending on the file type */
- documentVersionId: number;
- /** The file type of the document (e.g. pdf, docx) */
- fileType?: SoupDocumentFileType;
- /** The document id */
- id: string;
- /** The name of the document */
- name: string;
- /** The owner of the document */
- ownerId: string;
- /** The id of the project that this document belongs to */
- projectId?: SoupDocumentProjectId;
- /** Properties */
- properties: SoupProperty[];
- /** If the document is a PDF, this is the SHA of the pdf
-If the document is a DOCX, this will not be present */
- sha?: SoupDocumentSha;
- subType?: SoupDocumentSubTypeProperty;
- /** The time the document instance / document BOM was updated */
- updatedAt: string;
- /** The time the document was last viewed */
- viewedAt?: SoupDocumentViewedAt;
-}
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentSoupPropertiesField.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentSoupPropertiesField.ts
new file mode 100644
index 0000000000..bd19164161
--- /dev/null
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentSoupPropertiesField.ts
@@ -0,0 +1,15 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+import type { SoupDocumentSoupPropertiesFieldAllOf } from './soupDocumentSoupPropertiesFieldAllOf';
+import type { SoupDocumentSoupPropertiesFieldAllOfTwo } from './soupDocumentSoupPropertiesFieldAllOfTwo';
+
+/**
+ * A document as displayed in Soup.
+ */
+export type SoupDocumentSoupPropertiesField =
+ SoupDocumentSoupPropertiesFieldAllOf &
+ SoupDocumentSoupPropertiesFieldAllOfTwo;
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentSoupPropertiesFieldAllOf.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentSoupPropertiesFieldAllOf.ts
new file mode 100644
index 0000000000..07d3ea75ad
--- /dev/null
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentSoupPropertiesFieldAllOf.ts
@@ -0,0 +1,15 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+import type { SoupProperty } from './soupProperty';
+
+/**
+ * Property fields that can be flattened into property-bearing Soup items.
+ */
+export type SoupDocumentSoupPropertiesFieldAllOf = {
+ /** Properties attached to the entity. */
+ properties: SoupProperty[];
+};
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentSoupPropertiesFieldAllOfTwo.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentSoupPropertiesFieldAllOfTwo.ts
new file mode 100644
index 0000000000..a10854fd55
--- /dev/null
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentSoupPropertiesFieldAllOfTwo.ts
@@ -0,0 +1,50 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+import type { SoupDocumentSoupPropertiesFieldAllOfTwoBranchedFromId } from './soupDocumentSoupPropertiesFieldAllOfTwoBranchedFromId';
+import type { SoupDocumentSoupPropertiesFieldAllOfTwoBranchedFromVersionId } from './soupDocumentSoupPropertiesFieldAllOfTwoBranchedFromVersionId';
+import type { SoupDocumentSoupPropertiesFieldAllOfTwoDeletedAt } from './soupDocumentSoupPropertiesFieldAllOfTwoDeletedAt';
+import type { SoupDocumentSoupPropertiesFieldAllOfTwoDocumentFamilyId } from './soupDocumentSoupPropertiesFieldAllOfTwoDocumentFamilyId';
+import type { SoupDocumentSoupPropertiesFieldAllOfTwoFileType } from './soupDocumentSoupPropertiesFieldAllOfTwoFileType';
+import type { SoupDocumentSoupPropertiesFieldAllOfTwoProjectId } from './soupDocumentSoupPropertiesFieldAllOfTwoProjectId';
+import type { SoupDocumentSoupPropertiesFieldAllOfTwoSha } from './soupDocumentSoupPropertiesFieldAllOfTwoSha';
+import type { SoupDocumentSoupPropertiesFieldAllOfTwoSubType } from './soupDocumentSoupPropertiesFieldAllOfTwoSubType';
+import type { SoupDocumentSoupPropertiesFieldAllOfTwoViewedAt } from './soupDocumentSoupPropertiesFieldAllOfTwoViewedAt';
+
+export type SoupDocumentSoupPropertiesFieldAllOfTwo = {
+ /** The id of the document this document branched from */
+ branchedFromId?: SoupDocumentSoupPropertiesFieldAllOfTwoBranchedFromId;
+ /** The id of the version this document branched from
+This could be either DocumentInstance or DocumentBom id depending on the file type */
+ branchedFromVersionId?: SoupDocumentSoupPropertiesFieldAllOfTwoBranchedFromVersionId;
+ /** The time the document was created */
+ createdAt: string;
+ /** The time the document was deleted */
+ deletedAt?: SoupDocumentSoupPropertiesFieldAllOfTwoDeletedAt;
+ /** The id of the document family this document belongs to */
+ documentFamilyId?: SoupDocumentSoupPropertiesFieldAllOfTwoDocumentFamilyId;
+ /** The version of the document
+This could be the document_instance_id or document_bom_id depending on the file type */
+ documentVersionId: number;
+ /** The file type of the document (e.g. pdf, docx) */
+ fileType?: SoupDocumentSoupPropertiesFieldAllOfTwoFileType;
+ /** The document id */
+ id: string;
+ /** The name of the document */
+ name: string;
+ /** The owner of the document */
+ ownerId: string;
+ /** The id of the project that this document belongs to */
+ projectId?: SoupDocumentSoupPropertiesFieldAllOfTwoProjectId;
+ /** If the document is a PDF, this is the SHA of the pdf
+If the document is a DOCX, this will not be present */
+ sha?: SoupDocumentSoupPropertiesFieldAllOfTwoSha;
+ subType?: SoupDocumentSoupPropertiesFieldAllOfTwoSubType;
+ /** The time the document instance / document BOM was updated */
+ updatedAt: string;
+ /** The time the document was last viewed */
+ viewedAt?: SoupDocumentSoupPropertiesFieldAllOfTwoViewedAt;
+};
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentBranchedFromId.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentSoupPropertiesFieldAllOfTwoBranchedFromId.ts
similarity index 68%
rename from apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentBranchedFromId.ts
rename to apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentSoupPropertiesFieldAllOfTwoBranchedFromId.ts
index 11b400c9ec..1c05221f9c 100644
--- a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentBranchedFromId.ts
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentSoupPropertiesFieldAllOfTwoBranchedFromId.ts
@@ -8,4 +8,6 @@
/**
* The id of the document this document branched from
*/
-export type SoupDocumentBranchedFromId = string | null;
+export type SoupDocumentSoupPropertiesFieldAllOfTwoBranchedFromId =
+ | string
+ | null;
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentBranchedFromVersionId.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentSoupPropertiesFieldAllOfTwoBranchedFromVersionId.ts
similarity index 73%
rename from apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentBranchedFromVersionId.ts
rename to apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentSoupPropertiesFieldAllOfTwoBranchedFromVersionId.ts
index 7378e596b9..35ca8e8924 100644
--- a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentBranchedFromVersionId.ts
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentSoupPropertiesFieldAllOfTwoBranchedFromVersionId.ts
@@ -9,4 +9,6 @@
* The id of the version this document branched from
This could be either DocumentInstance or DocumentBom id depending on the file type
*/
-export type SoupDocumentBranchedFromVersionId = number | null;
+export type SoupDocumentSoupPropertiesFieldAllOfTwoBranchedFromVersionId =
+ | number
+ | null;
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentDeletedAt.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentSoupPropertiesFieldAllOfTwoDeletedAt.ts
similarity index 68%
rename from apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentDeletedAt.ts
rename to apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentSoupPropertiesFieldAllOfTwoDeletedAt.ts
index bd0cd66eb2..fb7596b982 100644
--- a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentDeletedAt.ts
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentSoupPropertiesFieldAllOfTwoDeletedAt.ts
@@ -8,4 +8,4 @@
/**
* The time the document was deleted
*/
-export type SoupDocumentDeletedAt = string | null;
+export type SoupDocumentSoupPropertiesFieldAllOfTwoDeletedAt = string | null;
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentDocumentFamilyId.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentSoupPropertiesFieldAllOfTwoDocumentFamilyId.ts
similarity index 68%
rename from apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentDocumentFamilyId.ts
rename to apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentSoupPropertiesFieldAllOfTwoDocumentFamilyId.ts
index eb6393479d..887b30e82c 100644
--- a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentDocumentFamilyId.ts
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentSoupPropertiesFieldAllOfTwoDocumentFamilyId.ts
@@ -8,4 +8,6 @@
/**
* The id of the document family this document belongs to
*/
-export type SoupDocumentDocumentFamilyId = number | null;
+export type SoupDocumentSoupPropertiesFieldAllOfTwoDocumentFamilyId =
+ | number
+ | null;
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentFileType.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentSoupPropertiesFieldAllOfTwoFileType.ts
similarity index 70%
rename from apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentFileType.ts
rename to apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentSoupPropertiesFieldAllOfTwoFileType.ts
index 3dc9a768c6..60d329d387 100644
--- a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentFileType.ts
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentSoupPropertiesFieldAllOfTwoFileType.ts
@@ -8,4 +8,4 @@
/**
* The file type of the document (e.g. pdf, docx)
*/
-export type SoupDocumentFileType = string | null;
+export type SoupDocumentSoupPropertiesFieldAllOfTwoFileType = string | null;
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentProjectId.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentSoupPropertiesFieldAllOfTwoProjectId.ts
similarity index 71%
rename from apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentProjectId.ts
rename to apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentSoupPropertiesFieldAllOfTwoProjectId.ts
index 14ed9d5fcb..f04bc84282 100644
--- a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentProjectId.ts
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentSoupPropertiesFieldAllOfTwoProjectId.ts
@@ -8,4 +8,4 @@
/**
* The id of the project that this document belongs to
*/
-export type SoupDocumentProjectId = string | null;
+export type SoupDocumentSoupPropertiesFieldAllOfTwoProjectId = string | null;
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentSha.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentSoupPropertiesFieldAllOfTwoSha.ts
similarity index 77%
rename from apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentSha.ts
rename to apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentSoupPropertiesFieldAllOfTwoSha.ts
index 0f04d829bf..30a9986486 100644
--- a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentSha.ts
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentSoupPropertiesFieldAllOfTwoSha.ts
@@ -9,4 +9,4 @@
* If the document is a PDF, this is the SHA of the pdf
If the document is a DOCX, this will not be present
*/
-export type SoupDocumentSha = string | null;
+export type SoupDocumentSoupPropertiesFieldAllOfTwoSha = string | null;
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentSubTypeProperty.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentSoupPropertiesFieldAllOfTwoSubType.ts
similarity index 68%
rename from apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentSubTypeProperty.ts
rename to apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentSoupPropertiesFieldAllOfTwoSubType.ts
index 34435b8bf6..94fe050442 100644
--- a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentSubTypeProperty.ts
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentSoupPropertiesFieldAllOfTwoSubType.ts
@@ -6,4 +6,5 @@
*/
import type { SoupDocumentSubType } from './soupDocumentSubType';
-export type SoupDocumentSubTypeProperty = null | SoupDocumentSubType;
+export type SoupDocumentSoupPropertiesFieldAllOfTwoSubType =
+ null | SoupDocumentSubType;
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupProjectViewedAt.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentSoupPropertiesFieldAllOfTwoViewedAt.ts
similarity index 69%
rename from apps/web/src/lib/service-clients/service-storage/generated/schemas/soupProjectViewedAt.ts
rename to apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentSoupPropertiesFieldAllOfTwoViewedAt.ts
index 9fef629bf2..e3f939b65d 100644
--- a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupProjectViewedAt.ts
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentSoupPropertiesFieldAllOfTwoViewedAt.ts
@@ -8,4 +8,4 @@
/**
* The time the document was last viewed
*/
-export type SoupProjectViewedAt = string | null;
+export type SoupDocumentSoupPropertiesFieldAllOfTwoViewedAt = string | null;
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupEnrichedEmailThreadPreview.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupEnrichedEmailThreadPreview.ts
deleted file mode 100644
index 698e6997c0..0000000000
--- a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupEnrichedEmailThreadPreview.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-/**
- * Generated by orval v7.21.0 🍺
- * Do not edit manually.
- * document_storage_service
- * OpenAPI spec version: 0.1.0
- */
-import type { SoupEmailThreadPreview } from './soupEmailThreadPreview';
-import type { SoupEnrichedEmailThreadPreviewAllOf } from './soupEnrichedEmailThreadPreviewAllOf';
-
-/**
- * Email thread preview enriched with related metadata for Soup.
- */
-export type SoupEnrichedEmailThreadPreview = SoupEmailThreadPreview &
- SoupEnrichedEmailThreadPreviewAllOf;
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupEnrichedEmailThreadPreviewSoupPropertiesField.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupEnrichedEmailThreadPreviewSoupPropertiesField.ts
new file mode 100644
index 0000000000..f34cfa4d44
--- /dev/null
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupEnrichedEmailThreadPreviewSoupPropertiesField.ts
@@ -0,0 +1,17 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+import type { SoupEmailThreadPreview } from './soupEmailThreadPreview';
+import type { SoupEnrichedEmailThreadPreviewSoupPropertiesFieldAllOf } from './soupEnrichedEmailThreadPreviewSoupPropertiesFieldAllOf';
+import type { SoupEnrichedEmailThreadPreviewSoupPropertiesFieldAllOfTwo } from './soupEnrichedEmailThreadPreviewSoupPropertiesFieldAllOfTwo';
+
+/**
+ * Email thread preview enriched with related metadata for Soup.
+ */
+export type SoupEnrichedEmailThreadPreviewSoupPropertiesField =
+ SoupEmailThreadPreview &
+ SoupEnrichedEmailThreadPreviewSoupPropertiesFieldAllOf &
+ SoupEnrichedEmailThreadPreviewSoupPropertiesFieldAllOfTwo;
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupEnrichedEmailThreadPreviewSoupPropertiesFieldAllOf.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupEnrichedEmailThreadPreviewSoupPropertiesFieldAllOf.ts
new file mode 100644
index 0000000000..914bc2d913
--- /dev/null
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupEnrichedEmailThreadPreviewSoupPropertiesFieldAllOf.ts
@@ -0,0 +1,15 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+import type { SoupProperty } from './soupProperty';
+
+/**
+ * Property fields that can be flattened into property-bearing Soup items.
+ */
+export type SoupEnrichedEmailThreadPreviewSoupPropertiesFieldAllOf = {
+ /** Properties attached to the entity. */
+ properties: SoupProperty[];
+};
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupEnrichedEmailThreadPreviewAllOf.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupEnrichedEmailThreadPreviewSoupPropertiesFieldAllOfTwo.ts
similarity index 73%
rename from apps/web/src/lib/service-clients/service-storage/generated/schemas/soupEnrichedEmailThreadPreviewAllOf.ts
rename to apps/web/src/lib/service-clients/service-storage/generated/schemas/soupEnrichedEmailThreadPreviewSoupPropertiesFieldAllOfTwo.ts
index 678551a88b..f993fa9359 100644
--- a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupEnrichedEmailThreadPreviewAllOf.ts
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupEnrichedEmailThreadPreviewSoupPropertiesFieldAllOfTwo.ts
@@ -7,15 +7,12 @@
import type { SoupAttachment } from './soupAttachment';
import type { SoupContact } from './soupContact';
import type { SoupLabel } from './soupLabel';
-import type { SoupProperty } from './soupProperty';
-export type SoupEnrichedEmailThreadPreviewAllOf = {
+export type SoupEnrichedEmailThreadPreviewSoupPropertiesFieldAllOfTwo = {
/** Attachments on the thread. */
attachments: SoupAttachment[];
/** Labels attached to the thread. */
labels: SoupLabel[];
/** Contacts participating in the thread. */
participants: SoupContact[];
- /** Properties attached to the thread. */
- properties: SoupProperty[];
};
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupItemOneOf.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupItemOneOf.ts
index c5b1168a45..0874aa92cb 100644
--- a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupItemOneOf.ts
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupItemOneOf.ts
@@ -4,7 +4,7 @@
* document_storage_service
* OpenAPI spec version: 0.1.0
*/
-import type { SoupDocument } from './soupDocument';
+import type { SoupDocumentSoupPropertiesField } from './soupDocumentSoupPropertiesField';
import type { SoupItemOneOfTag } from './soupItemOneOfTag';
/**
@@ -12,6 +12,6 @@ import type { SoupItemOneOfTag } from './soupItemOneOfTag';
*/
export type SoupItemOneOf = {
/** Document item. */
- data: SoupDocument;
+ data: SoupDocumentSoupPropertiesField;
tag: SoupItemOneOfTag;
};
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupItemOneOfFive.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupItemOneOfFive.ts
index eb044b9ebd..22434f6a29 100644
--- a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupItemOneOfFive.ts
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupItemOneOfFive.ts
@@ -6,13 +6,13 @@
*/
import type { SoupItemOneOfFiveTag } from './soupItemOneOfFiveTag';
-import type { SoupProject } from './soupProject';
+import type { SoupProjectSoupPropertiesField } from './soupProjectSoupPropertiesField';
/**
* Project item.
*/
export type SoupItemOneOfFive = {
/** Project item. */
- data: SoupProject;
+ data: SoupProjectSoupPropertiesField;
tag: SoupItemOneOfFiveTag;
};
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupItemOneOfOnefive.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupItemOneOfOnefive.ts
index 882ad3d8d3..8cdfb61dbb 100644
--- a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupItemOneOfOnefive.ts
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupItemOneOfOnefive.ts
@@ -4,7 +4,7 @@
* document_storage_service
* OpenAPI spec version: 0.1.0
*/
-import type { SoupCrmCompany } from './soupCrmCompany';
+import type { SoupCrmCompanySoupPropertiesField } from './soupCrmCompanySoupPropertiesField';
import type { SoupItemOneOfOnefiveTag } from './soupItemOneOfOnefiveTag';
/**
@@ -12,6 +12,6 @@ import type { SoupItemOneOfOnefiveTag } from './soupItemOneOfOnefiveTag';
*/
export type SoupItemOneOfOnefive = {
/** CRM company item. */
- data: SoupCrmCompany;
+ data: SoupCrmCompanySoupPropertiesField;
tag: SoupItemOneOfOnefiveTag;
};
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupItemOneOfOnethree.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupItemOneOfOnethree.ts
index fd21f4e047..a19723ebef 100644
--- a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupItemOneOfOnethree.ts
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupItemOneOfOnethree.ts
@@ -4,7 +4,7 @@
* document_storage_service
* OpenAPI spec version: 0.1.0
*/
-import type { SoupCallRecord } from './soupCallRecord';
+import type { SoupCallRecordSoupPropertiesField } from './soupCallRecordSoupPropertiesField';
import type { SoupItemOneOfOnethreeTag } from './soupItemOneOfOnethreeTag';
/**
@@ -12,6 +12,6 @@ import type { SoupItemOneOfOnethreeTag } from './soupItemOneOfOnethreeTag';
*/
export type SoupItemOneOfOnethree = {
/** Call record item. */
- data: SoupCallRecord;
+ data: SoupCallRecordSoupPropertiesField;
tag: SoupItemOneOfOnethreeTag;
};
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupItemOneOfSeven.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupItemOneOfSeven.ts
index 00ed5245f5..eb354ba092 100644
--- a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupItemOneOfSeven.ts
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupItemOneOfSeven.ts
@@ -4,7 +4,7 @@
* document_storage_service
* OpenAPI spec version: 0.1.0
*/
-import type { SoupEnrichedEmailThreadPreview } from './soupEnrichedEmailThreadPreview';
+import type { SoupEnrichedEmailThreadPreviewSoupPropertiesField } from './soupEnrichedEmailThreadPreviewSoupPropertiesField';
import type { SoupItemOneOfSevenTag } from './soupItemOneOfSevenTag';
/**
@@ -12,6 +12,6 @@ import type { SoupItemOneOfSevenTag } from './soupItemOneOfSevenTag';
*/
export type SoupItemOneOfSeven = {
/** Email thread item. */
- data: SoupEnrichedEmailThreadPreview;
+ data: SoupEnrichedEmailThreadPreviewSoupPropertiesField;
tag: SoupItemOneOfSevenTag;
};
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupItemOneOfThree.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupItemOneOfThree.ts
index 1ec6c4f0bb..23d9068c5a 100644
--- a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupItemOneOfThree.ts
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupItemOneOfThree.ts
@@ -4,7 +4,7 @@
* document_storage_service
* OpenAPI spec version: 0.1.0
*/
-import type { SoupChat } from './soupChat';
+import type { SoupChatSoupPropertiesField } from './soupChatSoupPropertiesField';
import type { SoupItemOneOfThreeTag } from './soupItemOneOfThreeTag';
/**
@@ -12,6 +12,6 @@ import type { SoupItemOneOfThreeTag } from './soupItemOneOfThreeTag';
*/
export type SoupItemOneOfThree = {
/** Chat item. */
- data: SoupChat;
+ data: SoupChatSoupPropertiesField;
tag: SoupItemOneOfThreeTag;
};
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupProject.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupProject.ts
deleted file mode 100644
index 7115e6e637..0000000000
--- a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupProject.ts
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
- * Generated by orval v7.21.0 🍺
- * Do not edit manually.
- * document_storage_service
- * OpenAPI spec version: 0.1.0
- */
-import type { SoupProjectDeletedAt } from './soupProjectDeletedAt';
-import type { SoupProjectParentId } from './soupProjectParentId';
-import type { SoupProjectViewedAt } from './soupProjectViewedAt';
-import type { SoupProperty } from './soupProperty';
-
-/**
- * A project as displayed in Soup.
- */
-export interface SoupProject {
- /** The time the project was created */
- createdAt: string;
- /** The time the project was deleted */
- deletedAt?: SoupProjectDeletedAt;
- /** The id of the project */
- id: string;
- /** The name of the project */
- name: string;
- /** The user id of who created the project */
- ownerId: string;
- /** The parent project id */
- parentId?: SoupProjectParentId;
- /** Properties */
- properties: SoupProperty[];
- /** The time the project was updated */
- updatedAt: string;
- /** The time the document was last viewed */
- viewedAt?: SoupProjectViewedAt;
-}
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupProjectSoupPropertiesField.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupProjectSoupPropertiesField.ts
new file mode 100644
index 0000000000..8c7bacdd46
--- /dev/null
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupProjectSoupPropertiesField.ts
@@ -0,0 +1,14 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+import type { SoupProjectSoupPropertiesFieldAllOf } from './soupProjectSoupPropertiesFieldAllOf';
+import type { SoupProjectSoupPropertiesFieldAllOfTwo } from './soupProjectSoupPropertiesFieldAllOfTwo';
+
+/**
+ * A project as displayed in Soup.
+ */
+export type SoupProjectSoupPropertiesField =
+ SoupProjectSoupPropertiesFieldAllOf & SoupProjectSoupPropertiesFieldAllOfTwo;
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupProjectSoupPropertiesFieldAllOf.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupProjectSoupPropertiesFieldAllOf.ts
new file mode 100644
index 0000000000..6f2fb9759e
--- /dev/null
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupProjectSoupPropertiesFieldAllOf.ts
@@ -0,0 +1,15 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+import type { SoupProperty } from './soupProperty';
+
+/**
+ * Property fields that can be flattened into property-bearing Soup items.
+ */
+export type SoupProjectSoupPropertiesFieldAllOf = {
+ /** Properties attached to the entity. */
+ properties: SoupProperty[];
+};
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupProjectSoupPropertiesFieldAllOfTwo.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupProjectSoupPropertiesFieldAllOfTwo.ts
new file mode 100644
index 0000000000..a85ddbc0f4
--- /dev/null
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupProjectSoupPropertiesFieldAllOfTwo.ts
@@ -0,0 +1,28 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+import type { SoupProjectSoupPropertiesFieldAllOfTwoDeletedAt } from './soupProjectSoupPropertiesFieldAllOfTwoDeletedAt';
+import type { SoupProjectSoupPropertiesFieldAllOfTwoParentId } from './soupProjectSoupPropertiesFieldAllOfTwoParentId';
+import type { SoupProjectSoupPropertiesFieldAllOfTwoViewedAt } from './soupProjectSoupPropertiesFieldAllOfTwoViewedAt';
+
+export type SoupProjectSoupPropertiesFieldAllOfTwo = {
+ /** The time the project was created */
+ createdAt: string;
+ /** The time the project was deleted */
+ deletedAt?: SoupProjectSoupPropertiesFieldAllOfTwoDeletedAt;
+ /** The id of the project */
+ id: string;
+ /** The name of the project */
+ name: string;
+ /** The user id of who created the project */
+ ownerId: string;
+ /** The parent project id */
+ parentId?: SoupProjectSoupPropertiesFieldAllOfTwoParentId;
+ /** The time the project was updated */
+ updatedAt: string;
+ /** The time the document was last viewed */
+ viewedAt?: SoupProjectSoupPropertiesFieldAllOfTwoViewedAt;
+};
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupProjectDeletedAt.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupProjectSoupPropertiesFieldAllOfTwoDeletedAt.ts
similarity index 69%
rename from apps/web/src/lib/service-clients/service-storage/generated/schemas/soupProjectDeletedAt.ts
rename to apps/web/src/lib/service-clients/service-storage/generated/schemas/soupProjectSoupPropertiesFieldAllOfTwoDeletedAt.ts
index 57785ac6a6..fb3e5572c5 100644
--- a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupProjectDeletedAt.ts
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupProjectSoupPropertiesFieldAllOfTwoDeletedAt.ts
@@ -8,4 +8,4 @@
/**
* The time the project was deleted
*/
-export type SoupProjectDeletedAt = string | null;
+export type SoupProjectSoupPropertiesFieldAllOfTwoDeletedAt = string | null;
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupProjectParentId.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupProjectSoupPropertiesFieldAllOfTwoParentId.ts
similarity index 67%
rename from apps/web/src/lib/service-clients/service-storage/generated/schemas/soupProjectParentId.ts
rename to apps/web/src/lib/service-clients/service-storage/generated/schemas/soupProjectSoupPropertiesFieldAllOfTwoParentId.ts
index e41350befe..2003773ff9 100644
--- a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupProjectParentId.ts
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupProjectSoupPropertiesFieldAllOfTwoParentId.ts
@@ -8,4 +8,4 @@
/**
* The parent project id
*/
-export type SoupProjectParentId = string | null;
+export type SoupProjectSoupPropertiesFieldAllOfTwoParentId = string | null;
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentViewedAt.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupProjectSoupPropertiesFieldAllOfTwoViewedAt.ts
similarity index 69%
rename from apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentViewedAt.ts
rename to apps/web/src/lib/service-clients/service-storage/generated/schemas/soupProjectSoupPropertiesFieldAllOfTwoViewedAt.ts
index 57117b471a..4e09cb2674 100644
--- a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupDocumentViewedAt.ts
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupProjectSoupPropertiesFieldAllOfTwoViewedAt.ts
@@ -8,4 +8,4 @@
/**
* The time the document was last viewed
*/
-export type SoupDocumentViewedAt = string | null;
+export type SoupProjectSoupPropertiesFieldAllOfTwoViewedAt = string | null;
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupPropertiesField.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupPropertiesField.ts
new file mode 100644
index 0000000000..71c4424ff2
--- /dev/null
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupPropertiesField.ts
@@ -0,0 +1,15 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+import type { SoupProperty } from './soupProperty';
+
+/**
+ * Property fields that can be flattened into property-bearing Soup items.
+ */
+export interface SoupPropertiesField {
+ /** Properties attached to the entity. */
+ properties: SoupProperty[];
+}
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/zod.ts b/apps/web/src/lib/service-clients/service-storage/generated/zod.ts
index 8de46a9756..b0ef0fee57 100644
--- a/apps/web/src/lib/service-clients/service-storage/generated/zod.ts
+++ b/apps/web/src/lib/service-clients/service-storage/generated/zod.ts
@@ -6724,49 +6724,6 @@ export const getItemsSoupResponse = zod
.object({
data: zod
.object({
- branchedFromId: zod
- .uuid()
- .nullish()
- .describe(
- 'The id of the document this document branched from'
- ),
- branchedFromVersionId: zod
- .number()
- .nullish()
- .describe(
- 'The id of the version this document branched from\nThis could be either DocumentInstance or DocumentBom id depending on the file type'
- ),
- createdAt: zod.iso
- .datetime({})
- .describe('The time the document was created'),
- deletedAt: zod.iso
- .datetime({})
- .nullish()
- .describe('The time the document was deleted'),
- documentFamilyId: zod
- .number()
- .nullish()
- .describe(
- 'The id of the document family this document belongs to'
- ),
- documentVersionId: zod
- .number()
- .describe(
- 'The version of the document\nThis could be the document_instance_id or document_bom_id depending on the file type'
- ),
- fileType: zod
- .string()
- .nullish()
- .describe('The file type of the document (e.g. pdf, docx)'),
- id: zod.uuid().describe('The document id'),
- name: zod.string().describe('The name of the document'),
- ownerId: zod.string().describe('The owner of the document'),
- projectId: zod
- .uuid()
- .nullish()
- .describe(
- 'The id of the project that this document belongs to'
- ),
properties: zod
.array(
zod
@@ -6986,51 +6943,105 @@ export const getItemsSoupResponse = zod
'A property attached to a Soup item.\n\nThis is a simplified representation that includes only the definition and value,\nomitting the entity property assignment metadata and options.'
)
)
- .describe('Properties'),
- sha: zod
- .string()
- .nullish()
- .describe(
- 'If the document is a PDF, this is the SHA of the pdf\nIf the document is a DOCX, this will not be present'
- ),
- subType: zod
- .union([
- zod.null(),
- zod
- .union([
- zod
- .object({
- is_completed: zod
- .boolean()
- .describe(
- 'Whether the task is completed.\nTrue if the Status property is set to \"Completed\".'
- ),
- type: zod.enum(['task']),
- })
- .describe(
- 'A task document with its associated properties'
- ),
- zod
- .object({
- type: zod.enum(['snippet']),
- })
- .describe('A snippet document — reusable markdown'),
- ])
- .describe(
- 'Sub type of a document with associated properties encoded in each variant.\nThis ensures type-safety: task properties only exist when the document is a task.'
- ),
- ])
- .optional(),
- updatedAt: zod.iso
- .datetime({})
- .describe(
- 'The time the document instance \/ document BOM was updated'
- ),
- viewedAt: zod.iso
- .datetime({})
- .nullish()
- .describe('The time the document was last viewed'),
+ .describe('Properties attached to the entity.'),
})
+ .describe(
+ 'Property fields that can be flattened into property-bearing Soup items.'
+ )
+ .and(
+ zod.object({
+ branchedFromId: zod
+ .uuid()
+ .nullish()
+ .describe(
+ 'The id of the document this document branched from'
+ ),
+ branchedFromVersionId: zod
+ .number()
+ .nullish()
+ .describe(
+ 'The id of the version this document branched from\nThis could be either DocumentInstance or DocumentBom id depending on the file type'
+ ),
+ createdAt: zod.iso
+ .datetime({})
+ .describe('The time the document was created'),
+ deletedAt: zod.iso
+ .datetime({})
+ .nullish()
+ .describe('The time the document was deleted'),
+ documentFamilyId: zod
+ .number()
+ .nullish()
+ .describe(
+ 'The id of the document family this document belongs to'
+ ),
+ documentVersionId: zod
+ .number()
+ .describe(
+ 'The version of the document\nThis could be the document_instance_id or document_bom_id depending on the file type'
+ ),
+ fileType: zod
+ .string()
+ .nullish()
+ .describe(
+ 'The file type of the document (e.g. pdf, docx)'
+ ),
+ id: zod.uuid().describe('The document id'),
+ name: zod.string().describe('The name of the document'),
+ ownerId: zod.string().describe('The owner of the document'),
+ projectId: zod
+ .uuid()
+ .nullish()
+ .describe(
+ 'The id of the project that this document belongs to'
+ ),
+ sha: zod
+ .string()
+ .nullish()
+ .describe(
+ 'If the document is a PDF, this is the SHA of the pdf\nIf the document is a DOCX, this will not be present'
+ ),
+ subType: zod
+ .union([
+ zod.null(),
+ zod
+ .union([
+ zod
+ .object({
+ is_completed: zod
+ .boolean()
+ .describe(
+ 'Whether the task is completed.\nTrue if the Status property is set to \"Completed\".'
+ ),
+ type: zod.enum(['task']),
+ })
+ .describe(
+ 'A task document with its associated properties'
+ ),
+ zod
+ .object({
+ type: zod.enum(['snippet']),
+ })
+ .describe(
+ 'A snippet document — reusable markdown'
+ ),
+ ])
+ .describe(
+ 'Sub type of a document with associated properties encoded in each variant.\nThis ensures type-safety: task properties only exist when the document is a task.'
+ ),
+ ])
+ .optional(),
+ updatedAt: zod.iso
+ .datetime({})
+ .describe(
+ 'The time the document instance \/ document BOM was updated'
+ ),
+ viewedAt: zod.iso
+ .datetime({})
+ .nullish()
+ .describe('The time the document was last viewed'),
+ })
+ )
.describe('A document as displayed in Soup.'),
tag: zod.enum(['document']),
})
@@ -7039,23 +7050,6 @@ export const getItemsSoupResponse = zod
.object({
data: zod
.object({
- createdAt: zod.iso
- .datetime({})
- .describe('The time the chat was created'),
- deletedAt: zod.iso
- .datetime({})
- .nullish()
- .describe('The time the chat was deleted'),
- id: zod.uuid().describe('The chat uuid'),
- isPersistent: zod
- .boolean()
- .describe('Whether the chat is persistent or not'),
- name: zod.string().describe('The name of the chat'),
- ownerId: zod.string().describe('Who the chat belongs to'),
- projectId: zod
- .uuid()
- .nullish()
- .describe('The project id of the chat'),
properties: zod
.array(
zod
@@ -7275,15 +7269,39 @@ export const getItemsSoupResponse = zod
'A property attached to a Soup item.\n\nThis is a simplified representation that includes only the definition and value,\nomitting the entity property assignment metadata and options.'
)
)
- .describe('Properties'),
- updatedAt: zod.iso
- .datetime({})
- .describe('The time the chat was last updated'),
- viewedAt: zod.iso
- .datetime({})
- .nullish()
- .describe('The time the chat was last viewed'),
+ .describe('Properties attached to the entity.'),
})
+ .describe(
+ 'Property fields that can be flattened into property-bearing Soup items.'
+ )
+ .and(
+ zod.object({
+ createdAt: zod.iso
+ .datetime({})
+ .describe('The time the chat was created'),
+ deletedAt: zod.iso
+ .datetime({})
+ .nullish()
+ .describe('The time the chat was deleted'),
+ id: zod.uuid().describe('The chat uuid'),
+ isPersistent: zod
+ .boolean()
+ .describe('Whether the chat is persistent or not'),
+ name: zod.string().describe('The name of the chat'),
+ ownerId: zod.string().describe('Who the chat belongs to'),
+ projectId: zod
+ .uuid()
+ .nullish()
+ .describe('The project id of the chat'),
+ updatedAt: zod.iso
+ .datetime({})
+ .describe('The time the chat was last updated'),
+ viewedAt: zod.iso
+ .datetime({})
+ .nullish()
+ .describe('The time the chat was last viewed'),
+ })
+ )
.describe('A chat as displayed in Soup.'),
tag: zod.enum(['chat']),
})
@@ -7292,22 +7310,6 @@ export const getItemsSoupResponse = zod
.object({
data: zod
.object({
- createdAt: zod.iso
- .datetime({})
- .describe('The time the project was created'),
- deletedAt: zod.iso
- .datetime({})
- .nullish()
- .describe('The time the project was deleted'),
- id: zod.uuid().describe('The id of the project'),
- name: zod.string().describe('The name of the project'),
- ownerId: zod
- .string()
- .describe('The user id of who created the project'),
- parentId: zod
- .uuid()
- .nullish()
- .describe('The parent project id'),
properties: zod
.array(
zod
@@ -7527,15 +7529,38 @@ export const getItemsSoupResponse = zod
'A property attached to a Soup item.\n\nThis is a simplified representation that includes only the definition and value,\nomitting the entity property assignment metadata and options.'
)
)
- .describe('Properties'),
- updatedAt: zod.iso
- .datetime({})
- .describe('The time the project was updated'),
- viewedAt: zod.iso
- .datetime({})
- .nullish()
- .describe('The time the document was last viewed'),
+ .describe('Properties attached to the entity.'),
})
+ .describe(
+ 'Property fields that can be flattened into property-bearing Soup items.'
+ )
+ .and(
+ zod.object({
+ createdAt: zod.iso
+ .datetime({})
+ .describe('The time the project was created'),
+ deletedAt: zod.iso
+ .datetime({})
+ .nullish()
+ .describe('The time the project was deleted'),
+ id: zod.uuid().describe('The id of the project'),
+ name: zod.string().describe('The name of the project'),
+ ownerId: zod
+ .string()
+ .describe('The user id of who created the project'),
+ parentId: zod
+ .uuid()
+ .nullish()
+ .describe('The parent project id'),
+ updatedAt: zod.iso
+ .datetime({})
+ .describe('The time the project was updated'),
+ viewedAt: zod.iso
+ .datetime({})
+ .nullish()
+ .describe('The time the document was last viewed'),
+ })
+ )
.describe('A project as displayed in Soup.'),
tag: zod.enum(['project']),
})
@@ -7601,52 +7626,280 @@ export const getItemsSoupResponse = zod
})
.describe('Email thread preview data as displayed in Soup.')
.and(
- zod.object({
- attachments: zod
- .array(
- zod
- .object({
- contentId: zod
- .string()
- .nullish()
- .describe('Content id for inline attachments.'),
- createdAt: zod.iso
- .datetime({})
- .describe(
- 'Timestamp when the attachment was created.'
- ),
- filename: zod
- .string()
- .nullish()
- .describe('Attachment filename.'),
- id: zod.uuid().describe('Attachment id.'),
- messageId: zod
- .uuid()
- .describe(
- 'Message id that owns this attachment.'
- ),
- mimeType: zod
- .string()
- .nullish()
- .describe('Attachment MIME type.'),
- providerAttachmentId: zod
- .string()
- .nullish()
- .describe('Provider-specific attachment id.'),
- sizeBytes: zod
- .number()
- .nullish()
- .describe('Attachment size in bytes.'),
- })
- .describe('An email attachment as displayed in Soup.')
- )
- .describe('Attachments on the thread.'),
- labels: zod
- .array(
- zod
- .object({
- createdAt: zod.iso
- .datetime({})
+ zod
+ .object({
+ properties: zod
+ .array(
+ zod
+ .object({
+ definition: zod
+ .object({
+ created_at: zod.iso.datetime({}),
+ data_type: zod
+ .enum([
+ 'BOOLEAN',
+ 'DATE',
+ 'NUMBER',
+ 'STRING',
+ 'SELECT_NUMBER',
+ 'SELECT_STRING',
+ 'TAG',
+ 'ENTITY',
+ 'LINK',
+ ])
+ .describe(
+ 'Data type for property values, determining storage and validation.'
+ ),
+ display_name: zod.string(),
+ id: zod.uuid(),
+ is_metadata: zod
+ .boolean()
+ .describe(
+ 'Flag to indicate if this is a system-generated metadata property.\nNot stored in database - computed at service layer.'
+ ),
+ is_multi_select: zod.boolean(),
+ is_system: zod
+ .boolean()
+ .describe(
+ 'Flag to indicate if this is a system property (stored in DB).'
+ ),
+ owner: zod
+ .union([
+ zod
+ .object({
+ scope: zod.enum(['user']),
+ user_id: zod.string(),
+ })
+ .describe('User-scoped property.'),
+ zod
+ .object({
+ scope: zod.enum(['team']),
+ team_id: zod.uuid(),
+ })
+ .describe('Team-scoped property.'),
+ zod
+ .object({
+ scope: zod.enum(['system']),
+ })
+ .describe(
+ 'System-owned property (no user or team owner).'
+ ),
+ ])
+ .describe(
+ 'Defines who owns a property - user-scoped, team-scoped, or system.'
+ ),
+ specific_entity_type: zod
+ .union([
+ zod.null(),
+ zod
+ .enum([
+ 'CALL_RECORD',
+ 'CHANNEL',
+ 'CHAT',
+ 'COMPANY',
+ 'DOCUMENT',
+ 'PROJECT',
+ 'TASK',
+ 'THREAD',
+ 'USER',
+ ])
+ .describe(
+ 'Type of entity that can be referenced by entity properties.'
+ ),
+ ])
+ .optional(),
+ updated_at: zod.iso.datetime({}),
+ })
+ .describe(
+ 'Property definition model (service representation).'
+ ),
+ id: zod
+ .uuid()
+ .describe(
+ 'Globally unique id of the assignment attaching this property to an entity.'
+ ),
+ value: zod
+ .union([
+ zod.null(),
+ zod
+ .union([
+ zod
+ .object({
+ type: zod.enum(['Boolean']),
+ value: zod
+ .boolean()
+ .describe(
+ 'Boolean value\nSerializes as: {\"type\": \"Boolean\", \"value\": true}'
+ ),
+ })
+ .describe(
+ 'Boolean value\nSerializes as: {\"type\": \"Boolean\", \"value\": true}'
+ ),
+ zod
+ .object({
+ type: zod.enum(['Number']),
+ value: zod
+ .number()
+ .describe(
+ 'Numeric value\nSerializes as: {\"type\": \"Number\", \"value\": 42.5}'
+ ),
+ })
+ .describe(
+ 'Numeric value\nSerializes as: {\"type\": \"Number\", \"value\": 42.5}'
+ ),
+ zod
+ .object({
+ type: zod.enum(['String']),
+ value: zod
+ .string()
+ .describe(
+ 'String value\nSerializes as: {\"type\": \"String\", \"value\": \"text\"}'
+ ),
+ })
+ .describe(
+ 'String value\nSerializes as: {\"type\": \"String\", \"value\": \"text\"}'
+ ),
+ zod
+ .object({
+ type: zod.enum(['Date']),
+ value: zod.iso
+ .datetime({})
+ .describe(
+ 'Date\/timestamp value\nSerializes as: {\"type\": \"Date\", \"value\": \"2025-01-01T00:00:00Z\"}'
+ ),
+ })
+ .describe(
+ 'Date\/timestamp value\nSerializes as: {\"type\": \"Date\", \"value\": \"2025-01-01T00:00:00Z\"}'
+ ),
+ zod
+ .object({
+ type: zod.enum(['SelectOption']),
+ value: zod
+ .array(zod.uuid())
+ .describe(
+ 'Select option(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"SelectOption\", \"value\": [\"uuid\"]} (length 0 or 1)\nMulti-select: {\"type\": \"SelectOption\", \"value\": [\"uuid1\", \"uuid2\", ...]} (length 0+)'
+ ),
+ })
+ .describe(
+ 'Select option(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"SelectOption\", \"value\": [\"uuid\"]} (length 0 or 1)\nMulti-select: {\"type\": \"SelectOption\", \"value\": [\"uuid1\", \"uuid2\", ...]} (length 0+)'
+ ),
+ zod
+ .object({
+ type: zod.enum(['EntityReference']),
+ value: zod
+ .array(
+ zod
+ .object({
+ entity_id: zod.string(),
+ entity_type: zod
+ .enum([
+ 'CALL_RECORD',
+ 'CHANNEL',
+ 'CHAT',
+ 'COMPANY',
+ 'DOCUMENT',
+ 'PROJECT',
+ 'TASK',
+ 'THREAD',
+ 'USER',
+ ])
+ .describe(
+ 'Type of entity that can be referenced by entity properties.'
+ ),
+ specific_message_id: zod
+ .uuid()
+ .nullish()
+ .describe(
+ 'For CHANNEL, CHAT, THREAD entity types - optional specific message ID.\nThis allows referencing a specific message within a thread\/channel\/chat.'
+ ),
+ })
+ .describe(
+ 'Entity reference for entity-type property values.'
+ )
+ )
+ .describe(
+ 'Entity reference(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"EntityReference\", \"value\": [{...}]} (length 0 or 1)\nMulti-select: {\"type\": \"EntityReference\", \"value\": [{...}, {...}, ...]} (length 0+)'
+ ),
+ })
+ .describe(
+ 'Entity reference(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"EntityReference\", \"value\": [{...}]} (length 0 or 1)\nMulti-select: {\"type\": \"EntityReference\", \"value\": [{...}, {...}, ...]} (length 0+)'
+ ),
+ zod
+ .object({
+ type: zod.enum(['Link']),
+ value: zod
+ .array(zod.string())
+ .describe(
+ 'Link value(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\"]} (length 0 or 1)\nMulti-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\", \"https:\/\/other.com\"]} (length 0+)'
+ ),
+ })
+ .describe(
+ 'Link value(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\"]} (length 0 or 1)\nMulti-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\", \"https:\/\/other.com\"]} (length 0+)'
+ ),
+ ])
+ .describe(
+ 'Property value (service representation).\n\nRepresents the actual value stored for an entity property.\nThis is serialized to\/from JSONB in the database.'
+ ),
+ ])
+ .optional(),
+ })
+ .describe(
+ 'A property attached to a Soup item.\n\nThis is a simplified representation that includes only the definition and value,\nomitting the entity property assignment metadata and options.'
+ )
+ )
+ .describe('Properties attached to the entity.'),
+ })
+ .describe(
+ 'Property fields that can be flattened into property-bearing Soup items.'
+ )
+ )
+ .and(
+ zod.object({
+ attachments: zod
+ .array(
+ zod
+ .object({
+ contentId: zod
+ .string()
+ .nullish()
+ .describe('Content id for inline attachments.'),
+ createdAt: zod.iso
+ .datetime({})
+ .describe(
+ 'Timestamp when the attachment was created.'
+ ),
+ filename: zod
+ .string()
+ .nullish()
+ .describe('Attachment filename.'),
+ id: zod.uuid().describe('Attachment id.'),
+ messageId: zod
+ .uuid()
+ .describe(
+ 'Message id that owns this attachment.'
+ ),
+ mimeType: zod
+ .string()
+ .nullish()
+ .describe('Attachment MIME type.'),
+ providerAttachmentId: zod
+ .string()
+ .nullish()
+ .describe('Provider-specific attachment id.'),
+ sizeBytes: zod
+ .number()
+ .nullish()
+ .describe('Attachment size in bytes.'),
+ })
+ .describe('An email attachment as displayed in Soup.')
+ )
+ .describe('Attachments on the thread.'),
+ labels: zod
+ .array(
+ zod
+ .object({
+ createdAt: zod.iso
+ .datetime({})
.describe(
'Timestamp when the label was created.'
),
@@ -7711,226 +7964,6 @@ export const getItemsSoupResponse = zod
)
)
.describe('Contacts participating in the thread.'),
- properties: zod
- .array(
- zod
- .object({
- definition: zod
- .object({
- created_at: zod.iso.datetime({}),
- data_type: zod
- .enum([
- 'BOOLEAN',
- 'DATE',
- 'NUMBER',
- 'STRING',
- 'SELECT_NUMBER',
- 'SELECT_STRING',
- 'TAG',
- 'ENTITY',
- 'LINK',
- ])
- .describe(
- 'Data type for property values, determining storage and validation.'
- ),
- display_name: zod.string(),
- id: zod.uuid(),
- is_metadata: zod
- .boolean()
- .describe(
- 'Flag to indicate if this is a system-generated metadata property.\nNot stored in database - computed at service layer.'
- ),
- is_multi_select: zod.boolean(),
- is_system: zod
- .boolean()
- .describe(
- 'Flag to indicate if this is a system property (stored in DB).'
- ),
- owner: zod
- .union([
- zod
- .object({
- scope: zod.enum(['user']),
- user_id: zod.string(),
- })
- .describe('User-scoped property.'),
- zod
- .object({
- scope: zod.enum(['team']),
- team_id: zod.uuid(),
- })
- .describe('Team-scoped property.'),
- zod
- .object({
- scope: zod.enum(['system']),
- })
- .describe(
- 'System-owned property (no user or team owner).'
- ),
- ])
- .describe(
- 'Defines who owns a property - user-scoped, team-scoped, or system.'
- ),
- specific_entity_type: zod
- .union([
- zod.null(),
- zod
- .enum([
- 'CALL_RECORD',
- 'CHANNEL',
- 'CHAT',
- 'COMPANY',
- 'DOCUMENT',
- 'PROJECT',
- 'TASK',
- 'THREAD',
- 'USER',
- ])
- .describe(
- 'Type of entity that can be referenced by entity properties.'
- ),
- ])
- .optional(),
- updated_at: zod.iso.datetime({}),
- })
- .describe(
- 'Property definition model (service representation).'
- ),
- id: zod
- .uuid()
- .describe(
- 'Globally unique id of the assignment attaching this property to an entity.'
- ),
- value: zod
- .union([
- zod.null(),
- zod
- .union([
- zod
- .object({
- type: zod.enum(['Boolean']),
- value: zod
- .boolean()
- .describe(
- 'Boolean value\nSerializes as: {\"type\": \"Boolean\", \"value\": true}'
- ),
- })
- .describe(
- 'Boolean value\nSerializes as: {\"type\": \"Boolean\", \"value\": true}'
- ),
- zod
- .object({
- type: zod.enum(['Number']),
- value: zod
- .number()
- .describe(
- 'Numeric value\nSerializes as: {\"type\": \"Number\", \"value\": 42.5}'
- ),
- })
- .describe(
- 'Numeric value\nSerializes as: {\"type\": \"Number\", \"value\": 42.5}'
- ),
- zod
- .object({
- type: zod.enum(['String']),
- value: zod
- .string()
- .describe(
- 'String value\nSerializes as: {\"type\": \"String\", \"value\": \"text\"}'
- ),
- })
- .describe(
- 'String value\nSerializes as: {\"type\": \"String\", \"value\": \"text\"}'
- ),
- zod
- .object({
- type: zod.enum(['Date']),
- value: zod.iso
- .datetime({})
- .describe(
- 'Date\/timestamp value\nSerializes as: {\"type\": \"Date\", \"value\": \"2025-01-01T00:00:00Z\"}'
- ),
- })
- .describe(
- 'Date\/timestamp value\nSerializes as: {\"type\": \"Date\", \"value\": \"2025-01-01T00:00:00Z\"}'
- ),
- zod
- .object({
- type: zod.enum(['SelectOption']),
- value: zod
- .array(zod.uuid())
- .describe(
- 'Select option(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"SelectOption\", \"value\": [\"uuid\"]} (length 0 or 1)\nMulti-select: {\"type\": \"SelectOption\", \"value\": [\"uuid1\", \"uuid2\", ...]} (length 0+)'
- ),
- })
- .describe(
- 'Select option(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"SelectOption\", \"value\": [\"uuid\"]} (length 0 or 1)\nMulti-select: {\"type\": \"SelectOption\", \"value\": [\"uuid1\", \"uuid2\", ...]} (length 0+)'
- ),
- zod
- .object({
- type: zod.enum(['EntityReference']),
- value: zod
- .array(
- zod
- .object({
- entity_id: zod.string(),
- entity_type: zod
- .enum([
- 'CALL_RECORD',
- 'CHANNEL',
- 'CHAT',
- 'COMPANY',
- 'DOCUMENT',
- 'PROJECT',
- 'TASK',
- 'THREAD',
- 'USER',
- ])
- .describe(
- 'Type of entity that can be referenced by entity properties.'
- ),
- specific_message_id: zod
- .uuid()
- .nullish()
- .describe(
- 'For CHANNEL, CHAT, THREAD entity types - optional specific message ID.\nThis allows referencing a specific message within a thread\/channel\/chat.'
- ),
- })
- .describe(
- 'Entity reference for entity-type property values.'
- )
- )
- .describe(
- 'Entity reference(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"EntityReference\", \"value\": [{...}]} (length 0 or 1)\nMulti-select: {\"type\": \"EntityReference\", \"value\": [{...}, {...}, ...]} (length 0+)'
- ),
- })
- .describe(
- 'Entity reference(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"EntityReference\", \"value\": [{...}]} (length 0 or 1)\nMulti-select: {\"type\": \"EntityReference\", \"value\": [{...}, {...}, ...]} (length 0+)'
- ),
- zod
- .object({
- type: zod.enum(['Link']),
- value: zod
- .array(zod.string())
- .describe(
- 'Link value(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\"]} (length 0 or 1)\nMulti-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\", \"https:\/\/other.com\"]} (length 0+)'
- ),
- })
- .describe(
- 'Link value(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\"]} (length 0 or 1)\nMulti-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\", \"https:\/\/other.com\"]} (length 0+)'
- ),
- ])
- .describe(
- 'Property value (service representation).\n\nRepresents the actual value stored for an entity property.\nThis is serialized to\/from JSONB in the database.'
- ),
- ])
- .optional(),
- })
- .describe(
- 'A property attached to a Soup item.\n\nThis is a simplified representation that includes only the definition and value,\nomitting the entity property assignment metadata and options.'
- )
- )
- .describe('Properties attached to the thread.'),
})
)
.describe(
@@ -8287,61 +8320,6 @@ export const getItemsSoupResponse = zod
.object({
data: zod
.object({
- attended: zod
- .boolean()
- .describe(
- 'Whether the requesting user attended this call. Kept for compatibility\nand derived from `status == ATTENDED`.'
- ),
- callId: zod.uuid().describe('The call identifier.'),
- channelId: zod
- .uuid()
- .describe('The channel this call belongs to.'),
- channelName: zod
- .string()
- .nullish()
- .describe('Resolved display name for the channel.'),
- createdBy: zod
- .string()
- .describe('User who created the call.'),
- customName: zod
- .string()
- .nullish()
- .describe(
- 'User-supplied or AI-generated display name for the call.'
- ),
- durationMs: zod
- .number()
- .nullish()
- .describe(
- 'Call duration in milliseconds (None if still active).'
- ),
- endedAt: zod.iso
- .datetime({})
- .nullish()
- .describe('When the call ended (None if still active).'),
- isActive: zod
- .boolean()
- .describe('Whether the call is currently active.'),
- participants: zod
- .array(
- zod
- .object({
- joinedAt: zod.iso
- .datetime({})
- .describe('When the user joined the call.'),
- leftAt: zod.iso
- .datetime({})
- .nullish()
- .describe(
- 'When the user left (None if still in an active call).'
- ),
- userId: zod.string().describe('The user id.'),
- })
- .describe(
- 'A participant in a call record, as displayed in Soup.'
- )
- )
- .describe('Participants in the call.'),
properties: zod
.array(
zod
@@ -8561,24 +8539,84 @@ export const getItemsSoupResponse = zod
'A property attached to a Soup item.\n\nThis is a simplified representation that includes only the definition and value,\nomitting the entity property assignment metadata and options.'
)
)
- .describe(
- 'Entity properties (e.g. tags). Populated after fetch by the soup repo.'
- ),
- startedAt: zod.iso
- .datetime({})
- .describe('When the call started.'),
- status: zod
- .enum(['ATTENDED', 'MISSED', 'UNATTENDED'])
- .describe(
- 'Viewer-relative attendance status for a call record.\nSerializes as `ATTENDED`, `MISSED`, or `UNATTENDED`.'
- ),
- summary: zod
- .string()
- .nullish()
- .describe(
- 'AI-generated summary of the call. Only set on archived\n`call_records` once summarization has run; active calls always\nreturn `None`.'
- ),
+ .describe('Properties attached to the entity.'),
})
+ .describe(
+ 'Property fields that can be flattened into property-bearing Soup items.'
+ )
+ .and(
+ zod.object({
+ attended: zod
+ .boolean()
+ .describe(
+ 'Whether the requesting user attended this call. Kept for compatibility\nand derived from `status == ATTENDED`.'
+ ),
+ callId: zod.uuid().describe('The call identifier.'),
+ channelId: zod
+ .uuid()
+ .describe('The channel this call belongs to.'),
+ channelName: zod
+ .string()
+ .nullish()
+ .describe('Resolved display name for the channel.'),
+ createdBy: zod
+ .string()
+ .describe('User who created the call.'),
+ customName: zod
+ .string()
+ .nullish()
+ .describe(
+ 'User-supplied or AI-generated display name for the call.'
+ ),
+ durationMs: zod
+ .number()
+ .nullish()
+ .describe(
+ 'Call duration in milliseconds (None if still active).'
+ ),
+ endedAt: zod.iso
+ .datetime({})
+ .nullish()
+ .describe('When the call ended (None if still active).'),
+ isActive: zod
+ .boolean()
+ .describe('Whether the call is currently active.'),
+ participants: zod
+ .array(
+ zod
+ .object({
+ joinedAt: zod.iso
+ .datetime({})
+ .describe('When the user joined the call.'),
+ leftAt: zod.iso
+ .datetime({})
+ .nullish()
+ .describe(
+ 'When the user left (None if still in an active call).'
+ ),
+ userId: zod.string().describe('The user id.'),
+ })
+ .describe(
+ 'A participant in a call record, as displayed in Soup.'
+ )
+ )
+ .describe('Participants in the call.'),
+ startedAt: zod.iso
+ .datetime({})
+ .describe('When the call started.'),
+ status: zod
+ .enum(['ATTENDED', 'MISSED', 'UNATTENDED'])
+ .describe(
+ 'Viewer-relative attendance status for a call record.\nSerializes as `ATTENDED`, `MISSED`, or `UNATTENDED`.'
+ ),
+ summary: zod
+ .string()
+ .nullish()
+ .describe(
+ 'AI-generated summary of the call. Only set on archived\n`call_records` once summarization has run; active calls always\nreturn `None`.'
+ ),
+ })
+ )
.describe(
'A call record as displayed in Soup. Excludes room_name, egress_id,\nand transcript — fields that are irrelevant for the soup feed.'
),
@@ -8589,60 +8627,6 @@ export const getItemsSoupResponse = zod
.object({
data: zod
.object({
- createdAt: zod.iso
- .datetime({})
- .describe('When the company was created.'),
- description: zod
- .string()
- .nullish()
- .describe(
- "Display description from the primary domain's directory entry."
- ),
- domains: zod
- .array(
- zod
- .object({
- companyId: zod
- .uuid()
- .describe(
- 'The id of the company the domain belongs to.'
- ),
- createdAt: zod.iso
- .datetime({})
- .describe('When the domain record was created.'),
- domain: zod
- .string()
- .describe(
- 'The domain (lowercased, e.g. \"acme.com\").'
- ),
- id: zod
- .uuid()
- .describe('The id of the domain record.'),
- })
- .describe(
- "A CRM domain as displayed in Soup. Mirrors the crm crate's\n[`CrmDomain`] with a stable wire shape that the FE can rely on."
- )
- )
- .describe(
- 'Domains associated with this company, ordered by creation time\nascending (primary first).'
- ),
- emailSync: zod
- .boolean()
- .describe(
- 'Whether email sync is enabled for this company.'
- ),
- hidden: zod
- .boolean()
- .describe(
- 'Whether the company is hidden from CRM listings. Soup filters\nthese out by default.'
- ),
- id: zod.uuid().describe('The id of the company.'),
- name: zod
- .string()
- .nullish()
- .describe(
- "Display name from the primary domain's directory entry, or\n`None` when unresolved."
- ),
properties: zod
.array(
zod
@@ -8862,25 +8846,83 @@ export const getItemsSoupResponse = zod
'A property attached to a Soup item.\n\nThis is a simplified representation that includes only the definition and value,\nomitting the entity property assignment metadata and options.'
)
)
- .optional()
- .describe(
- 'Properties attached to this company (system CRM properties like\nStage \/ Owner \/ Revenue plus any custom ones).'
- ),
- teamId: zod
- .uuid()
- .describe(
- 'The id of the team that owns this company record.'
- ),
- updatedAt: zod.iso
- .datetime({})
- .describe('When the company was last updated.'),
- viewedAt: zod.iso
- .datetime({})
- .nullish()
- .describe(
- 'When the requesting user last viewed this company, or `None` if\nnever viewed. Mirrors the `viewed_at` other soup entities carry.'
- ),
+ .describe('Properties attached to the entity.'),
})
+ .describe(
+ 'Property fields that can be flattened into property-bearing Soup items.'
+ )
+ .and(
+ zod.object({
+ createdAt: zod.iso
+ .datetime({})
+ .describe('When the company was created.'),
+ description: zod
+ .string()
+ .nullish()
+ .describe(
+ "Display description from the primary domain's directory entry."
+ ),
+ domains: zod
+ .array(
+ zod
+ .object({
+ companyId: zod
+ .uuid()
+ .describe(
+ 'The id of the company the domain belongs to.'
+ ),
+ createdAt: zod.iso
+ .datetime({})
+ .describe('When the domain record was created.'),
+ domain: zod
+ .string()
+ .describe(
+ 'The domain (lowercased, e.g. \"acme.com\").'
+ ),
+ id: zod
+ .uuid()
+ .describe('The id of the domain record.'),
+ })
+ .describe(
+ "A CRM domain as displayed in Soup. Mirrors the crm crate's\n[`CrmDomain`] with a stable wire shape that the FE can rely on."
+ )
+ )
+ .describe(
+ 'Domains associated with this company, ordered by creation time\nascending (primary first).'
+ ),
+ emailSync: zod
+ .boolean()
+ .describe(
+ 'Whether email sync is enabled for this company.'
+ ),
+ hidden: zod
+ .boolean()
+ .describe(
+ 'Whether the company is hidden from CRM listings. Soup filters\nthese out by default.'
+ ),
+ id: zod.uuid().describe('The id of the company.'),
+ name: zod
+ .string()
+ .nullish()
+ .describe(
+ "Display name from the primary domain's directory entry, or\n`None` when unresolved."
+ ),
+ teamId: zod
+ .uuid()
+ .describe(
+ 'The id of the team that owns this company record.'
+ ),
+ updatedAt: zod.iso
+ .datetime({})
+ .describe('When the company was last updated.'),
+ viewedAt: zod.iso
+ .datetime({})
+ .nullish()
+ .describe(
+ 'When the requesting user last viewed this company, or `None` if\nnever viewed. Mirrors the `viewed_at` other soup entities carry.'
+ ),
+ })
+ )
.describe(
'A CRM company as displayed in Soup. Carries the core company\nfields plus display metadata resolved from `crm_domain_directory`\nagainst the primary (earliest-created) domain.'
),
@@ -9547,49 +9589,6 @@ export const postItemsSoupResponse = zod
.object({
data: zod
.object({
- branchedFromId: zod
- .uuid()
- .nullish()
- .describe(
- 'The id of the document this document branched from'
- ),
- branchedFromVersionId: zod
- .number()
- .nullish()
- .describe(
- 'The id of the version this document branched from\nThis could be either DocumentInstance or DocumentBom id depending on the file type'
- ),
- createdAt: zod.iso
- .datetime({})
- .describe('The time the document was created'),
- deletedAt: zod.iso
- .datetime({})
- .nullish()
- .describe('The time the document was deleted'),
- documentFamilyId: zod
- .number()
- .nullish()
- .describe(
- 'The id of the document family this document belongs to'
- ),
- documentVersionId: zod
- .number()
- .describe(
- 'The version of the document\nThis could be the document_instance_id or document_bom_id depending on the file type'
- ),
- fileType: zod
- .string()
- .nullish()
- .describe('The file type of the document (e.g. pdf, docx)'),
- id: zod.uuid().describe('The document id'),
- name: zod.string().describe('The name of the document'),
- ownerId: zod.string().describe('The owner of the document'),
- projectId: zod
- .uuid()
- .nullish()
- .describe(
- 'The id of the project that this document belongs to'
- ),
properties: zod
.array(
zod
@@ -9809,51 +9808,105 @@ export const postItemsSoupResponse = zod
'A property attached to a Soup item.\n\nThis is a simplified representation that includes only the definition and value,\nomitting the entity property assignment metadata and options.'
)
)
- .describe('Properties'),
- sha: zod
- .string()
- .nullish()
- .describe(
- 'If the document is a PDF, this is the SHA of the pdf\nIf the document is a DOCX, this will not be present'
- ),
- subType: zod
- .union([
- zod.null(),
- zod
- .union([
- zod
- .object({
- is_completed: zod
- .boolean()
- .describe(
- 'Whether the task is completed.\nTrue if the Status property is set to \"Completed\".'
- ),
- type: zod.enum(['task']),
- })
- .describe(
- 'A task document with its associated properties'
- ),
- zod
- .object({
- type: zod.enum(['snippet']),
- })
- .describe('A snippet document — reusable markdown'),
- ])
- .describe(
- 'Sub type of a document with associated properties encoded in each variant.\nThis ensures type-safety: task properties only exist when the document is a task.'
- ),
- ])
- .optional(),
- updatedAt: zod.iso
- .datetime({})
- .describe(
- 'The time the document instance \/ document BOM was updated'
- ),
- viewedAt: zod.iso
- .datetime({})
- .nullish()
- .describe('The time the document was last viewed'),
+ .describe('Properties attached to the entity.'),
})
+ .describe(
+ 'Property fields that can be flattened into property-bearing Soup items.'
+ )
+ .and(
+ zod.object({
+ branchedFromId: zod
+ .uuid()
+ .nullish()
+ .describe(
+ 'The id of the document this document branched from'
+ ),
+ branchedFromVersionId: zod
+ .number()
+ .nullish()
+ .describe(
+ 'The id of the version this document branched from\nThis could be either DocumentInstance or DocumentBom id depending on the file type'
+ ),
+ createdAt: zod.iso
+ .datetime({})
+ .describe('The time the document was created'),
+ deletedAt: zod.iso
+ .datetime({})
+ .nullish()
+ .describe('The time the document was deleted'),
+ documentFamilyId: zod
+ .number()
+ .nullish()
+ .describe(
+ 'The id of the document family this document belongs to'
+ ),
+ documentVersionId: zod
+ .number()
+ .describe(
+ 'The version of the document\nThis could be the document_instance_id or document_bom_id depending on the file type'
+ ),
+ fileType: zod
+ .string()
+ .nullish()
+ .describe(
+ 'The file type of the document (e.g. pdf, docx)'
+ ),
+ id: zod.uuid().describe('The document id'),
+ name: zod.string().describe('The name of the document'),
+ ownerId: zod.string().describe('The owner of the document'),
+ projectId: zod
+ .uuid()
+ .nullish()
+ .describe(
+ 'The id of the project that this document belongs to'
+ ),
+ sha: zod
+ .string()
+ .nullish()
+ .describe(
+ 'If the document is a PDF, this is the SHA of the pdf\nIf the document is a DOCX, this will not be present'
+ ),
+ subType: zod
+ .union([
+ zod.null(),
+ zod
+ .union([
+ zod
+ .object({
+ is_completed: zod
+ .boolean()
+ .describe(
+ 'Whether the task is completed.\nTrue if the Status property is set to \"Completed\".'
+ ),
+ type: zod.enum(['task']),
+ })
+ .describe(
+ 'A task document with its associated properties'
+ ),
+ zod
+ .object({
+ type: zod.enum(['snippet']),
+ })
+ .describe(
+ 'A snippet document — reusable markdown'
+ ),
+ ])
+ .describe(
+ 'Sub type of a document with associated properties encoded in each variant.\nThis ensures type-safety: task properties only exist when the document is a task.'
+ ),
+ ])
+ .optional(),
+ updatedAt: zod.iso
+ .datetime({})
+ .describe(
+ 'The time the document instance \/ document BOM was updated'
+ ),
+ viewedAt: zod.iso
+ .datetime({})
+ .nullish()
+ .describe('The time the document was last viewed'),
+ })
+ )
.describe('A document as displayed in Soup.'),
tag: zod.enum(['document']),
})
@@ -9862,23 +9915,6 @@ export const postItemsSoupResponse = zod
.object({
data: zod
.object({
- createdAt: zod.iso
- .datetime({})
- .describe('The time the chat was created'),
- deletedAt: zod.iso
- .datetime({})
- .nullish()
- .describe('The time the chat was deleted'),
- id: zod.uuid().describe('The chat uuid'),
- isPersistent: zod
- .boolean()
- .describe('Whether the chat is persistent or not'),
- name: zod.string().describe('The name of the chat'),
- ownerId: zod.string().describe('Who the chat belongs to'),
- projectId: zod
- .uuid()
- .nullish()
- .describe('The project id of the chat'),
properties: zod
.array(
zod
@@ -10098,15 +10134,39 @@ export const postItemsSoupResponse = zod
'A property attached to a Soup item.\n\nThis is a simplified representation that includes only the definition and value,\nomitting the entity property assignment metadata and options.'
)
)
- .describe('Properties'),
- updatedAt: zod.iso
- .datetime({})
- .describe('The time the chat was last updated'),
- viewedAt: zod.iso
- .datetime({})
- .nullish()
- .describe('The time the chat was last viewed'),
+ .describe('Properties attached to the entity.'),
})
+ .describe(
+ 'Property fields that can be flattened into property-bearing Soup items.'
+ )
+ .and(
+ zod.object({
+ createdAt: zod.iso
+ .datetime({})
+ .describe('The time the chat was created'),
+ deletedAt: zod.iso
+ .datetime({})
+ .nullish()
+ .describe('The time the chat was deleted'),
+ id: zod.uuid().describe('The chat uuid'),
+ isPersistent: zod
+ .boolean()
+ .describe('Whether the chat is persistent or not'),
+ name: zod.string().describe('The name of the chat'),
+ ownerId: zod.string().describe('Who the chat belongs to'),
+ projectId: zod
+ .uuid()
+ .nullish()
+ .describe('The project id of the chat'),
+ updatedAt: zod.iso
+ .datetime({})
+ .describe('The time the chat was last updated'),
+ viewedAt: zod.iso
+ .datetime({})
+ .nullish()
+ .describe('The time the chat was last viewed'),
+ })
+ )
.describe('A chat as displayed in Soup.'),
tag: zod.enum(['chat']),
})
@@ -10115,22 +10175,6 @@ export const postItemsSoupResponse = zod
.object({
data: zod
.object({
- createdAt: zod.iso
- .datetime({})
- .describe('The time the project was created'),
- deletedAt: zod.iso
- .datetime({})
- .nullish()
- .describe('The time the project was deleted'),
- id: zod.uuid().describe('The id of the project'),
- name: zod.string().describe('The name of the project'),
- ownerId: zod
- .string()
- .describe('The user id of who created the project'),
- parentId: zod
- .uuid()
- .nullish()
- .describe('The parent project id'),
properties: zod
.array(
zod
@@ -10335,94 +10379,345 @@ export const postItemsSoupResponse = zod
.describe(
'Link value(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\"]} (length 0 or 1)\nMulti-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\", \"https:\/\/other.com\"]} (length 0+)'
),
- })
+ })
+ .describe(
+ 'Link value(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\"]} (length 0 or 1)\nMulti-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\", \"https:\/\/other.com\"]} (length 0+)'
+ ),
+ ])
+ .describe(
+ 'Property value (service representation).\n\nRepresents the actual value stored for an entity property.\nThis is serialized to\/from JSONB in the database.'
+ ),
+ ])
+ .optional(),
+ })
+ .describe(
+ 'A property attached to a Soup item.\n\nThis is a simplified representation that includes only the definition and value,\nomitting the entity property assignment metadata and options.'
+ )
+ )
+ .describe('Properties attached to the entity.'),
+ })
+ .describe(
+ 'Property fields that can be flattened into property-bearing Soup items.'
+ )
+ .and(
+ zod.object({
+ createdAt: zod.iso
+ .datetime({})
+ .describe('The time the project was created'),
+ deletedAt: zod.iso
+ .datetime({})
+ .nullish()
+ .describe('The time the project was deleted'),
+ id: zod.uuid().describe('The id of the project'),
+ name: zod.string().describe('The name of the project'),
+ ownerId: zod
+ .string()
+ .describe('The user id of who created the project'),
+ parentId: zod
+ .uuid()
+ .nullish()
+ .describe('The parent project id'),
+ updatedAt: zod.iso
+ .datetime({})
+ .describe('The time the project was updated'),
+ viewedAt: zod.iso
+ .datetime({})
+ .nullish()
+ .describe('The time the document was last viewed'),
+ })
+ )
+ .describe('A project as displayed in Soup.'),
+ tag: zod.enum(['project']),
+ })
+ .describe('Project item.'),
+ zod
+ .object({
+ data: zod
+ .object({
+ createdAt: zod.iso
+ .datetime({})
+ .describe('Timestamp when the thread was created.'),
+ id: zod.uuid().describe('Thread id.'),
+ inboxVisible: zod
+ .boolean()
+ .describe('Whether the thread should appear in the inbox.'),
+ isDraft: zod
+ .boolean()
+ .describe('Whether the thread contains a draft.'),
+ isImportant: zod
+ .boolean()
+ .describe('Whether the thread is marked important.'),
+ isRead: zod
+ .boolean()
+ .describe('Whether the thread has been read.'),
+ name: zod
+ .string()
+ .nullish()
+ .describe('Thread display name or subject.'),
+ ownerId: zod.string().describe('Owner user id.'),
+ projectId: zod
+ .string()
+ .nullish()
+ .describe('Project id associated with the thread.'),
+ providerId: zod
+ .string()
+ .nullish()
+ .describe('Provider-specific thread id.'),
+ senderEmail: zod
+ .string()
+ .nullish()
+ .describe('Sender email address for the preview.'),
+ senderName: zod
+ .string()
+ .nullish()
+ .describe('Sender display name for the preview.'),
+ senderPhotoUrl: zod
+ .string()
+ .nullish()
+ .describe('Sender photo URL for the preview.'),
+ snippet: zod.string().nullish().describe('Thread snippet.'),
+ sortTs: zod.iso
+ .datetime({})
+ .describe('Timestamp used for email thread sorting.'),
+ updatedAt: zod.iso
+ .datetime({})
+ .describe('Timestamp when the thread was last updated.'),
+ viewedAt: zod.iso
+ .datetime({})
+ .nullish()
+ .describe(
+ 'Timestamp when the requesting user last viewed the thread.'
+ ),
+ })
+ .describe('Email thread preview data as displayed in Soup.')
+ .and(
+ zod
+ .object({
+ properties: zod
+ .array(
+ zod
+ .object({
+ definition: zod
+ .object({
+ created_at: zod.iso.datetime({}),
+ data_type: zod
+ .enum([
+ 'BOOLEAN',
+ 'DATE',
+ 'NUMBER',
+ 'STRING',
+ 'SELECT_NUMBER',
+ 'SELECT_STRING',
+ 'TAG',
+ 'ENTITY',
+ 'LINK',
+ ])
+ .describe(
+ 'Data type for property values, determining storage and validation.'
+ ),
+ display_name: zod.string(),
+ id: zod.uuid(),
+ is_metadata: zod
+ .boolean()
+ .describe(
+ 'Flag to indicate if this is a system-generated metadata property.\nNot stored in database - computed at service layer.'
+ ),
+ is_multi_select: zod.boolean(),
+ is_system: zod
+ .boolean()
+ .describe(
+ 'Flag to indicate if this is a system property (stored in DB).'
+ ),
+ owner: zod
+ .union([
+ zod
+ .object({
+ scope: zod.enum(['user']),
+ user_id: zod.string(),
+ })
+ .describe('User-scoped property.'),
+ zod
+ .object({
+ scope: zod.enum(['team']),
+ team_id: zod.uuid(),
+ })
+ .describe('Team-scoped property.'),
+ zod
+ .object({
+ scope: zod.enum(['system']),
+ })
+ .describe(
+ 'System-owned property (no user or team owner).'
+ ),
+ ])
+ .describe(
+ 'Defines who owns a property - user-scoped, team-scoped, or system.'
+ ),
+ specific_entity_type: zod
+ .union([
+ zod.null(),
+ zod
+ .enum([
+ 'CALL_RECORD',
+ 'CHANNEL',
+ 'CHAT',
+ 'COMPANY',
+ 'DOCUMENT',
+ 'PROJECT',
+ 'TASK',
+ 'THREAD',
+ 'USER',
+ ])
+ .describe(
+ 'Type of entity that can be referenced by entity properties.'
+ ),
+ ])
+ .optional(),
+ updated_at: zod.iso.datetime({}),
+ })
+ .describe(
+ 'Property definition model (service representation).'
+ ),
+ id: zod
+ .uuid()
+ .describe(
+ 'Globally unique id of the assignment attaching this property to an entity.'
+ ),
+ value: zod
+ .union([
+ zod.null(),
+ zod
+ .union([
+ zod
+ .object({
+ type: zod.enum(['Boolean']),
+ value: zod
+ .boolean()
+ .describe(
+ 'Boolean value\nSerializes as: {\"type\": \"Boolean\", \"value\": true}'
+ ),
+ })
+ .describe(
+ 'Boolean value\nSerializes as: {\"type\": \"Boolean\", \"value\": true}'
+ ),
+ zod
+ .object({
+ type: zod.enum(['Number']),
+ value: zod
+ .number()
+ .describe(
+ 'Numeric value\nSerializes as: {\"type\": \"Number\", \"value\": 42.5}'
+ ),
+ })
+ .describe(
+ 'Numeric value\nSerializes as: {\"type\": \"Number\", \"value\": 42.5}'
+ ),
+ zod
+ .object({
+ type: zod.enum(['String']),
+ value: zod
+ .string()
+ .describe(
+ 'String value\nSerializes as: {\"type\": \"String\", \"value\": \"text\"}'
+ ),
+ })
+ .describe(
+ 'String value\nSerializes as: {\"type\": \"String\", \"value\": \"text\"}'
+ ),
+ zod
+ .object({
+ type: zod.enum(['Date']),
+ value: zod.iso
+ .datetime({})
+ .describe(
+ 'Date\/timestamp value\nSerializes as: {\"type\": \"Date\", \"value\": \"2025-01-01T00:00:00Z\"}'
+ ),
+ })
+ .describe(
+ 'Date\/timestamp value\nSerializes as: {\"type\": \"Date\", \"value\": \"2025-01-01T00:00:00Z\"}'
+ ),
+ zod
+ .object({
+ type: zod.enum(['SelectOption']),
+ value: zod
+ .array(zod.uuid())
+ .describe(
+ 'Select option(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"SelectOption\", \"value\": [\"uuid\"]} (length 0 or 1)\nMulti-select: {\"type\": \"SelectOption\", \"value\": [\"uuid1\", \"uuid2\", ...]} (length 0+)'
+ ),
+ })
+ .describe(
+ 'Select option(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"SelectOption\", \"value\": [\"uuid\"]} (length 0 or 1)\nMulti-select: {\"type\": \"SelectOption\", \"value\": [\"uuid1\", \"uuid2\", ...]} (length 0+)'
+ ),
+ zod
+ .object({
+ type: zod.enum(['EntityReference']),
+ value: zod
+ .array(
+ zod
+ .object({
+ entity_id: zod.string(),
+ entity_type: zod
+ .enum([
+ 'CALL_RECORD',
+ 'CHANNEL',
+ 'CHAT',
+ 'COMPANY',
+ 'DOCUMENT',
+ 'PROJECT',
+ 'TASK',
+ 'THREAD',
+ 'USER',
+ ])
+ .describe(
+ 'Type of entity that can be referenced by entity properties.'
+ ),
+ specific_message_id: zod
+ .uuid()
+ .nullish()
+ .describe(
+ 'For CHANNEL, CHAT, THREAD entity types - optional specific message ID.\nThis allows referencing a specific message within a thread\/channel\/chat.'
+ ),
+ })
+ .describe(
+ 'Entity reference for entity-type property values.'
+ )
+ )
+ .describe(
+ 'Entity reference(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"EntityReference\", \"value\": [{...}]} (length 0 or 1)\nMulti-select: {\"type\": \"EntityReference\", \"value\": [{...}, {...}, ...]} (length 0+)'
+ ),
+ })
+ .describe(
+ 'Entity reference(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"EntityReference\", \"value\": [{...}]} (length 0 or 1)\nMulti-select: {\"type\": \"EntityReference\", \"value\": [{...}, {...}, ...]} (length 0+)'
+ ),
+ zod
+ .object({
+ type: zod.enum(['Link']),
+ value: zod
+ .array(zod.string())
+ .describe(
+ 'Link value(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\"]} (length 0 or 1)\nMulti-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\", \"https:\/\/other.com\"]} (length 0+)'
+ ),
+ })
+ .describe(
+ 'Link value(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\"]} (length 0 or 1)\nMulti-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\", \"https:\/\/other.com\"]} (length 0+)'
+ ),
+ ])
.describe(
- 'Link value(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\"]} (length 0 or 1)\nMulti-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\", \"https:\/\/other.com\"]} (length 0+)'
+ 'Property value (service representation).\n\nRepresents the actual value stored for an entity property.\nThis is serialized to\/from JSONB in the database.'
),
])
- .describe(
- 'Property value (service representation).\n\nRepresents the actual value stored for an entity property.\nThis is serialized to\/from JSONB in the database.'
- ),
- ])
- .optional(),
- })
- .describe(
- 'A property attached to a Soup item.\n\nThis is a simplified representation that includes only the definition and value,\nomitting the entity property assignment metadata and options.'
+ .optional(),
+ })
+ .describe(
+ 'A property attached to a Soup item.\n\nThis is a simplified representation that includes only the definition and value,\nomitting the entity property assignment metadata and options.'
+ )
)
- )
- .describe('Properties'),
- updatedAt: zod.iso
- .datetime({})
- .describe('The time the project was updated'),
- viewedAt: zod.iso
- .datetime({})
- .nullish()
- .describe('The time the document was last viewed'),
- })
- .describe('A project as displayed in Soup.'),
- tag: zod.enum(['project']),
- })
- .describe('Project item.'),
- zod
- .object({
- data: zod
- .object({
- createdAt: zod.iso
- .datetime({})
- .describe('Timestamp when the thread was created.'),
- id: zod.uuid().describe('Thread id.'),
- inboxVisible: zod
- .boolean()
- .describe('Whether the thread should appear in the inbox.'),
- isDraft: zod
- .boolean()
- .describe('Whether the thread contains a draft.'),
- isImportant: zod
- .boolean()
- .describe('Whether the thread is marked important.'),
- isRead: zod
- .boolean()
- .describe('Whether the thread has been read.'),
- name: zod
- .string()
- .nullish()
- .describe('Thread display name or subject.'),
- ownerId: zod.string().describe('Owner user id.'),
- projectId: zod
- .string()
- .nullish()
- .describe('Project id associated with the thread.'),
- providerId: zod
- .string()
- .nullish()
- .describe('Provider-specific thread id.'),
- senderEmail: zod
- .string()
- .nullish()
- .describe('Sender email address for the preview.'),
- senderName: zod
- .string()
- .nullish()
- .describe('Sender display name for the preview.'),
- senderPhotoUrl: zod
- .string()
- .nullish()
- .describe('Sender photo URL for the preview.'),
- snippet: zod.string().nullish().describe('Thread snippet.'),
- sortTs: zod.iso
- .datetime({})
- .describe('Timestamp used for email thread sorting.'),
- updatedAt: zod.iso
- .datetime({})
- .describe('Timestamp when the thread was last updated.'),
- viewedAt: zod.iso
- .datetime({})
- .nullish()
+ .describe('Properties attached to the entity.'),
+ })
.describe(
- 'Timestamp when the requesting user last viewed the thread.'
- ),
- })
- .describe('Email thread preview data as displayed in Soup.')
+ 'Property fields that can be flattened into property-bearing Soup items.'
+ )
+ )
.and(
zod.object({
attachments: zod
@@ -10534,226 +10829,6 @@ export const postItemsSoupResponse = zod
)
)
.describe('Contacts participating in the thread.'),
- properties: zod
- .array(
- zod
- .object({
- definition: zod
- .object({
- created_at: zod.iso.datetime({}),
- data_type: zod
- .enum([
- 'BOOLEAN',
- 'DATE',
- 'NUMBER',
- 'STRING',
- 'SELECT_NUMBER',
- 'SELECT_STRING',
- 'TAG',
- 'ENTITY',
- 'LINK',
- ])
- .describe(
- 'Data type for property values, determining storage and validation.'
- ),
- display_name: zod.string(),
- id: zod.uuid(),
- is_metadata: zod
- .boolean()
- .describe(
- 'Flag to indicate if this is a system-generated metadata property.\nNot stored in database - computed at service layer.'
- ),
- is_multi_select: zod.boolean(),
- is_system: zod
- .boolean()
- .describe(
- 'Flag to indicate if this is a system property (stored in DB).'
- ),
- owner: zod
- .union([
- zod
- .object({
- scope: zod.enum(['user']),
- user_id: zod.string(),
- })
- .describe('User-scoped property.'),
- zod
- .object({
- scope: zod.enum(['team']),
- team_id: zod.uuid(),
- })
- .describe('Team-scoped property.'),
- zod
- .object({
- scope: zod.enum(['system']),
- })
- .describe(
- 'System-owned property (no user or team owner).'
- ),
- ])
- .describe(
- 'Defines who owns a property - user-scoped, team-scoped, or system.'
- ),
- specific_entity_type: zod
- .union([
- zod.null(),
- zod
- .enum([
- 'CALL_RECORD',
- 'CHANNEL',
- 'CHAT',
- 'COMPANY',
- 'DOCUMENT',
- 'PROJECT',
- 'TASK',
- 'THREAD',
- 'USER',
- ])
- .describe(
- 'Type of entity that can be referenced by entity properties.'
- ),
- ])
- .optional(),
- updated_at: zod.iso.datetime({}),
- })
- .describe(
- 'Property definition model (service representation).'
- ),
- id: zod
- .uuid()
- .describe(
- 'Globally unique id of the assignment attaching this property to an entity.'
- ),
- value: zod
- .union([
- zod.null(),
- zod
- .union([
- zod
- .object({
- type: zod.enum(['Boolean']),
- value: zod
- .boolean()
- .describe(
- 'Boolean value\nSerializes as: {\"type\": \"Boolean\", \"value\": true}'
- ),
- })
- .describe(
- 'Boolean value\nSerializes as: {\"type\": \"Boolean\", \"value\": true}'
- ),
- zod
- .object({
- type: zod.enum(['Number']),
- value: zod
- .number()
- .describe(
- 'Numeric value\nSerializes as: {\"type\": \"Number\", \"value\": 42.5}'
- ),
- })
- .describe(
- 'Numeric value\nSerializes as: {\"type\": \"Number\", \"value\": 42.5}'
- ),
- zod
- .object({
- type: zod.enum(['String']),
- value: zod
- .string()
- .describe(
- 'String value\nSerializes as: {\"type\": \"String\", \"value\": \"text\"}'
- ),
- })
- .describe(
- 'String value\nSerializes as: {\"type\": \"String\", \"value\": \"text\"}'
- ),
- zod
- .object({
- type: zod.enum(['Date']),
- value: zod.iso
- .datetime({})
- .describe(
- 'Date\/timestamp value\nSerializes as: {\"type\": \"Date\", \"value\": \"2025-01-01T00:00:00Z\"}'
- ),
- })
- .describe(
- 'Date\/timestamp value\nSerializes as: {\"type\": \"Date\", \"value\": \"2025-01-01T00:00:00Z\"}'
- ),
- zod
- .object({
- type: zod.enum(['SelectOption']),
- value: zod
- .array(zod.uuid())
- .describe(
- 'Select option(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"SelectOption\", \"value\": [\"uuid\"]} (length 0 or 1)\nMulti-select: {\"type\": \"SelectOption\", \"value\": [\"uuid1\", \"uuid2\", ...]} (length 0+)'
- ),
- })
- .describe(
- 'Select option(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"SelectOption\", \"value\": [\"uuid\"]} (length 0 or 1)\nMulti-select: {\"type\": \"SelectOption\", \"value\": [\"uuid1\", \"uuid2\", ...]} (length 0+)'
- ),
- zod
- .object({
- type: zod.enum(['EntityReference']),
- value: zod
- .array(
- zod
- .object({
- entity_id: zod.string(),
- entity_type: zod
- .enum([
- 'CALL_RECORD',
- 'CHANNEL',
- 'CHAT',
- 'COMPANY',
- 'DOCUMENT',
- 'PROJECT',
- 'TASK',
- 'THREAD',
- 'USER',
- ])
- .describe(
- 'Type of entity that can be referenced by entity properties.'
- ),
- specific_message_id: zod
- .uuid()
- .nullish()
- .describe(
- 'For CHANNEL, CHAT, THREAD entity types - optional specific message ID.\nThis allows referencing a specific message within a thread\/channel\/chat.'
- ),
- })
- .describe(
- 'Entity reference for entity-type property values.'
- )
- )
- .describe(
- 'Entity reference(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"EntityReference\", \"value\": [{...}]} (length 0 or 1)\nMulti-select: {\"type\": \"EntityReference\", \"value\": [{...}, {...}, ...]} (length 0+)'
- ),
- })
- .describe(
- 'Entity reference(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"EntityReference\", \"value\": [{...}]} (length 0 or 1)\nMulti-select: {\"type\": \"EntityReference\", \"value\": [{...}, {...}, ...]} (length 0+)'
- ),
- zod
- .object({
- type: zod.enum(['Link']),
- value: zod
- .array(zod.string())
- .describe(
- 'Link value(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\"]} (length 0 or 1)\nMulti-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\", \"https:\/\/other.com\"]} (length 0+)'
- ),
- })
- .describe(
- 'Link value(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\"]} (length 0 or 1)\nMulti-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\", \"https:\/\/other.com\"]} (length 0+)'
- ),
- ])
- .describe(
- 'Property value (service representation).\n\nRepresents the actual value stored for an entity property.\nThis is serialized to\/from JSONB in the database.'
- ),
- ])
- .optional(),
- })
- .describe(
- 'A property attached to a Soup item.\n\nThis is a simplified representation that includes only the definition and value,\nomitting the entity property assignment metadata and options.'
- )
- )
- .describe('Properties attached to the thread.'),
})
)
.describe(
@@ -11110,61 +11185,6 @@ export const postItemsSoupResponse = zod
.object({
data: zod
.object({
- attended: zod
- .boolean()
- .describe(
- 'Whether the requesting user attended this call. Kept for compatibility\nand derived from `status == ATTENDED`.'
- ),
- callId: zod.uuid().describe('The call identifier.'),
- channelId: zod
- .uuid()
- .describe('The channel this call belongs to.'),
- channelName: zod
- .string()
- .nullish()
- .describe('Resolved display name for the channel.'),
- createdBy: zod
- .string()
- .describe('User who created the call.'),
- customName: zod
- .string()
- .nullish()
- .describe(
- 'User-supplied or AI-generated display name for the call.'
- ),
- durationMs: zod
- .number()
- .nullish()
- .describe(
- 'Call duration in milliseconds (None if still active).'
- ),
- endedAt: zod.iso
- .datetime({})
- .nullish()
- .describe('When the call ended (None if still active).'),
- isActive: zod
- .boolean()
- .describe('Whether the call is currently active.'),
- participants: zod
- .array(
- zod
- .object({
- joinedAt: zod.iso
- .datetime({})
- .describe('When the user joined the call.'),
- leftAt: zod.iso
- .datetime({})
- .nullish()
- .describe(
- 'When the user left (None if still in an active call).'
- ),
- userId: zod.string().describe('The user id.'),
- })
- .describe(
- 'A participant in a call record, as displayed in Soup.'
- )
- )
- .describe('Participants in the call.'),
properties: zod
.array(
zod
@@ -11383,25 +11403,85 @@ export const postItemsSoupResponse = zod
.describe(
'A property attached to a Soup item.\n\nThis is a simplified representation that includes only the definition and value,\nomitting the entity property assignment metadata and options.'
)
- )
- .describe(
- 'Entity properties (e.g. tags). Populated after fetch by the soup repo.'
- ),
- startedAt: zod.iso
- .datetime({})
- .describe('When the call started.'),
- status: zod
- .enum(['ATTENDED', 'MISSED', 'UNATTENDED'])
- .describe(
- 'Viewer-relative attendance status for a call record.\nSerializes as `ATTENDED`, `MISSED`, or `UNATTENDED`.'
- ),
- summary: zod
- .string()
- .nullish()
- .describe(
- 'AI-generated summary of the call. Only set on archived\n`call_records` once summarization has run; active calls always\nreturn `None`.'
- ),
+ )
+ .describe('Properties attached to the entity.'),
})
+ .describe(
+ 'Property fields that can be flattened into property-bearing Soup items.'
+ )
+ .and(
+ zod.object({
+ attended: zod
+ .boolean()
+ .describe(
+ 'Whether the requesting user attended this call. Kept for compatibility\nand derived from `status == ATTENDED`.'
+ ),
+ callId: zod.uuid().describe('The call identifier.'),
+ channelId: zod
+ .uuid()
+ .describe('The channel this call belongs to.'),
+ channelName: zod
+ .string()
+ .nullish()
+ .describe('Resolved display name for the channel.'),
+ createdBy: zod
+ .string()
+ .describe('User who created the call.'),
+ customName: zod
+ .string()
+ .nullish()
+ .describe(
+ 'User-supplied or AI-generated display name for the call.'
+ ),
+ durationMs: zod
+ .number()
+ .nullish()
+ .describe(
+ 'Call duration in milliseconds (None if still active).'
+ ),
+ endedAt: zod.iso
+ .datetime({})
+ .nullish()
+ .describe('When the call ended (None if still active).'),
+ isActive: zod
+ .boolean()
+ .describe('Whether the call is currently active.'),
+ participants: zod
+ .array(
+ zod
+ .object({
+ joinedAt: zod.iso
+ .datetime({})
+ .describe('When the user joined the call.'),
+ leftAt: zod.iso
+ .datetime({})
+ .nullish()
+ .describe(
+ 'When the user left (None if still in an active call).'
+ ),
+ userId: zod.string().describe('The user id.'),
+ })
+ .describe(
+ 'A participant in a call record, as displayed in Soup.'
+ )
+ )
+ .describe('Participants in the call.'),
+ startedAt: zod.iso
+ .datetime({})
+ .describe('When the call started.'),
+ status: zod
+ .enum(['ATTENDED', 'MISSED', 'UNATTENDED'])
+ .describe(
+ 'Viewer-relative attendance status for a call record.\nSerializes as `ATTENDED`, `MISSED`, or `UNATTENDED`.'
+ ),
+ summary: zod
+ .string()
+ .nullish()
+ .describe(
+ 'AI-generated summary of the call. Only set on archived\n`call_records` once summarization has run; active calls always\nreturn `None`.'
+ ),
+ })
+ )
.describe(
'A call record as displayed in Soup. Excludes room_name, egress_id,\nand transcript — fields that are irrelevant for the soup feed.'
),
@@ -11412,60 +11492,6 @@ export const postItemsSoupResponse = zod
.object({
data: zod
.object({
- createdAt: zod.iso
- .datetime({})
- .describe('When the company was created.'),
- description: zod
- .string()
- .nullish()
- .describe(
- "Display description from the primary domain's directory entry."
- ),
- domains: zod
- .array(
- zod
- .object({
- companyId: zod
- .uuid()
- .describe(
- 'The id of the company the domain belongs to.'
- ),
- createdAt: zod.iso
- .datetime({})
- .describe('When the domain record was created.'),
- domain: zod
- .string()
- .describe(
- 'The domain (lowercased, e.g. \"acme.com\").'
- ),
- id: zod
- .uuid()
- .describe('The id of the domain record.'),
- })
- .describe(
- "A CRM domain as displayed in Soup. Mirrors the crm crate's\n[`CrmDomain`] with a stable wire shape that the FE can rely on."
- )
- )
- .describe(
- 'Domains associated with this company, ordered by creation time\nascending (primary first).'
- ),
- emailSync: zod
- .boolean()
- .describe(
- 'Whether email sync is enabled for this company.'
- ),
- hidden: zod
- .boolean()
- .describe(
- 'Whether the company is hidden from CRM listings. Soup filters\nthese out by default.'
- ),
- id: zod.uuid().describe('The id of the company.'),
- name: zod
- .string()
- .nullish()
- .describe(
- "Display name from the primary domain's directory entry, or\n`None` when unresolved."
- ),
properties: zod
.array(
zod
@@ -11685,25 +11711,83 @@ export const postItemsSoupResponse = zod
'A property attached to a Soup item.\n\nThis is a simplified representation that includes only the definition and value,\nomitting the entity property assignment metadata and options.'
)
)
- .optional()
- .describe(
- 'Properties attached to this company (system CRM properties like\nStage \/ Owner \/ Revenue plus any custom ones).'
- ),
- teamId: zod
- .uuid()
- .describe(
- 'The id of the team that owns this company record.'
- ),
- updatedAt: zod.iso
- .datetime({})
- .describe('When the company was last updated.'),
- viewedAt: zod.iso
- .datetime({})
- .nullish()
- .describe(
- 'When the requesting user last viewed this company, or `None` if\nnever viewed. Mirrors the `viewed_at` other soup entities carry.'
- ),
+ .describe('Properties attached to the entity.'),
})
+ .describe(
+ 'Property fields that can be flattened into property-bearing Soup items.'
+ )
+ .and(
+ zod.object({
+ createdAt: zod.iso
+ .datetime({})
+ .describe('When the company was created.'),
+ description: zod
+ .string()
+ .nullish()
+ .describe(
+ "Display description from the primary domain's directory entry."
+ ),
+ domains: zod
+ .array(
+ zod
+ .object({
+ companyId: zod
+ .uuid()
+ .describe(
+ 'The id of the company the domain belongs to.'
+ ),
+ createdAt: zod.iso
+ .datetime({})
+ .describe('When the domain record was created.'),
+ domain: zod
+ .string()
+ .describe(
+ 'The domain (lowercased, e.g. \"acme.com\").'
+ ),
+ id: zod
+ .uuid()
+ .describe('The id of the domain record.'),
+ })
+ .describe(
+ "A CRM domain as displayed in Soup. Mirrors the crm crate's\n[`CrmDomain`] with a stable wire shape that the FE can rely on."
+ )
+ )
+ .describe(
+ 'Domains associated with this company, ordered by creation time\nascending (primary first).'
+ ),
+ emailSync: zod
+ .boolean()
+ .describe(
+ 'Whether email sync is enabled for this company.'
+ ),
+ hidden: zod
+ .boolean()
+ .describe(
+ 'Whether the company is hidden from CRM listings. Soup filters\nthese out by default.'
+ ),
+ id: zod.uuid().describe('The id of the company.'),
+ name: zod
+ .string()
+ .nullish()
+ .describe(
+ "Display name from the primary domain's directory entry, or\n`None` when unresolved."
+ ),
+ teamId: zod
+ .uuid()
+ .describe(
+ 'The id of the team that owns this company record.'
+ ),
+ updatedAt: zod.iso
+ .datetime({})
+ .describe('When the company was last updated.'),
+ viewedAt: zod.iso
+ .datetime({})
+ .nullish()
+ .describe(
+ 'When the requesting user last viewed this company, or `None` if\nnever viewed. Mirrors the `viewed_at` other soup entities carry.'
+ ),
+ })
+ )
.describe(
'A CRM company as displayed in Soup. Carries the core company\nfields plus display metadata resolved from `crm_domain_directory`\nagainst the primary (earliest-created) domain.'
),
@@ -11896,49 +11980,6 @@ export const postItemsSoupAstResponse = zod
.object({
data: zod
.object({
- branchedFromId: zod
- .uuid()
- .nullish()
- .describe(
- 'The id of the document this document branched from'
- ),
- branchedFromVersionId: zod
- .number()
- .nullish()
- .describe(
- 'The id of the version this document branched from\nThis could be either DocumentInstance or DocumentBom id depending on the file type'
- ),
- createdAt: zod.iso
- .datetime({})
- .describe('The time the document was created'),
- deletedAt: zod.iso
- .datetime({})
- .nullish()
- .describe('The time the document was deleted'),
- documentFamilyId: zod
- .number()
- .nullish()
- .describe(
- 'The id of the document family this document belongs to'
- ),
- documentVersionId: zod
- .number()
- .describe(
- 'The version of the document\nThis could be the document_instance_id or document_bom_id depending on the file type'
- ),
- fileType: zod
- .string()
- .nullish()
- .describe('The file type of the document (e.g. pdf, docx)'),
- id: zod.uuid().describe('The document id'),
- name: zod.string().describe('The name of the document'),
- ownerId: zod.string().describe('The owner of the document'),
- projectId: zod
- .uuid()
- .nullish()
- .describe(
- 'The id of the project that this document belongs to'
- ),
properties: zod
.array(
zod
@@ -12158,51 +12199,105 @@ export const postItemsSoupAstResponse = zod
'A property attached to a Soup item.\n\nThis is a simplified representation that includes only the definition and value,\nomitting the entity property assignment metadata and options.'
)
)
- .describe('Properties'),
- sha: zod
- .string()
- .nullish()
- .describe(
- 'If the document is a PDF, this is the SHA of the pdf\nIf the document is a DOCX, this will not be present'
- ),
- subType: zod
- .union([
- zod.null(),
- zod
- .union([
- zod
- .object({
- is_completed: zod
- .boolean()
- .describe(
- 'Whether the task is completed.\nTrue if the Status property is set to \"Completed\".'
- ),
- type: zod.enum(['task']),
- })
- .describe(
- 'A task document with its associated properties'
- ),
- zod
- .object({
- type: zod.enum(['snippet']),
- })
- .describe('A snippet document — reusable markdown'),
- ])
- .describe(
- 'Sub type of a document with associated properties encoded in each variant.\nThis ensures type-safety: task properties only exist when the document is a task.'
- ),
- ])
- .optional(),
- updatedAt: zod.iso
- .datetime({})
- .describe(
- 'The time the document instance \/ document BOM was updated'
- ),
- viewedAt: zod.iso
- .datetime({})
- .nullish()
- .describe('The time the document was last viewed'),
+ .describe('Properties attached to the entity.'),
})
+ .describe(
+ 'Property fields that can be flattened into property-bearing Soup items.'
+ )
+ .and(
+ zod.object({
+ branchedFromId: zod
+ .uuid()
+ .nullish()
+ .describe(
+ 'The id of the document this document branched from'
+ ),
+ branchedFromVersionId: zod
+ .number()
+ .nullish()
+ .describe(
+ 'The id of the version this document branched from\nThis could be either DocumentInstance or DocumentBom id depending on the file type'
+ ),
+ createdAt: zod.iso
+ .datetime({})
+ .describe('The time the document was created'),
+ deletedAt: zod.iso
+ .datetime({})
+ .nullish()
+ .describe('The time the document was deleted'),
+ documentFamilyId: zod
+ .number()
+ .nullish()
+ .describe(
+ 'The id of the document family this document belongs to'
+ ),
+ documentVersionId: zod
+ .number()
+ .describe(
+ 'The version of the document\nThis could be the document_instance_id or document_bom_id depending on the file type'
+ ),
+ fileType: zod
+ .string()
+ .nullish()
+ .describe(
+ 'The file type of the document (e.g. pdf, docx)'
+ ),
+ id: zod.uuid().describe('The document id'),
+ name: zod.string().describe('The name of the document'),
+ ownerId: zod.string().describe('The owner of the document'),
+ projectId: zod
+ .uuid()
+ .nullish()
+ .describe(
+ 'The id of the project that this document belongs to'
+ ),
+ sha: zod
+ .string()
+ .nullish()
+ .describe(
+ 'If the document is a PDF, this is the SHA of the pdf\nIf the document is a DOCX, this will not be present'
+ ),
+ subType: zod
+ .union([
+ zod.null(),
+ zod
+ .union([
+ zod
+ .object({
+ is_completed: zod
+ .boolean()
+ .describe(
+ 'Whether the task is completed.\nTrue if the Status property is set to \"Completed\".'
+ ),
+ type: zod.enum(['task']),
+ })
+ .describe(
+ 'A task document with its associated properties'
+ ),
+ zod
+ .object({
+ type: zod.enum(['snippet']),
+ })
+ .describe(
+ 'A snippet document — reusable markdown'
+ ),
+ ])
+ .describe(
+ 'Sub type of a document with associated properties encoded in each variant.\nThis ensures type-safety: task properties only exist when the document is a task.'
+ ),
+ ])
+ .optional(),
+ updatedAt: zod.iso
+ .datetime({})
+ .describe(
+ 'The time the document instance \/ document BOM was updated'
+ ),
+ viewedAt: zod.iso
+ .datetime({})
+ .nullish()
+ .describe('The time the document was last viewed'),
+ })
+ )
.describe('A document as displayed in Soup.'),
tag: zod.enum(['document']),
})
@@ -12211,23 +12306,6 @@ export const postItemsSoupAstResponse = zod
.object({
data: zod
.object({
- createdAt: zod.iso
- .datetime({})
- .describe('The time the chat was created'),
- deletedAt: zod.iso
- .datetime({})
- .nullish()
- .describe('The time the chat was deleted'),
- id: zod.uuid().describe('The chat uuid'),
- isPersistent: zod
- .boolean()
- .describe('Whether the chat is persistent or not'),
- name: zod.string().describe('The name of the chat'),
- ownerId: zod.string().describe('Who the chat belongs to'),
- projectId: zod
- .uuid()
- .nullish()
- .describe('The project id of the chat'),
properties: zod
.array(
zod
@@ -12447,15 +12525,39 @@ export const postItemsSoupAstResponse = zod
'A property attached to a Soup item.\n\nThis is a simplified representation that includes only the definition and value,\nomitting the entity property assignment metadata and options.'
)
)
- .describe('Properties'),
- updatedAt: zod.iso
- .datetime({})
- .describe('The time the chat was last updated'),
- viewedAt: zod.iso
- .datetime({})
- .nullish()
- .describe('The time the chat was last viewed'),
+ .describe('Properties attached to the entity.'),
})
+ .describe(
+ 'Property fields that can be flattened into property-bearing Soup items.'
+ )
+ .and(
+ zod.object({
+ createdAt: zod.iso
+ .datetime({})
+ .describe('The time the chat was created'),
+ deletedAt: zod.iso
+ .datetime({})
+ .nullish()
+ .describe('The time the chat was deleted'),
+ id: zod.uuid().describe('The chat uuid'),
+ isPersistent: zod
+ .boolean()
+ .describe('Whether the chat is persistent or not'),
+ name: zod.string().describe('The name of the chat'),
+ ownerId: zod.string().describe('Who the chat belongs to'),
+ projectId: zod
+ .uuid()
+ .nullish()
+ .describe('The project id of the chat'),
+ updatedAt: zod.iso
+ .datetime({})
+ .describe('The time the chat was last updated'),
+ viewedAt: zod.iso
+ .datetime({})
+ .nullish()
+ .describe('The time the chat was last viewed'),
+ })
+ )
.describe('A chat as displayed in Soup.'),
tag: zod.enum(['chat']),
})
@@ -12464,22 +12566,6 @@ export const postItemsSoupAstResponse = zod
.object({
data: zod
.object({
- createdAt: zod.iso
- .datetime({})
- .describe('The time the project was created'),
- deletedAt: zod.iso
- .datetime({})
- .nullish()
- .describe('The time the project was deleted'),
- id: zod.uuid().describe('The id of the project'),
- name: zod.string().describe('The name of the project'),
- ownerId: zod
- .string()
- .describe('The user id of who created the project'),
- parentId: zod
- .uuid()
- .nullish()
- .describe('The parent project id'),
properties: zod
.array(
zod
@@ -12684,94 +12770,345 @@ export const postItemsSoupAstResponse = zod
.describe(
'Link value(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\"]} (length 0 or 1)\nMulti-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\", \"https:\/\/other.com\"]} (length 0+)'
),
- })
+ })
+ .describe(
+ 'Link value(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\"]} (length 0 or 1)\nMulti-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\", \"https:\/\/other.com\"]} (length 0+)'
+ ),
+ ])
+ .describe(
+ 'Property value (service representation).\n\nRepresents the actual value stored for an entity property.\nThis is serialized to\/from JSONB in the database.'
+ ),
+ ])
+ .optional(),
+ })
+ .describe(
+ 'A property attached to a Soup item.\n\nThis is a simplified representation that includes only the definition and value,\nomitting the entity property assignment metadata and options.'
+ )
+ )
+ .describe('Properties attached to the entity.'),
+ })
+ .describe(
+ 'Property fields that can be flattened into property-bearing Soup items.'
+ )
+ .and(
+ zod.object({
+ createdAt: zod.iso
+ .datetime({})
+ .describe('The time the project was created'),
+ deletedAt: zod.iso
+ .datetime({})
+ .nullish()
+ .describe('The time the project was deleted'),
+ id: zod.uuid().describe('The id of the project'),
+ name: zod.string().describe('The name of the project'),
+ ownerId: zod
+ .string()
+ .describe('The user id of who created the project'),
+ parentId: zod
+ .uuid()
+ .nullish()
+ .describe('The parent project id'),
+ updatedAt: zod.iso
+ .datetime({})
+ .describe('The time the project was updated'),
+ viewedAt: zod.iso
+ .datetime({})
+ .nullish()
+ .describe('The time the document was last viewed'),
+ })
+ )
+ .describe('A project as displayed in Soup.'),
+ tag: zod.enum(['project']),
+ })
+ .describe('Project item.'),
+ zod
+ .object({
+ data: zod
+ .object({
+ createdAt: zod.iso
+ .datetime({})
+ .describe('Timestamp when the thread was created.'),
+ id: zod.uuid().describe('Thread id.'),
+ inboxVisible: zod
+ .boolean()
+ .describe('Whether the thread should appear in the inbox.'),
+ isDraft: zod
+ .boolean()
+ .describe('Whether the thread contains a draft.'),
+ isImportant: zod
+ .boolean()
+ .describe('Whether the thread is marked important.'),
+ isRead: zod
+ .boolean()
+ .describe('Whether the thread has been read.'),
+ name: zod
+ .string()
+ .nullish()
+ .describe('Thread display name or subject.'),
+ ownerId: zod.string().describe('Owner user id.'),
+ projectId: zod
+ .string()
+ .nullish()
+ .describe('Project id associated with the thread.'),
+ providerId: zod
+ .string()
+ .nullish()
+ .describe('Provider-specific thread id.'),
+ senderEmail: zod
+ .string()
+ .nullish()
+ .describe('Sender email address for the preview.'),
+ senderName: zod
+ .string()
+ .nullish()
+ .describe('Sender display name for the preview.'),
+ senderPhotoUrl: zod
+ .string()
+ .nullish()
+ .describe('Sender photo URL for the preview.'),
+ snippet: zod.string().nullish().describe('Thread snippet.'),
+ sortTs: zod.iso
+ .datetime({})
+ .describe('Timestamp used for email thread sorting.'),
+ updatedAt: zod.iso
+ .datetime({})
+ .describe('Timestamp when the thread was last updated.'),
+ viewedAt: zod.iso
+ .datetime({})
+ .nullish()
+ .describe(
+ 'Timestamp when the requesting user last viewed the thread.'
+ ),
+ })
+ .describe('Email thread preview data as displayed in Soup.')
+ .and(
+ zod
+ .object({
+ properties: zod
+ .array(
+ zod
+ .object({
+ definition: zod
+ .object({
+ created_at: zod.iso.datetime({}),
+ data_type: zod
+ .enum([
+ 'BOOLEAN',
+ 'DATE',
+ 'NUMBER',
+ 'STRING',
+ 'SELECT_NUMBER',
+ 'SELECT_STRING',
+ 'TAG',
+ 'ENTITY',
+ 'LINK',
+ ])
+ .describe(
+ 'Data type for property values, determining storage and validation.'
+ ),
+ display_name: zod.string(),
+ id: zod.uuid(),
+ is_metadata: zod
+ .boolean()
+ .describe(
+ 'Flag to indicate if this is a system-generated metadata property.\nNot stored in database - computed at service layer.'
+ ),
+ is_multi_select: zod.boolean(),
+ is_system: zod
+ .boolean()
+ .describe(
+ 'Flag to indicate if this is a system property (stored in DB).'
+ ),
+ owner: zod
+ .union([
+ zod
+ .object({
+ scope: zod.enum(['user']),
+ user_id: zod.string(),
+ })
+ .describe('User-scoped property.'),
+ zod
+ .object({
+ scope: zod.enum(['team']),
+ team_id: zod.uuid(),
+ })
+ .describe('Team-scoped property.'),
+ zod
+ .object({
+ scope: zod.enum(['system']),
+ })
+ .describe(
+ 'System-owned property (no user or team owner).'
+ ),
+ ])
+ .describe(
+ 'Defines who owns a property - user-scoped, team-scoped, or system.'
+ ),
+ specific_entity_type: zod
+ .union([
+ zod.null(),
+ zod
+ .enum([
+ 'CALL_RECORD',
+ 'CHANNEL',
+ 'CHAT',
+ 'COMPANY',
+ 'DOCUMENT',
+ 'PROJECT',
+ 'TASK',
+ 'THREAD',
+ 'USER',
+ ])
+ .describe(
+ 'Type of entity that can be referenced by entity properties.'
+ ),
+ ])
+ .optional(),
+ updated_at: zod.iso.datetime({}),
+ })
+ .describe(
+ 'Property definition model (service representation).'
+ ),
+ id: zod
+ .uuid()
+ .describe(
+ 'Globally unique id of the assignment attaching this property to an entity.'
+ ),
+ value: zod
+ .union([
+ zod.null(),
+ zod
+ .union([
+ zod
+ .object({
+ type: zod.enum(['Boolean']),
+ value: zod
+ .boolean()
+ .describe(
+ 'Boolean value\nSerializes as: {\"type\": \"Boolean\", \"value\": true}'
+ ),
+ })
+ .describe(
+ 'Boolean value\nSerializes as: {\"type\": \"Boolean\", \"value\": true}'
+ ),
+ zod
+ .object({
+ type: zod.enum(['Number']),
+ value: zod
+ .number()
+ .describe(
+ 'Numeric value\nSerializes as: {\"type\": \"Number\", \"value\": 42.5}'
+ ),
+ })
+ .describe(
+ 'Numeric value\nSerializes as: {\"type\": \"Number\", \"value\": 42.5}'
+ ),
+ zod
+ .object({
+ type: zod.enum(['String']),
+ value: zod
+ .string()
+ .describe(
+ 'String value\nSerializes as: {\"type\": \"String\", \"value\": \"text\"}'
+ ),
+ })
+ .describe(
+ 'String value\nSerializes as: {\"type\": \"String\", \"value\": \"text\"}'
+ ),
+ zod
+ .object({
+ type: zod.enum(['Date']),
+ value: zod.iso
+ .datetime({})
+ .describe(
+ 'Date\/timestamp value\nSerializes as: {\"type\": \"Date\", \"value\": \"2025-01-01T00:00:00Z\"}'
+ ),
+ })
+ .describe(
+ 'Date\/timestamp value\nSerializes as: {\"type\": \"Date\", \"value\": \"2025-01-01T00:00:00Z\"}'
+ ),
+ zod
+ .object({
+ type: zod.enum(['SelectOption']),
+ value: zod
+ .array(zod.uuid())
+ .describe(
+ 'Select option(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"SelectOption\", \"value\": [\"uuid\"]} (length 0 or 1)\nMulti-select: {\"type\": \"SelectOption\", \"value\": [\"uuid1\", \"uuid2\", ...]} (length 0+)'
+ ),
+ })
+ .describe(
+ 'Select option(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"SelectOption\", \"value\": [\"uuid\"]} (length 0 or 1)\nMulti-select: {\"type\": \"SelectOption\", \"value\": [\"uuid1\", \"uuid2\", ...]} (length 0+)'
+ ),
+ zod
+ .object({
+ type: zod.enum(['EntityReference']),
+ value: zod
+ .array(
+ zod
+ .object({
+ entity_id: zod.string(),
+ entity_type: zod
+ .enum([
+ 'CALL_RECORD',
+ 'CHANNEL',
+ 'CHAT',
+ 'COMPANY',
+ 'DOCUMENT',
+ 'PROJECT',
+ 'TASK',
+ 'THREAD',
+ 'USER',
+ ])
+ .describe(
+ 'Type of entity that can be referenced by entity properties.'
+ ),
+ specific_message_id: zod
+ .uuid()
+ .nullish()
+ .describe(
+ 'For CHANNEL, CHAT, THREAD entity types - optional specific message ID.\nThis allows referencing a specific message within a thread\/channel\/chat.'
+ ),
+ })
+ .describe(
+ 'Entity reference for entity-type property values.'
+ )
+ )
+ .describe(
+ 'Entity reference(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"EntityReference\", \"value\": [{...}]} (length 0 or 1)\nMulti-select: {\"type\": \"EntityReference\", \"value\": [{...}, {...}, ...]} (length 0+)'
+ ),
+ })
+ .describe(
+ 'Entity reference(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"EntityReference\", \"value\": [{...}]} (length 0 or 1)\nMulti-select: {\"type\": \"EntityReference\", \"value\": [{...}, {...}, ...]} (length 0+)'
+ ),
+ zod
+ .object({
+ type: zod.enum(['Link']),
+ value: zod
+ .array(zod.string())
+ .describe(
+ 'Link value(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\"]} (length 0 or 1)\nMulti-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\", \"https:\/\/other.com\"]} (length 0+)'
+ ),
+ })
+ .describe(
+ 'Link value(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\"]} (length 0 or 1)\nMulti-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\", \"https:\/\/other.com\"]} (length 0+)'
+ ),
+ ])
.describe(
- 'Link value(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\"]} (length 0 or 1)\nMulti-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\", \"https:\/\/other.com\"]} (length 0+)'
+ 'Property value (service representation).\n\nRepresents the actual value stored for an entity property.\nThis is serialized to\/from JSONB in the database.'
),
])
- .describe(
- 'Property value (service representation).\n\nRepresents the actual value stored for an entity property.\nThis is serialized to\/from JSONB in the database.'
- ),
- ])
- .optional(),
- })
- .describe(
- 'A property attached to a Soup item.\n\nThis is a simplified representation that includes only the definition and value,\nomitting the entity property assignment metadata and options.'
+ .optional(),
+ })
+ .describe(
+ 'A property attached to a Soup item.\n\nThis is a simplified representation that includes only the definition and value,\nomitting the entity property assignment metadata and options.'
+ )
)
- )
- .describe('Properties'),
- updatedAt: zod.iso
- .datetime({})
- .describe('The time the project was updated'),
- viewedAt: zod.iso
- .datetime({})
- .nullish()
- .describe('The time the document was last viewed'),
- })
- .describe('A project as displayed in Soup.'),
- tag: zod.enum(['project']),
- })
- .describe('Project item.'),
- zod
- .object({
- data: zod
- .object({
- createdAt: zod.iso
- .datetime({})
- .describe('Timestamp when the thread was created.'),
- id: zod.uuid().describe('Thread id.'),
- inboxVisible: zod
- .boolean()
- .describe('Whether the thread should appear in the inbox.'),
- isDraft: zod
- .boolean()
- .describe('Whether the thread contains a draft.'),
- isImportant: zod
- .boolean()
- .describe('Whether the thread is marked important.'),
- isRead: zod
- .boolean()
- .describe('Whether the thread has been read.'),
- name: zod
- .string()
- .nullish()
- .describe('Thread display name or subject.'),
- ownerId: zod.string().describe('Owner user id.'),
- projectId: zod
- .string()
- .nullish()
- .describe('Project id associated with the thread.'),
- providerId: zod
- .string()
- .nullish()
- .describe('Provider-specific thread id.'),
- senderEmail: zod
- .string()
- .nullish()
- .describe('Sender email address for the preview.'),
- senderName: zod
- .string()
- .nullish()
- .describe('Sender display name for the preview.'),
- senderPhotoUrl: zod
- .string()
- .nullish()
- .describe('Sender photo URL for the preview.'),
- snippet: zod.string().nullish().describe('Thread snippet.'),
- sortTs: zod.iso
- .datetime({})
- .describe('Timestamp used for email thread sorting.'),
- updatedAt: zod.iso
- .datetime({})
- .describe('Timestamp when the thread was last updated.'),
- viewedAt: zod.iso
- .datetime({})
- .nullish()
+ .describe('Properties attached to the entity.'),
+ })
.describe(
- 'Timestamp when the requesting user last viewed the thread.'
- ),
- })
- .describe('Email thread preview data as displayed in Soup.')
+ 'Property fields that can be flattened into property-bearing Soup items.'
+ )
+ )
.and(
zod.object({
attachments: zod
@@ -12883,226 +13220,6 @@ export const postItemsSoupAstResponse = zod
)
)
.describe('Contacts participating in the thread.'),
- properties: zod
- .array(
- zod
- .object({
- definition: zod
- .object({
- created_at: zod.iso.datetime({}),
- data_type: zod
- .enum([
- 'BOOLEAN',
- 'DATE',
- 'NUMBER',
- 'STRING',
- 'SELECT_NUMBER',
- 'SELECT_STRING',
- 'TAG',
- 'ENTITY',
- 'LINK',
- ])
- .describe(
- 'Data type for property values, determining storage and validation.'
- ),
- display_name: zod.string(),
- id: zod.uuid(),
- is_metadata: zod
- .boolean()
- .describe(
- 'Flag to indicate if this is a system-generated metadata property.\nNot stored in database - computed at service layer.'
- ),
- is_multi_select: zod.boolean(),
- is_system: zod
- .boolean()
- .describe(
- 'Flag to indicate if this is a system property (stored in DB).'
- ),
- owner: zod
- .union([
- zod
- .object({
- scope: zod.enum(['user']),
- user_id: zod.string(),
- })
- .describe('User-scoped property.'),
- zod
- .object({
- scope: zod.enum(['team']),
- team_id: zod.uuid(),
- })
- .describe('Team-scoped property.'),
- zod
- .object({
- scope: zod.enum(['system']),
- })
- .describe(
- 'System-owned property (no user or team owner).'
- ),
- ])
- .describe(
- 'Defines who owns a property - user-scoped, team-scoped, or system.'
- ),
- specific_entity_type: zod
- .union([
- zod.null(),
- zod
- .enum([
- 'CALL_RECORD',
- 'CHANNEL',
- 'CHAT',
- 'COMPANY',
- 'DOCUMENT',
- 'PROJECT',
- 'TASK',
- 'THREAD',
- 'USER',
- ])
- .describe(
- 'Type of entity that can be referenced by entity properties.'
- ),
- ])
- .optional(),
- updated_at: zod.iso.datetime({}),
- })
- .describe(
- 'Property definition model (service representation).'
- ),
- id: zod
- .uuid()
- .describe(
- 'Globally unique id of the assignment attaching this property to an entity.'
- ),
- value: zod
- .union([
- zod.null(),
- zod
- .union([
- zod
- .object({
- type: zod.enum(['Boolean']),
- value: zod
- .boolean()
- .describe(
- 'Boolean value\nSerializes as: {\"type\": \"Boolean\", \"value\": true}'
- ),
- })
- .describe(
- 'Boolean value\nSerializes as: {\"type\": \"Boolean\", \"value\": true}'
- ),
- zod
- .object({
- type: zod.enum(['Number']),
- value: zod
- .number()
- .describe(
- 'Numeric value\nSerializes as: {\"type\": \"Number\", \"value\": 42.5}'
- ),
- })
- .describe(
- 'Numeric value\nSerializes as: {\"type\": \"Number\", \"value\": 42.5}'
- ),
- zod
- .object({
- type: zod.enum(['String']),
- value: zod
- .string()
- .describe(
- 'String value\nSerializes as: {\"type\": \"String\", \"value\": \"text\"}'
- ),
- })
- .describe(
- 'String value\nSerializes as: {\"type\": \"String\", \"value\": \"text\"}'
- ),
- zod
- .object({
- type: zod.enum(['Date']),
- value: zod.iso
- .datetime({})
- .describe(
- 'Date\/timestamp value\nSerializes as: {\"type\": \"Date\", \"value\": \"2025-01-01T00:00:00Z\"}'
- ),
- })
- .describe(
- 'Date\/timestamp value\nSerializes as: {\"type\": \"Date\", \"value\": \"2025-01-01T00:00:00Z\"}'
- ),
- zod
- .object({
- type: zod.enum(['SelectOption']),
- value: zod
- .array(zod.uuid())
- .describe(
- 'Select option(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"SelectOption\", \"value\": [\"uuid\"]} (length 0 or 1)\nMulti-select: {\"type\": \"SelectOption\", \"value\": [\"uuid1\", \"uuid2\", ...]} (length 0+)'
- ),
- })
- .describe(
- 'Select option(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"SelectOption\", \"value\": [\"uuid\"]} (length 0 or 1)\nMulti-select: {\"type\": \"SelectOption\", \"value\": [\"uuid1\", \"uuid2\", ...]} (length 0+)'
- ),
- zod
- .object({
- type: zod.enum(['EntityReference']),
- value: zod
- .array(
- zod
- .object({
- entity_id: zod.string(),
- entity_type: zod
- .enum([
- 'CALL_RECORD',
- 'CHANNEL',
- 'CHAT',
- 'COMPANY',
- 'DOCUMENT',
- 'PROJECT',
- 'TASK',
- 'THREAD',
- 'USER',
- ])
- .describe(
- 'Type of entity that can be referenced by entity properties.'
- ),
- specific_message_id: zod
- .uuid()
- .nullish()
- .describe(
- 'For CHANNEL, CHAT, THREAD entity types - optional specific message ID.\nThis allows referencing a specific message within a thread\/channel\/chat.'
- ),
- })
- .describe(
- 'Entity reference for entity-type property values.'
- )
- )
- .describe(
- 'Entity reference(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"EntityReference\", \"value\": [{...}]} (length 0 or 1)\nMulti-select: {\"type\": \"EntityReference\", \"value\": [{...}, {...}, ...]} (length 0+)'
- ),
- })
- .describe(
- 'Entity reference(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"EntityReference\", \"value\": [{...}]} (length 0 or 1)\nMulti-select: {\"type\": \"EntityReference\", \"value\": [{...}, {...}, ...]} (length 0+)'
- ),
- zod
- .object({
- type: zod.enum(['Link']),
- value: zod
- .array(zod.string())
- .describe(
- 'Link value(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\"]} (length 0 or 1)\nMulti-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\", \"https:\/\/other.com\"]} (length 0+)'
- ),
- })
- .describe(
- 'Link value(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\"]} (length 0 or 1)\nMulti-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\", \"https:\/\/other.com\"]} (length 0+)'
- ),
- ])
- .describe(
- 'Property value (service representation).\n\nRepresents the actual value stored for an entity property.\nThis is serialized to\/from JSONB in the database.'
- ),
- ])
- .optional(),
- })
- .describe(
- 'A property attached to a Soup item.\n\nThis is a simplified representation that includes only the definition and value,\nomitting the entity property assignment metadata and options.'
- )
- )
- .describe('Properties attached to the thread.'),
})
)
.describe(
@@ -13458,64 +13575,9 @@ export const postItemsSoupAstResponse = zod
})
.describe('Channel thread item.'),
zod
- .object({
- data: zod
- .object({
- attended: zod
- .boolean()
- .describe(
- 'Whether the requesting user attended this call. Kept for compatibility\nand derived from `status == ATTENDED`.'
- ),
- callId: zod.uuid().describe('The call identifier.'),
- channelId: zod
- .uuid()
- .describe('The channel this call belongs to.'),
- channelName: zod
- .string()
- .nullish()
- .describe('Resolved display name for the channel.'),
- createdBy: zod
- .string()
- .describe('User who created the call.'),
- customName: zod
- .string()
- .nullish()
- .describe(
- 'User-supplied or AI-generated display name for the call.'
- ),
- durationMs: zod
- .number()
- .nullish()
- .describe(
- 'Call duration in milliseconds (None if still active).'
- ),
- endedAt: zod.iso
- .datetime({})
- .nullish()
- .describe('When the call ended (None if still active).'),
- isActive: zod
- .boolean()
- .describe('Whether the call is currently active.'),
- participants: zod
- .array(
- zod
- .object({
- joinedAt: zod.iso
- .datetime({})
- .describe('When the user joined the call.'),
- leftAt: zod.iso
- .datetime({})
- .nullish()
- .describe(
- 'When the user left (None if still in an active call).'
- ),
- userId: zod.string().describe('The user id.'),
- })
- .describe(
- 'A participant in a call record, as displayed in Soup.'
- )
- )
- .describe('Participants in the call.'),
+ .object({
+ data: zod
+ .object({
properties: zod
.array(
zod
@@ -13735,24 +13797,84 @@ export const postItemsSoupAstResponse = zod
'A property attached to a Soup item.\n\nThis is a simplified representation that includes only the definition and value,\nomitting the entity property assignment metadata and options.'
)
)
- .describe(
- 'Entity properties (e.g. tags). Populated after fetch by the soup repo.'
- ),
- startedAt: zod.iso
- .datetime({})
- .describe('When the call started.'),
- status: zod
- .enum(['ATTENDED', 'MISSED', 'UNATTENDED'])
- .describe(
- 'Viewer-relative attendance status for a call record.\nSerializes as `ATTENDED`, `MISSED`, or `UNATTENDED`.'
- ),
- summary: zod
- .string()
- .nullish()
- .describe(
- 'AI-generated summary of the call. Only set on archived\n`call_records` once summarization has run; active calls always\nreturn `None`.'
- ),
+ .describe('Properties attached to the entity.'),
})
+ .describe(
+ 'Property fields that can be flattened into property-bearing Soup items.'
+ )
+ .and(
+ zod.object({
+ attended: zod
+ .boolean()
+ .describe(
+ 'Whether the requesting user attended this call. Kept for compatibility\nand derived from `status == ATTENDED`.'
+ ),
+ callId: zod.uuid().describe('The call identifier.'),
+ channelId: zod
+ .uuid()
+ .describe('The channel this call belongs to.'),
+ channelName: zod
+ .string()
+ .nullish()
+ .describe('Resolved display name for the channel.'),
+ createdBy: zod
+ .string()
+ .describe('User who created the call.'),
+ customName: zod
+ .string()
+ .nullish()
+ .describe(
+ 'User-supplied or AI-generated display name for the call.'
+ ),
+ durationMs: zod
+ .number()
+ .nullish()
+ .describe(
+ 'Call duration in milliseconds (None if still active).'
+ ),
+ endedAt: zod.iso
+ .datetime({})
+ .nullish()
+ .describe('When the call ended (None if still active).'),
+ isActive: zod
+ .boolean()
+ .describe('Whether the call is currently active.'),
+ participants: zod
+ .array(
+ zod
+ .object({
+ joinedAt: zod.iso
+ .datetime({})
+ .describe('When the user joined the call.'),
+ leftAt: zod.iso
+ .datetime({})
+ .nullish()
+ .describe(
+ 'When the user left (None if still in an active call).'
+ ),
+ userId: zod.string().describe('The user id.'),
+ })
+ .describe(
+ 'A participant in a call record, as displayed in Soup.'
+ )
+ )
+ .describe('Participants in the call.'),
+ startedAt: zod.iso
+ .datetime({})
+ .describe('When the call started.'),
+ status: zod
+ .enum(['ATTENDED', 'MISSED', 'UNATTENDED'])
+ .describe(
+ 'Viewer-relative attendance status for a call record.\nSerializes as `ATTENDED`, `MISSED`, or `UNATTENDED`.'
+ ),
+ summary: zod
+ .string()
+ .nullish()
+ .describe(
+ 'AI-generated summary of the call. Only set on archived\n`call_records` once summarization has run; active calls always\nreturn `None`.'
+ ),
+ })
+ )
.describe(
'A call record as displayed in Soup. Excludes room_name, egress_id,\nand transcript — fields that are irrelevant for the soup feed.'
),
@@ -13763,60 +13885,6 @@ export const postItemsSoupAstResponse = zod
.object({
data: zod
.object({
- createdAt: zod.iso
- .datetime({})
- .describe('When the company was created.'),
- description: zod
- .string()
- .nullish()
- .describe(
- "Display description from the primary domain's directory entry."
- ),
- domains: zod
- .array(
- zod
- .object({
- companyId: zod
- .uuid()
- .describe(
- 'The id of the company the domain belongs to.'
- ),
- createdAt: zod.iso
- .datetime({})
- .describe('When the domain record was created.'),
- domain: zod
- .string()
- .describe(
- 'The domain (lowercased, e.g. \"acme.com\").'
- ),
- id: zod
- .uuid()
- .describe('The id of the domain record.'),
- })
- .describe(
- "A CRM domain as displayed in Soup. Mirrors the crm crate's\n[`CrmDomain`] with a stable wire shape that the FE can rely on."
- )
- )
- .describe(
- 'Domains associated with this company, ordered by creation time\nascending (primary first).'
- ),
- emailSync: zod
- .boolean()
- .describe(
- 'Whether email sync is enabled for this company.'
- ),
- hidden: zod
- .boolean()
- .describe(
- 'Whether the company is hidden from CRM listings. Soup filters\nthese out by default.'
- ),
- id: zod.uuid().describe('The id of the company.'),
- name: zod
- .string()
- .nullish()
- .describe(
- "Display name from the primary domain's directory entry, or\n`None` when unresolved."
- ),
properties: zod
.array(
zod
@@ -14036,25 +14104,83 @@ export const postItemsSoupAstResponse = zod
'A property attached to a Soup item.\n\nThis is a simplified representation that includes only the definition and value,\nomitting the entity property assignment metadata and options.'
)
)
- .optional()
- .describe(
- 'Properties attached to this company (system CRM properties like\nStage \/ Owner \/ Revenue plus any custom ones).'
- ),
- teamId: zod
- .uuid()
- .describe(
- 'The id of the team that owns this company record.'
- ),
- updatedAt: zod.iso
- .datetime({})
- .describe('When the company was last updated.'),
- viewedAt: zod.iso
- .datetime({})
- .nullish()
- .describe(
- 'When the requesting user last viewed this company, or `None` if\nnever viewed. Mirrors the `viewed_at` other soup entities carry.'
- ),
+ .describe('Properties attached to the entity.'),
})
+ .describe(
+ 'Property fields that can be flattened into property-bearing Soup items.'
+ )
+ .and(
+ zod.object({
+ createdAt: zod.iso
+ .datetime({})
+ .describe('When the company was created.'),
+ description: zod
+ .string()
+ .nullish()
+ .describe(
+ "Display description from the primary domain's directory entry."
+ ),
+ domains: zod
+ .array(
+ zod
+ .object({
+ companyId: zod
+ .uuid()
+ .describe(
+ 'The id of the company the domain belongs to.'
+ ),
+ createdAt: zod.iso
+ .datetime({})
+ .describe('When the domain record was created.'),
+ domain: zod
+ .string()
+ .describe(
+ 'The domain (lowercased, e.g. \"acme.com\").'
+ ),
+ id: zod
+ .uuid()
+ .describe('The id of the domain record.'),
+ })
+ .describe(
+ "A CRM domain as displayed in Soup. Mirrors the crm crate's\n[`CrmDomain`] with a stable wire shape that the FE can rely on."
+ )
+ )
+ .describe(
+ 'Domains associated with this company, ordered by creation time\nascending (primary first).'
+ ),
+ emailSync: zod
+ .boolean()
+ .describe(
+ 'Whether email sync is enabled for this company.'
+ ),
+ hidden: zod
+ .boolean()
+ .describe(
+ 'Whether the company is hidden from CRM listings. Soup filters\nthese out by default.'
+ ),
+ id: zod.uuid().describe('The id of the company.'),
+ name: zod
+ .string()
+ .nullish()
+ .describe(
+ "Display name from the primary domain's directory entry, or\n`None` when unresolved."
+ ),
+ teamId: zod
+ .uuid()
+ .describe(
+ 'The id of the team that owns this company record.'
+ ),
+ updatedAt: zod.iso
+ .datetime({})
+ .describe('When the company was last updated.'),
+ viewedAt: zod.iso
+ .datetime({})
+ .nullish()
+ .describe(
+ 'When the requesting user last viewed this company, or `None` if\nnever viewed. Mirrors the `viewed_at` other soup entities carry.'
+ ),
+ })
+ )
.describe(
'A CRM company as displayed in Soup. Carries the core company\nfields plus display metadata resolved from `crm_domain_directory`\nagainst the primary (earliest-created) domain.'
),
@@ -14499,53 +14625,6 @@ export const postItemsSoupAstGroupedResponse = zod
.object({
data: zod
.object({
- branchedFromId: zod
- .uuid()
- .nullish()
- .describe(
- 'The id of the document this document branched from'
- ),
- branchedFromVersionId: zod
- .number()
- .nullish()
- .describe(
- 'The id of the version this document branched from\nThis could be either DocumentInstance or DocumentBom id depending on the file type'
- ),
- createdAt: zod.iso
- .datetime({})
- .describe('The time the document was created'),
- deletedAt: zod.iso
- .datetime({})
- .nullish()
- .describe('The time the document was deleted'),
- documentFamilyId: zod
- .number()
- .nullish()
- .describe(
- 'The id of the document family this document belongs to'
- ),
- documentVersionId: zod
- .number()
- .describe(
- 'The version of the document\nThis could be the document_instance_id or document_bom_id depending on the file type'
- ),
- fileType: zod
- .string()
- .nullish()
- .describe(
- 'The file type of the document (e.g. pdf, docx)'
- ),
- id: zod.uuid().describe('The document id'),
- name: zod.string().describe('The name of the document'),
- ownerId: zod
- .string()
- .describe('The owner of the document'),
- projectId: zod
- .uuid()
- .nullish()
- .describe(
- 'The id of the project that this document belongs to'
- ),
properties: zod
.array(
zod
@@ -14765,53 +14844,109 @@ export const postItemsSoupAstGroupedResponse = zod
'A property attached to a Soup item.\n\nThis is a simplified representation that includes only the definition and value,\nomitting the entity property assignment metadata and options.'
)
)
- .describe('Properties'),
- sha: zod
- .string()
- .nullish()
- .describe(
- 'If the document is a PDF, this is the SHA of the pdf\nIf the document is a DOCX, this will not be present'
- ),
- subType: zod
- .union([
- zod.null(),
- zod
- .union([
- zod
- .object({
- is_completed: zod
- .boolean()
- .describe(
- 'Whether the task is completed.\nTrue if the Status property is set to \"Completed\".'
- ),
- type: zod.enum(['task']),
- })
- .describe(
- 'A task document with its associated properties'
- ),
- zod
- .object({
- type: zod.enum(['snippet']),
- })
- .describe(
- 'A snippet document — reusable markdown'
- ),
- ])
- .describe(
- 'Sub type of a document with associated properties encoded in each variant.\nThis ensures type-safety: task properties only exist when the document is a task.'
- ),
- ])
- .optional(),
- updatedAt: zod.iso
- .datetime({})
- .describe(
- 'The time the document instance \/ document BOM was updated'
- ),
- viewedAt: zod.iso
- .datetime({})
- .nullish()
- .describe('The time the document was last viewed'),
+ .describe('Properties attached to the entity.'),
})
+ .describe(
+ 'Property fields that can be flattened into property-bearing Soup items.'
+ )
+ .and(
+ zod.object({
+ branchedFromId: zod
+ .uuid()
+ .nullish()
+ .describe(
+ 'The id of the document this document branched from'
+ ),
+ branchedFromVersionId: zod
+ .number()
+ .nullish()
+ .describe(
+ 'The id of the version this document branched from\nThis could be either DocumentInstance or DocumentBom id depending on the file type'
+ ),
+ createdAt: zod.iso
+ .datetime({})
+ .describe('The time the document was created'),
+ deletedAt: zod.iso
+ .datetime({})
+ .nullish()
+ .describe('The time the document was deleted'),
+ documentFamilyId: zod
+ .number()
+ .nullish()
+ .describe(
+ 'The id of the document family this document belongs to'
+ ),
+ documentVersionId: zod
+ .number()
+ .describe(
+ 'The version of the document\nThis could be the document_instance_id or document_bom_id depending on the file type'
+ ),
+ fileType: zod
+ .string()
+ .nullish()
+ .describe(
+ 'The file type of the document (e.g. pdf, docx)'
+ ),
+ id: zod.uuid().describe('The document id'),
+ name: zod
+ .string()
+ .describe('The name of the document'),
+ ownerId: zod
+ .string()
+ .describe('The owner of the document'),
+ projectId: zod
+ .uuid()
+ .nullish()
+ .describe(
+ 'The id of the project that this document belongs to'
+ ),
+ sha: zod
+ .string()
+ .nullish()
+ .describe(
+ 'If the document is a PDF, this is the SHA of the pdf\nIf the document is a DOCX, this will not be present'
+ ),
+ subType: zod
+ .union([
+ zod.null(),
+ zod
+ .union([
+ zod
+ .object({
+ is_completed: zod
+ .boolean()
+ .describe(
+ 'Whether the task is completed.\nTrue if the Status property is set to \"Completed\".'
+ ),
+ type: zod.enum(['task']),
+ })
+ .describe(
+ 'A task document with its associated properties'
+ ),
+ zod
+ .object({
+ type: zod.enum(['snippet']),
+ })
+ .describe(
+ 'A snippet document — reusable markdown'
+ ),
+ ])
+ .describe(
+ 'Sub type of a document with associated properties encoded in each variant.\nThis ensures type-safety: task properties only exist when the document is a task.'
+ ),
+ ])
+ .optional(),
+ updatedAt: zod.iso
+ .datetime({})
+ .describe(
+ 'The time the document instance \/ document BOM was updated'
+ ),
+ viewedAt: zod.iso
+ .datetime({})
+ .nullish()
+ .describe('The time the document was last viewed'),
+ })
+ )
.describe('A document as displayed in Soup.'),
tag: zod.enum(['document']),
})
@@ -14820,25 +14955,6 @@ export const postItemsSoupAstGroupedResponse = zod
.object({
data: zod
.object({
- createdAt: zod.iso
- .datetime({})
- .describe('The time the chat was created'),
- deletedAt: zod.iso
- .datetime({})
- .nullish()
- .describe('The time the chat was deleted'),
- id: zod.uuid().describe('The chat uuid'),
- isPersistent: zod
- .boolean()
- .describe('Whether the chat is persistent or not'),
- name: zod.string().describe('The name of the chat'),
- ownerId: zod
- .string()
- .describe('Who the chat belongs to'),
- projectId: zod
- .uuid()
- .nullish()
- .describe('The project id of the chat'),
properties: zod
.array(
zod
@@ -15058,15 +15174,41 @@ export const postItemsSoupAstGroupedResponse = zod
'A property attached to a Soup item.\n\nThis is a simplified representation that includes only the definition and value,\nomitting the entity property assignment metadata and options.'
)
)
- .describe('Properties'),
- updatedAt: zod.iso
- .datetime({})
- .describe('The time the chat was last updated'),
- viewedAt: zod.iso
- .datetime({})
- .nullish()
- .describe('The time the chat was last viewed'),
+ .describe('Properties attached to the entity.'),
})
+ .describe(
+ 'Property fields that can be flattened into property-bearing Soup items.'
+ )
+ .and(
+ zod.object({
+ createdAt: zod.iso
+ .datetime({})
+ .describe('The time the chat was created'),
+ deletedAt: zod.iso
+ .datetime({})
+ .nullish()
+ .describe('The time the chat was deleted'),
+ id: zod.uuid().describe('The chat uuid'),
+ isPersistent: zod
+ .boolean()
+ .describe('Whether the chat is persistent or not'),
+ name: zod.string().describe('The name of the chat'),
+ ownerId: zod
+ .string()
+ .describe('Who the chat belongs to'),
+ projectId: zod
+ .uuid()
+ .nullish()
+ .describe('The project id of the chat'),
+ updatedAt: zod.iso
+ .datetime({})
+ .describe('The time the chat was last updated'),
+ viewedAt: zod.iso
+ .datetime({})
+ .nullish()
+ .describe('The time the chat was last viewed'),
+ })
+ )
.describe('A chat as displayed in Soup.'),
tag: zod.enum(['chat']),
})
@@ -15075,22 +15217,6 @@ export const postItemsSoupAstGroupedResponse = zod
.object({
data: zod
.object({
- createdAt: zod.iso
- .datetime({})
- .describe('The time the project was created'),
- deletedAt: zod.iso
- .datetime({})
- .nullish()
- .describe('The time the project was deleted'),
- id: zod.uuid().describe('The id of the project'),
- name: zod.string().describe('The name of the project'),
- ownerId: zod
- .string()
- .describe('The user id of who created the project'),
- parentId: zod
- .uuid()
- .nullish()
- .describe('The parent project id'),
properties: zod
.array(
zod
@@ -15295,102 +15421,363 @@ export const postItemsSoupAstGroupedResponse = zod
.describe(
'Link value(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\"]} (length 0 or 1)\nMulti-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\", \"https:\/\/other.com\"]} (length 0+)'
),
- })
+ })
+ .describe(
+ 'Link value(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\"]} (length 0 or 1)\nMulti-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\", \"https:\/\/other.com\"]} (length 0+)'
+ ),
+ ])
+ .describe(
+ 'Property value (service representation).\n\nRepresents the actual value stored for an entity property.\nThis is serialized to\/from JSONB in the database.'
+ ),
+ ])
+ .optional(),
+ })
+ .describe(
+ 'A property attached to a Soup item.\n\nThis is a simplified representation that includes only the definition and value,\nomitting the entity property assignment metadata and options.'
+ )
+ )
+ .describe('Properties attached to the entity.'),
+ })
+ .describe(
+ 'Property fields that can be flattened into property-bearing Soup items.'
+ )
+ .and(
+ zod.object({
+ createdAt: zod.iso
+ .datetime({})
+ .describe('The time the project was created'),
+ deletedAt: zod.iso
+ .datetime({})
+ .nullish()
+ .describe('The time the project was deleted'),
+ id: zod.uuid().describe('The id of the project'),
+ name: zod
+ .string()
+ .describe('The name of the project'),
+ ownerId: zod
+ .string()
+ .describe('The user id of who created the project'),
+ parentId: zod
+ .uuid()
+ .nullish()
+ .describe('The parent project id'),
+ updatedAt: zod.iso
+ .datetime({})
+ .describe('The time the project was updated'),
+ viewedAt: zod.iso
+ .datetime({})
+ .nullish()
+ .describe('The time the document was last viewed'),
+ })
+ )
+ .describe('A project as displayed in Soup.'),
+ tag: zod.enum(['project']),
+ })
+ .describe('Project item.'),
+ zod
+ .object({
+ data: zod
+ .object({
+ createdAt: zod.iso
+ .datetime({})
+ .describe('Timestamp when the thread was created.'),
+ id: zod.uuid().describe('Thread id.'),
+ inboxVisible: zod
+ .boolean()
+ .describe(
+ 'Whether the thread should appear in the inbox.'
+ ),
+ isDraft: zod
+ .boolean()
+ .describe('Whether the thread contains a draft.'),
+ isImportant: zod
+ .boolean()
+ .describe('Whether the thread is marked important.'),
+ isRead: zod
+ .boolean()
+ .describe('Whether the thread has been read.'),
+ name: zod
+ .string()
+ .nullish()
+ .describe('Thread display name or subject.'),
+ ownerId: zod.string().describe('Owner user id.'),
+ projectId: zod
+ .string()
+ .nullish()
+ .describe('Project id associated with the thread.'),
+ providerId: zod
+ .string()
+ .nullish()
+ .describe('Provider-specific thread id.'),
+ senderEmail: zod
+ .string()
+ .nullish()
+ .describe('Sender email address for the preview.'),
+ senderName: zod
+ .string()
+ .nullish()
+ .describe('Sender display name for the preview.'),
+ senderPhotoUrl: zod
+ .string()
+ .nullish()
+ .describe('Sender photo URL for the preview.'),
+ snippet: zod
+ .string()
+ .nullish()
+ .describe('Thread snippet.'),
+ sortTs: zod.iso
+ .datetime({})
+ .describe('Timestamp used for email thread sorting.'),
+ updatedAt: zod.iso
+ .datetime({})
+ .describe(
+ 'Timestamp when the thread was last updated.'
+ ),
+ viewedAt: zod.iso
+ .datetime({})
+ .nullish()
+ .describe(
+ 'Timestamp when the requesting user last viewed the thread.'
+ ),
+ })
+ .describe(
+ 'Email thread preview data as displayed in Soup.'
+ )
+ .and(
+ zod
+ .object({
+ properties: zod
+ .array(
+ zod
+ .object({
+ definition: zod
+ .object({
+ created_at: zod.iso.datetime({}),
+ data_type: zod
+ .enum([
+ 'BOOLEAN',
+ 'DATE',
+ 'NUMBER',
+ 'STRING',
+ 'SELECT_NUMBER',
+ 'SELECT_STRING',
+ 'TAG',
+ 'ENTITY',
+ 'LINK',
+ ])
+ .describe(
+ 'Data type for property values, determining storage and validation.'
+ ),
+ display_name: zod.string(),
+ id: zod.uuid(),
+ is_metadata: zod
+ .boolean()
+ .describe(
+ 'Flag to indicate if this is a system-generated metadata property.\nNot stored in database - computed at service layer.'
+ ),
+ is_multi_select: zod.boolean(),
+ is_system: zod
+ .boolean()
+ .describe(
+ 'Flag to indicate if this is a system property (stored in DB).'
+ ),
+ owner: zod
+ .union([
+ zod
+ .object({
+ scope: zod.enum(['user']),
+ user_id: zod.string(),
+ })
+ .describe(
+ 'User-scoped property.'
+ ),
+ zod
+ .object({
+ scope: zod.enum(['team']),
+ team_id: zod.uuid(),
+ })
+ .describe(
+ 'Team-scoped property.'
+ ),
+ zod
+ .object({
+ scope: zod.enum(['system']),
+ })
+ .describe(
+ 'System-owned property (no user or team owner).'
+ ),
+ ])
+ .describe(
+ 'Defines who owns a property - user-scoped, team-scoped, or system.'
+ ),
+ specific_entity_type: zod
+ .union([
+ zod.null(),
+ zod
+ .enum([
+ 'CALL_RECORD',
+ 'CHANNEL',
+ 'CHAT',
+ 'COMPANY',
+ 'DOCUMENT',
+ 'PROJECT',
+ 'TASK',
+ 'THREAD',
+ 'USER',
+ ])
+ .describe(
+ 'Type of entity that can be referenced by entity properties.'
+ ),
+ ])
+ .optional(),
+ updated_at: zod.iso.datetime({}),
+ })
+ .describe(
+ 'Property definition model (service representation).'
+ ),
+ id: zod
+ .uuid()
+ .describe(
+ 'Globally unique id of the assignment attaching this property to an entity.'
+ ),
+ value: zod
+ .union([
+ zod.null(),
+ zod
+ .union([
+ zod
+ .object({
+ type: zod.enum(['Boolean']),
+ value: zod
+ .boolean()
+ .describe(
+ 'Boolean value\nSerializes as: {\"type\": \"Boolean\", \"value\": true}'
+ ),
+ })
+ .describe(
+ 'Boolean value\nSerializes as: {\"type\": \"Boolean\", \"value\": true}'
+ ),
+ zod
+ .object({
+ type: zod.enum(['Number']),
+ value: zod
+ .number()
+ .describe(
+ 'Numeric value\nSerializes as: {\"type\": \"Number\", \"value\": 42.5}'
+ ),
+ })
+ .describe(
+ 'Numeric value\nSerializes as: {\"type\": \"Number\", \"value\": 42.5}'
+ ),
+ zod
+ .object({
+ type: zod.enum(['String']),
+ value: zod
+ .string()
+ .describe(
+ 'String value\nSerializes as: {\"type\": \"String\", \"value\": \"text\"}'
+ ),
+ })
+ .describe(
+ 'String value\nSerializes as: {\"type\": \"String\", \"value\": \"text\"}'
+ ),
+ zod
+ .object({
+ type: zod.enum(['Date']),
+ value: zod.iso
+ .datetime({})
+ .describe(
+ 'Date\/timestamp value\nSerializes as: {\"type\": \"Date\", \"value\": \"2025-01-01T00:00:00Z\"}'
+ ),
+ })
+ .describe(
+ 'Date\/timestamp value\nSerializes as: {\"type\": \"Date\", \"value\": \"2025-01-01T00:00:00Z\"}'
+ ),
+ zod
+ .object({
+ type: zod.enum([
+ 'SelectOption',
+ ]),
+ value: zod
+ .array(zod.uuid())
+ .describe(
+ 'Select option(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"SelectOption\", \"value\": [\"uuid\"]} (length 0 or 1)\nMulti-select: {\"type\": \"SelectOption\", \"value\": [\"uuid1\", \"uuid2\", ...]} (length 0+)'
+ ),
+ })
+ .describe(
+ 'Select option(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"SelectOption\", \"value\": [\"uuid\"]} (length 0 or 1)\nMulti-select: {\"type\": \"SelectOption\", \"value\": [\"uuid1\", \"uuid2\", ...]} (length 0+)'
+ ),
+ zod
+ .object({
+ type: zod.enum([
+ 'EntityReference',
+ ]),
+ value: zod
+ .array(
+ zod
+ .object({
+ entity_id: zod.string(),
+ entity_type: zod
+ .enum([
+ 'CALL_RECORD',
+ 'CHANNEL',
+ 'CHAT',
+ 'COMPANY',
+ 'DOCUMENT',
+ 'PROJECT',
+ 'TASK',
+ 'THREAD',
+ 'USER',
+ ])
+ .describe(
+ 'Type of entity that can be referenced by entity properties.'
+ ),
+ specific_message_id: zod
+ .uuid()
+ .nullish()
+ .describe(
+ 'For CHANNEL, CHAT, THREAD entity types - optional specific message ID.\nThis allows referencing a specific message within a thread\/channel\/chat.'
+ ),
+ })
+ .describe(
+ 'Entity reference for entity-type property values.'
+ )
+ )
+ .describe(
+ 'Entity reference(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"EntityReference\", \"value\": [{...}]} (length 0 or 1)\nMulti-select: {\"type\": \"EntityReference\", \"value\": [{...}, {...}, ...]} (length 0+)'
+ ),
+ })
+ .describe(
+ 'Entity reference(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"EntityReference\", \"value\": [{...}]} (length 0 or 1)\nMulti-select: {\"type\": \"EntityReference\", \"value\": [{...}, {...}, ...]} (length 0+)'
+ ),
+ zod
+ .object({
+ type: zod.enum(['Link']),
+ value: zod
+ .array(zod.string())
+ .describe(
+ 'Link value(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\"]} (length 0 or 1)\nMulti-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\", \"https:\/\/other.com\"]} (length 0+)'
+ ),
+ })
+ .describe(
+ 'Link value(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\"]} (length 0 or 1)\nMulti-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\", \"https:\/\/other.com\"]} (length 0+)'
+ ),
+ ])
.describe(
- 'Link value(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\"]} (length 0 or 1)\nMulti-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\", \"https:\/\/other.com\"]} (length 0+)'
+ 'Property value (service representation).\n\nRepresents the actual value stored for an entity property.\nThis is serialized to\/from JSONB in the database.'
),
])
- .describe(
- 'Property value (service representation).\n\nRepresents the actual value stored for an entity property.\nThis is serialized to\/from JSONB in the database.'
- ),
- ])
- .optional(),
- })
- .describe(
- 'A property attached to a Soup item.\n\nThis is a simplified representation that includes only the definition and value,\nomitting the entity property assignment metadata and options.'
+ .optional(),
+ })
+ .describe(
+ 'A property attached to a Soup item.\n\nThis is a simplified representation that includes only the definition and value,\nomitting the entity property assignment metadata and options.'
+ )
)
- )
- .describe('Properties'),
- updatedAt: zod.iso
- .datetime({})
- .describe('The time the project was updated'),
- viewedAt: zod.iso
- .datetime({})
- .nullish()
- .describe('The time the document was last viewed'),
- })
- .describe('A project as displayed in Soup.'),
- tag: zod.enum(['project']),
- })
- .describe('Project item.'),
- zod
- .object({
- data: zod
- .object({
- createdAt: zod.iso
- .datetime({})
- .describe('Timestamp when the thread was created.'),
- id: zod.uuid().describe('Thread id.'),
- inboxVisible: zod
- .boolean()
- .describe(
- 'Whether the thread should appear in the inbox.'
- ),
- isDraft: zod
- .boolean()
- .describe('Whether the thread contains a draft.'),
- isImportant: zod
- .boolean()
- .describe('Whether the thread is marked important.'),
- isRead: zod
- .boolean()
- .describe('Whether the thread has been read.'),
- name: zod
- .string()
- .nullish()
- .describe('Thread display name or subject.'),
- ownerId: zod.string().describe('Owner user id.'),
- projectId: zod
- .string()
- .nullish()
- .describe('Project id associated with the thread.'),
- providerId: zod
- .string()
- .nullish()
- .describe('Provider-specific thread id.'),
- senderEmail: zod
- .string()
- .nullish()
- .describe('Sender email address for the preview.'),
- senderName: zod
- .string()
- .nullish()
- .describe('Sender display name for the preview.'),
- senderPhotoUrl: zod
- .string()
- .nullish()
- .describe('Sender photo URL for the preview.'),
- snippet: zod
- .string()
- .nullish()
- .describe('Thread snippet.'),
- sortTs: zod.iso
- .datetime({})
- .describe('Timestamp used for email thread sorting.'),
- updatedAt: zod.iso
- .datetime({})
- .describe(
- 'Timestamp when the thread was last updated.'
- ),
- viewedAt: zod.iso
- .datetime({})
- .nullish()
+ .describe('Properties attached to the entity.'),
+ })
.describe(
- 'Timestamp when the requesting user last viewed the thread.'
- ),
- })
- .describe(
- 'Email thread preview data as displayed in Soup.'
+ 'Property fields that can be flattened into property-bearing Soup items.'
+ )
)
.and(
zod.object({
@@ -15515,228 +15902,6 @@ export const postItemsSoupAstGroupedResponse = zod
)
)
.describe('Contacts participating in the thread.'),
- properties: zod
- .array(
- zod
- .object({
- definition: zod
- .object({
- created_at: zod.iso.datetime({}),
- data_type: zod
- .enum([
- 'BOOLEAN',
- 'DATE',
- 'NUMBER',
- 'STRING',
- 'SELECT_NUMBER',
- 'SELECT_STRING',
- 'TAG',
- 'ENTITY',
- 'LINK',
- ])
- .describe(
- 'Data type for property values, determining storage and validation.'
- ),
- display_name: zod.string(),
- id: zod.uuid(),
- is_metadata: zod
- .boolean()
- .describe(
- 'Flag to indicate if this is a system-generated metadata property.\nNot stored in database - computed at service layer.'
- ),
- is_multi_select: zod.boolean(),
- is_system: zod
- .boolean()
- .describe(
- 'Flag to indicate if this is a system property (stored in DB).'
- ),
- owner: zod
- .union([
- zod
- .object({
- scope: zod.enum(['user']),
- user_id: zod.string(),
- })
- .describe('User-scoped property.'),
- zod
- .object({
- scope: zod.enum(['team']),
- team_id: zod.uuid(),
- })
- .describe('Team-scoped property.'),
- zod
- .object({
- scope: zod.enum(['system']),
- })
- .describe(
- 'System-owned property (no user or team owner).'
- ),
- ])
- .describe(
- 'Defines who owns a property - user-scoped, team-scoped, or system.'
- ),
- specific_entity_type: zod
- .union([
- zod.null(),
- zod
- .enum([
- 'CALL_RECORD',
- 'CHANNEL',
- 'CHAT',
- 'COMPANY',
- 'DOCUMENT',
- 'PROJECT',
- 'TASK',
- 'THREAD',
- 'USER',
- ])
- .describe(
- 'Type of entity that can be referenced by entity properties.'
- ),
- ])
- .optional(),
- updated_at: zod.iso.datetime({}),
- })
- .describe(
- 'Property definition model (service representation).'
- ),
- id: zod
- .uuid()
- .describe(
- 'Globally unique id of the assignment attaching this property to an entity.'
- ),
- value: zod
- .union([
- zod.null(),
- zod
- .union([
- zod
- .object({
- type: zod.enum(['Boolean']),
- value: zod
- .boolean()
- .describe(
- 'Boolean value\nSerializes as: {\"type\": \"Boolean\", \"value\": true}'
- ),
- })
- .describe(
- 'Boolean value\nSerializes as: {\"type\": \"Boolean\", \"value\": true}'
- ),
- zod
- .object({
- type: zod.enum(['Number']),
- value: zod
- .number()
- .describe(
- 'Numeric value\nSerializes as: {\"type\": \"Number\", \"value\": 42.5}'
- ),
- })
- .describe(
- 'Numeric value\nSerializes as: {\"type\": \"Number\", \"value\": 42.5}'
- ),
- zod
- .object({
- type: zod.enum(['String']),
- value: zod
- .string()
- .describe(
- 'String value\nSerializes as: {\"type\": \"String\", \"value\": \"text\"}'
- ),
- })
- .describe(
- 'String value\nSerializes as: {\"type\": \"String\", \"value\": \"text\"}'
- ),
- zod
- .object({
- type: zod.enum(['Date']),
- value: zod.iso
- .datetime({})
- .describe(
- 'Date\/timestamp value\nSerializes as: {\"type\": \"Date\", \"value\": \"2025-01-01T00:00:00Z\"}'
- ),
- })
- .describe(
- 'Date\/timestamp value\nSerializes as: {\"type\": \"Date\", \"value\": \"2025-01-01T00:00:00Z\"}'
- ),
- zod
- .object({
- type: zod.enum(['SelectOption']),
- value: zod
- .array(zod.uuid())
- .describe(
- 'Select option(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"SelectOption\", \"value\": [\"uuid\"]} (length 0 or 1)\nMulti-select: {\"type\": \"SelectOption\", \"value\": [\"uuid1\", \"uuid2\", ...]} (length 0+)'
- ),
- })
- .describe(
- 'Select option(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"SelectOption\", \"value\": [\"uuid\"]} (length 0 or 1)\nMulti-select: {\"type\": \"SelectOption\", \"value\": [\"uuid1\", \"uuid2\", ...]} (length 0+)'
- ),
- zod
- .object({
- type: zod.enum([
- 'EntityReference',
- ]),
- value: zod
- .array(
- zod
- .object({
- entity_id: zod.string(),
- entity_type: zod
- .enum([
- 'CALL_RECORD',
- 'CHANNEL',
- 'CHAT',
- 'COMPANY',
- 'DOCUMENT',
- 'PROJECT',
- 'TASK',
- 'THREAD',
- 'USER',
- ])
- .describe(
- 'Type of entity that can be referenced by entity properties.'
- ),
- specific_message_id: zod
- .uuid()
- .nullish()
- .describe(
- 'For CHANNEL, CHAT, THREAD entity types - optional specific message ID.\nThis allows referencing a specific message within a thread\/channel\/chat.'
- ),
- })
- .describe(
- 'Entity reference for entity-type property values.'
- )
- )
- .describe(
- 'Entity reference(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"EntityReference\", \"value\": [{...}]} (length 0 or 1)\nMulti-select: {\"type\": \"EntityReference\", \"value\": [{...}, {...}, ...]} (length 0+)'
- ),
- })
- .describe(
- 'Entity reference(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"EntityReference\", \"value\": [{...}]} (length 0 or 1)\nMulti-select: {\"type\": \"EntityReference\", \"value\": [{...}, {...}, ...]} (length 0+)'
- ),
- zod
- .object({
- type: zod.enum(['Link']),
- value: zod
- .array(zod.string())
- .describe(
- 'Link value(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\"]} (length 0 or 1)\nMulti-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\", \"https:\/\/other.com\"]} (length 0+)'
- ),
- })
- .describe(
- 'Link value(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\"]} (length 0 or 1)\nMulti-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\", \"https:\/\/other.com\"]} (length 0+)'
- ),
- ])
- .describe(
- 'Property value (service representation).\n\nRepresents the actual value stored for an entity property.\nThis is serialized to\/from JSONB in the database.'
- ),
- ])
- .optional(),
- })
- .describe(
- 'A property attached to a Soup item.\n\nThis is a simplified representation that includes only the definition and value,\nomitting the entity property assignment metadata and options.'
- )
- )
- .describe('Properties attached to the thread.'),
})
)
.describe(
@@ -16122,71 +16287,14 @@ export const postItemsSoupAstGroupedResponse = zod
})
.describe(
'A top-level channel message thread for soup payloads.\n\nThis mirrors the public channel-message API shape so soup consumers can\nrender a thread root the same way they render a channel timeline message.'
- ),
- tag: zod.enum(['channelThread']),
- })
- .describe('Channel thread item.'),
- zod
- .object({
- data: zod
- .object({
- attended: zod
- .boolean()
- .describe(
- 'Whether the requesting user attended this call. Kept for compatibility\nand derived from `status == ATTENDED`.'
- ),
- callId: zod.uuid().describe('The call identifier.'),
- channelId: zod
- .uuid()
- .describe('The channel this call belongs to.'),
- channelName: zod
- .string()
- .nullish()
- .describe('Resolved display name for the channel.'),
- createdBy: zod
- .string()
- .describe('User who created the call.'),
- customName: zod
- .string()
- .nullish()
- .describe(
- 'User-supplied or AI-generated display name for the call.'
- ),
- durationMs: zod
- .number()
- .nullish()
- .describe(
- 'Call duration in milliseconds (None if still active).'
- ),
- endedAt: zod.iso
- .datetime({})
- .nullish()
- .describe(
- 'When the call ended (None if still active).'
- ),
- isActive: zod
- .boolean()
- .describe('Whether the call is currently active.'),
- participants: zod
- .array(
- zod
- .object({
- joinedAt: zod.iso
- .datetime({})
- .describe('When the user joined the call.'),
- leftAt: zod.iso
- .datetime({})
- .nullish()
- .describe(
- 'When the user left (None if still in an active call).'
- ),
- userId: zod.string().describe('The user id.'),
- })
- .describe(
- 'A participant in a call record, as displayed in Soup.'
- )
- )
- .describe('Participants in the call.'),
+ ),
+ tag: zod.enum(['channelThread']),
+ })
+ .describe('Channel thread item.'),
+ zod
+ .object({
+ data: zod
+ .object({
properties: zod
.array(
zod
@@ -16406,24 +16514,86 @@ export const postItemsSoupAstGroupedResponse = zod
'A property attached to a Soup item.\n\nThis is a simplified representation that includes only the definition and value,\nomitting the entity property assignment metadata and options.'
)
)
- .describe(
- 'Entity properties (e.g. tags). Populated after fetch by the soup repo.'
- ),
- startedAt: zod.iso
- .datetime({})
- .describe('When the call started.'),
- status: zod
- .enum(['ATTENDED', 'MISSED', 'UNATTENDED'])
- .describe(
- 'Viewer-relative attendance status for a call record.\nSerializes as `ATTENDED`, `MISSED`, or `UNATTENDED`.'
- ),
- summary: zod
- .string()
- .nullish()
- .describe(
- 'AI-generated summary of the call. Only set on archived\n`call_records` once summarization has run; active calls always\nreturn `None`.'
- ),
+ .describe('Properties attached to the entity.'),
})
+ .describe(
+ 'Property fields that can be flattened into property-bearing Soup items.'
+ )
+ .and(
+ zod.object({
+ attended: zod
+ .boolean()
+ .describe(
+ 'Whether the requesting user attended this call. Kept for compatibility\nand derived from `status == ATTENDED`.'
+ ),
+ callId: zod.uuid().describe('The call identifier.'),
+ channelId: zod
+ .uuid()
+ .describe('The channel this call belongs to.'),
+ channelName: zod
+ .string()
+ .nullish()
+ .describe('Resolved display name for the channel.'),
+ createdBy: zod
+ .string()
+ .describe('User who created the call.'),
+ customName: zod
+ .string()
+ .nullish()
+ .describe(
+ 'User-supplied or AI-generated display name for the call.'
+ ),
+ durationMs: zod
+ .number()
+ .nullish()
+ .describe(
+ 'Call duration in milliseconds (None if still active).'
+ ),
+ endedAt: zod.iso
+ .datetime({})
+ .nullish()
+ .describe(
+ 'When the call ended (None if still active).'
+ ),
+ isActive: zod
+ .boolean()
+ .describe('Whether the call is currently active.'),
+ participants: zod
+ .array(
+ zod
+ .object({
+ joinedAt: zod.iso
+ .datetime({})
+ .describe('When the user joined the call.'),
+ leftAt: zod.iso
+ .datetime({})
+ .nullish()
+ .describe(
+ 'When the user left (None if still in an active call).'
+ ),
+ userId: zod.string().describe('The user id.'),
+ })
+ .describe(
+ 'A participant in a call record, as displayed in Soup.'
+ )
+ )
+ .describe('Participants in the call.'),
+ startedAt: zod.iso
+ .datetime({})
+ .describe('When the call started.'),
+ status: zod
+ .enum(['ATTENDED', 'MISSED', 'UNATTENDED'])
+ .describe(
+ 'Viewer-relative attendance status for a call record.\nSerializes as `ATTENDED`, `MISSED`, or `UNATTENDED`.'
+ ),
+ summary: zod
+ .string()
+ .nullish()
+ .describe(
+ 'AI-generated summary of the call. Only set on archived\n`call_records` once summarization has run; active calls always\nreturn `None`.'
+ ),
+ })
+ )
.describe(
'A call record as displayed in Soup. Excludes room_name, egress_id,\nand transcript — fields that are irrelevant for the soup feed.'
),
@@ -16434,62 +16604,6 @@ export const postItemsSoupAstGroupedResponse = zod
.object({
data: zod
.object({
- createdAt: zod.iso
- .datetime({})
- .describe('When the company was created.'),
- description: zod
- .string()
- .nullish()
- .describe(
- "Display description from the primary domain's directory entry."
- ),
- domains: zod
- .array(
- zod
- .object({
- companyId: zod
- .uuid()
- .describe(
- 'The id of the company the domain belongs to.'
- ),
- createdAt: zod.iso
- .datetime({})
- .describe(
- 'When the domain record was created.'
- ),
- domain: zod
- .string()
- .describe(
- 'The domain (lowercased, e.g. \"acme.com\").'
- ),
- id: zod
- .uuid()
- .describe('The id of the domain record.'),
- })
- .describe(
- "A CRM domain as displayed in Soup. Mirrors the crm crate's\n[`CrmDomain`] with a stable wire shape that the FE can rely on."
- )
- )
- .describe(
- 'Domains associated with this company, ordered by creation time\nascending (primary first).'
- ),
- emailSync: zod
- .boolean()
- .describe(
- 'Whether email sync is enabled for this company.'
- ),
- hidden: zod
- .boolean()
- .describe(
- 'Whether the company is hidden from CRM listings. Soup filters\nthese out by default.'
- ),
- id: zod.uuid().describe('The id of the company.'),
- name: zod
- .string()
- .nullish()
- .describe(
- "Display name from the primary domain's directory entry, or\n`None` when unresolved."
- ),
properties: zod
.array(
zod
@@ -16709,25 +16823,85 @@ export const postItemsSoupAstGroupedResponse = zod
'A property attached to a Soup item.\n\nThis is a simplified representation that includes only the definition and value,\nomitting the entity property assignment metadata and options.'
)
)
- .optional()
- .describe(
- 'Properties attached to this company (system CRM properties like\nStage \/ Owner \/ Revenue plus any custom ones).'
- ),
- teamId: zod
- .uuid()
- .describe(
- 'The id of the team that owns this company record.'
- ),
- updatedAt: zod.iso
- .datetime({})
- .describe('When the company was last updated.'),
- viewedAt: zod.iso
- .datetime({})
- .nullish()
- .describe(
- 'When the requesting user last viewed this company, or `None` if\nnever viewed. Mirrors the `viewed_at` other soup entities carry.'
- ),
+ .describe('Properties attached to the entity.'),
})
+ .describe(
+ 'Property fields that can be flattened into property-bearing Soup items.'
+ )
+ .and(
+ zod.object({
+ createdAt: zod.iso
+ .datetime({})
+ .describe('When the company was created.'),
+ description: zod
+ .string()
+ .nullish()
+ .describe(
+ "Display description from the primary domain's directory entry."
+ ),
+ domains: zod
+ .array(
+ zod
+ .object({
+ companyId: zod
+ .uuid()
+ .describe(
+ 'The id of the company the domain belongs to.'
+ ),
+ createdAt: zod.iso
+ .datetime({})
+ .describe(
+ 'When the domain record was created.'
+ ),
+ domain: zod
+ .string()
+ .describe(
+ 'The domain (lowercased, e.g. \"acme.com\").'
+ ),
+ id: zod
+ .uuid()
+ .describe('The id of the domain record.'),
+ })
+ .describe(
+ "A CRM domain as displayed in Soup. Mirrors the crm crate's\n[`CrmDomain`] with a stable wire shape that the FE can rely on."
+ )
+ )
+ .describe(
+ 'Domains associated with this company, ordered by creation time\nascending (primary first).'
+ ),
+ emailSync: zod
+ .boolean()
+ .describe(
+ 'Whether email sync is enabled for this company.'
+ ),
+ hidden: zod
+ .boolean()
+ .describe(
+ 'Whether the company is hidden from CRM listings. Soup filters\nthese out by default.'
+ ),
+ id: zod.uuid().describe('The id of the company.'),
+ name: zod
+ .string()
+ .nullish()
+ .describe(
+ "Display name from the primary domain's directory entry, or\n`None` when unresolved."
+ ),
+ teamId: zod
+ .uuid()
+ .describe(
+ 'The id of the team that owns this company record.'
+ ),
+ updatedAt: zod.iso
+ .datetime({})
+ .describe('When the company was last updated.'),
+ viewedAt: zod.iso
+ .datetime({})
+ .nullish()
+ .describe(
+ 'When the requesting user last viewed this company, or `None` if\nnever viewed. Mirrors the `viewed_at` other soup entities carry.'
+ ),
+ })
+ )
.describe(
'A CRM company as displayed in Soup. Carries the core company\nfields plus display metadata resolved from `crm_domain_directory`\nagainst the primary (earliest-created) domain.'
),
@@ -16852,53 +17026,6 @@ export const postItemsSoupAstGroupedResponse = zod
.object({
data: zod
.object({
- branchedFromId: zod
- .uuid()
- .nullish()
- .describe(
- 'The id of the document this document branched from'
- ),
- branchedFromVersionId: zod
- .number()
- .nullish()
- .describe(
- 'The id of the version this document branched from\nThis could be either DocumentInstance or DocumentBom id depending on the file type'
- ),
- createdAt: zod.iso
- .datetime({})
- .describe('The time the document was created'),
- deletedAt: zod.iso
- .datetime({})
- .nullish()
- .describe('The time the document was deleted'),
- documentFamilyId: zod
- .number()
- .nullish()
- .describe(
- 'The id of the document family this document belongs to'
- ),
- documentVersionId: zod
- .number()
- .describe(
- 'The version of the document\nThis could be the document_instance_id or document_bom_id depending on the file type'
- ),
- fileType: zod
- .string()
- .nullish()
- .describe(
- 'The file type of the document (e.g. pdf, docx)'
- ),
- id: zod.uuid().describe('The document id'),
- name: zod.string().describe('The name of the document'),
- ownerId: zod
- .string()
- .describe('The owner of the document'),
- projectId: zod
- .uuid()
- .nullish()
- .describe(
- 'The id of the project that this document belongs to'
- ),
properties: zod
.array(
zod
@@ -17118,53 +17245,109 @@ export const postItemsSoupAstGroupedResponse = zod
'A property attached to a Soup item.\n\nThis is a simplified representation that includes only the definition and value,\nomitting the entity property assignment metadata and options.'
)
)
- .describe('Properties'),
- sha: zod
- .string()
- .nullish()
- .describe(
- 'If the document is a PDF, this is the SHA of the pdf\nIf the document is a DOCX, this will not be present'
- ),
- subType: zod
- .union([
- zod.null(),
- zod
- .union([
- zod
- .object({
- is_completed: zod
- .boolean()
- .describe(
- 'Whether the task is completed.\nTrue if the Status property is set to \"Completed\".'
- ),
- type: zod.enum(['task']),
- })
- .describe(
- 'A task document with its associated properties'
- ),
- zod
- .object({
- type: zod.enum(['snippet']),
- })
- .describe(
- 'A snippet document — reusable markdown'
- ),
- ])
- .describe(
- 'Sub type of a document with associated properties encoded in each variant.\nThis ensures type-safety: task properties only exist when the document is a task.'
- ),
- ])
- .optional(),
- updatedAt: zod.iso
- .datetime({})
- .describe(
- 'The time the document instance \/ document BOM was updated'
- ),
- viewedAt: zod.iso
- .datetime({})
- .nullish()
- .describe('The time the document was last viewed'),
+ .describe('Properties attached to the entity.'),
})
+ .describe(
+ 'Property fields that can be flattened into property-bearing Soup items.'
+ )
+ .and(
+ zod.object({
+ branchedFromId: zod
+ .uuid()
+ .nullish()
+ .describe(
+ 'The id of the document this document branched from'
+ ),
+ branchedFromVersionId: zod
+ .number()
+ .nullish()
+ .describe(
+ 'The id of the version this document branched from\nThis could be either DocumentInstance or DocumentBom id depending on the file type'
+ ),
+ createdAt: zod.iso
+ .datetime({})
+ .describe('The time the document was created'),
+ deletedAt: zod.iso
+ .datetime({})
+ .nullish()
+ .describe('The time the document was deleted'),
+ documentFamilyId: zod
+ .number()
+ .nullish()
+ .describe(
+ 'The id of the document family this document belongs to'
+ ),
+ documentVersionId: zod
+ .number()
+ .describe(
+ 'The version of the document\nThis could be the document_instance_id or document_bom_id depending on the file type'
+ ),
+ fileType: zod
+ .string()
+ .nullish()
+ .describe(
+ 'The file type of the document (e.g. pdf, docx)'
+ ),
+ id: zod.uuid().describe('The document id'),
+ name: zod
+ .string()
+ .describe('The name of the document'),
+ ownerId: zod
+ .string()
+ .describe('The owner of the document'),
+ projectId: zod
+ .uuid()
+ .nullish()
+ .describe(
+ 'The id of the project that this document belongs to'
+ ),
+ sha: zod
+ .string()
+ .nullish()
+ .describe(
+ 'If the document is a PDF, this is the SHA of the pdf\nIf the document is a DOCX, this will not be present'
+ ),
+ subType: zod
+ .union([
+ zod.null(),
+ zod
+ .union([
+ zod
+ .object({
+ is_completed: zod
+ .boolean()
+ .describe(
+ 'Whether the task is completed.\nTrue if the Status property is set to \"Completed\".'
+ ),
+ type: zod.enum(['task']),
+ })
+ .describe(
+ 'A task document with its associated properties'
+ ),
+ zod
+ .object({
+ type: zod.enum(['snippet']),
+ })
+ .describe(
+ 'A snippet document — reusable markdown'
+ ),
+ ])
+ .describe(
+ 'Sub type of a document with associated properties encoded in each variant.\nThis ensures type-safety: task properties only exist when the document is a task.'
+ ),
+ ])
+ .optional(),
+ updatedAt: zod.iso
+ .datetime({})
+ .describe(
+ 'The time the document instance \/ document BOM was updated'
+ ),
+ viewedAt: zod.iso
+ .datetime({})
+ .nullish()
+ .describe('The time the document was last viewed'),
+ })
+ )
.describe('A document as displayed in Soup.'),
tag: zod.enum(['document']),
})
@@ -17173,25 +17356,6 @@ export const postItemsSoupAstGroupedResponse = zod
.object({
data: zod
.object({
- createdAt: zod.iso
- .datetime({})
- .describe('The time the chat was created'),
- deletedAt: zod.iso
- .datetime({})
- .nullish()
- .describe('The time the chat was deleted'),
- id: zod.uuid().describe('The chat uuid'),
- isPersistent: zod
- .boolean()
- .describe('Whether the chat is persistent or not'),
- name: zod.string().describe('The name of the chat'),
- ownerId: zod
- .string()
- .describe('Who the chat belongs to'),
- projectId: zod
- .uuid()
- .nullish()
- .describe('The project id of the chat'),
properties: zod
.array(
zod
@@ -17411,15 +17575,41 @@ export const postItemsSoupAstGroupedResponse = zod
'A property attached to a Soup item.\n\nThis is a simplified representation that includes only the definition and value,\nomitting the entity property assignment metadata and options.'
)
)
- .describe('Properties'),
- updatedAt: zod.iso
- .datetime({})
- .describe('The time the chat was last updated'),
- viewedAt: zod.iso
- .datetime({})
- .nullish()
- .describe('The time the chat was last viewed'),
+ .describe('Properties attached to the entity.'),
})
+ .describe(
+ 'Property fields that can be flattened into property-bearing Soup items.'
+ )
+ .and(
+ zod.object({
+ createdAt: zod.iso
+ .datetime({})
+ .describe('The time the chat was created'),
+ deletedAt: zod.iso
+ .datetime({})
+ .nullish()
+ .describe('The time the chat was deleted'),
+ id: zod.uuid().describe('The chat uuid'),
+ isPersistent: zod
+ .boolean()
+ .describe('Whether the chat is persistent or not'),
+ name: zod.string().describe('The name of the chat'),
+ ownerId: zod
+ .string()
+ .describe('Who the chat belongs to'),
+ projectId: zod
+ .uuid()
+ .nullish()
+ .describe('The project id of the chat'),
+ updatedAt: zod.iso
+ .datetime({})
+ .describe('The time the chat was last updated'),
+ viewedAt: zod.iso
+ .datetime({})
+ .nullish()
+ .describe('The time the chat was last viewed'),
+ })
+ )
.describe('A chat as displayed in Soup.'),
tag: zod.enum(['chat']),
})
@@ -17428,22 +17618,6 @@ export const postItemsSoupAstGroupedResponse = zod
.object({
data: zod
.object({
- createdAt: zod.iso
- .datetime({})
- .describe('The time the project was created'),
- deletedAt: zod.iso
- .datetime({})
- .nullish()
- .describe('The time the project was deleted'),
- id: zod.uuid().describe('The id of the project'),
- name: zod.string().describe('The name of the project'),
- ownerId: zod
- .string()
- .describe('The user id of who created the project'),
- parentId: zod
- .uuid()
- .nullish()
- .describe('The parent project id'),
properties: zod
.array(
zod
@@ -17663,15 +17837,40 @@ export const postItemsSoupAstGroupedResponse = zod
'A property attached to a Soup item.\n\nThis is a simplified representation that includes only the definition and value,\nomitting the entity property assignment metadata and options.'
)
)
- .describe('Properties'),
- updatedAt: zod.iso
- .datetime({})
- .describe('The time the project was updated'),
- viewedAt: zod.iso
- .datetime({})
- .nullish()
- .describe('The time the document was last viewed'),
+ .describe('Properties attached to the entity.'),
})
+ .describe(
+ 'Property fields that can be flattened into property-bearing Soup items.'
+ )
+ .and(
+ zod.object({
+ createdAt: zod.iso
+ .datetime({})
+ .describe('The time the project was created'),
+ deletedAt: zod.iso
+ .datetime({})
+ .nullish()
+ .describe('The time the project was deleted'),
+ id: zod.uuid().describe('The id of the project'),
+ name: zod
+ .string()
+ .describe('The name of the project'),
+ ownerId: zod
+ .string()
+ .describe('The user id of who created the project'),
+ parentId: zod
+ .uuid()
+ .nullish()
+ .describe('The parent project id'),
+ updatedAt: zod.iso
+ .datetime({})
+ .describe('The time the project was updated'),
+ viewedAt: zod.iso
+ .datetime({})
+ .nullish()
+ .describe('The time the document was last viewed'),
+ })
+ )
.describe('A project as displayed in Soup.'),
tag: zod.enum(['project']),
})
@@ -17745,6 +17944,242 @@ export const postItemsSoupAstGroupedResponse = zod
.describe(
'Email thread preview data as displayed in Soup.'
)
+ .and(
+ zod
+ .object({
+ properties: zod
+ .array(
+ zod
+ .object({
+ definition: zod
+ .object({
+ created_at: zod.iso.datetime({}),
+ data_type: zod
+ .enum([
+ 'BOOLEAN',
+ 'DATE',
+ 'NUMBER',
+ 'STRING',
+ 'SELECT_NUMBER',
+ 'SELECT_STRING',
+ 'TAG',
+ 'ENTITY',
+ 'LINK',
+ ])
+ .describe(
+ 'Data type for property values, determining storage and validation.'
+ ),
+ display_name: zod.string(),
+ id: zod.uuid(),
+ is_metadata: zod
+ .boolean()
+ .describe(
+ 'Flag to indicate if this is a system-generated metadata property.\nNot stored in database - computed at service layer.'
+ ),
+ is_multi_select: zod.boolean(),
+ is_system: zod
+ .boolean()
+ .describe(
+ 'Flag to indicate if this is a system property (stored in DB).'
+ ),
+ owner: zod
+ .union([
+ zod
+ .object({
+ scope: zod.enum(['user']),
+ user_id: zod.string(),
+ })
+ .describe(
+ 'User-scoped property.'
+ ),
+ zod
+ .object({
+ scope: zod.enum(['team']),
+ team_id: zod.uuid(),
+ })
+ .describe(
+ 'Team-scoped property.'
+ ),
+ zod
+ .object({
+ scope: zod.enum(['system']),
+ })
+ .describe(
+ 'System-owned property (no user or team owner).'
+ ),
+ ])
+ .describe(
+ 'Defines who owns a property - user-scoped, team-scoped, or system.'
+ ),
+ specific_entity_type: zod
+ .union([
+ zod.null(),
+ zod
+ .enum([
+ 'CALL_RECORD',
+ 'CHANNEL',
+ 'CHAT',
+ 'COMPANY',
+ 'DOCUMENT',
+ 'PROJECT',
+ 'TASK',
+ 'THREAD',
+ 'USER',
+ ])
+ .describe(
+ 'Type of entity that can be referenced by entity properties.'
+ ),
+ ])
+ .optional(),
+ updated_at: zod.iso.datetime({}),
+ })
+ .describe(
+ 'Property definition model (service representation).'
+ ),
+ id: zod
+ .uuid()
+ .describe(
+ 'Globally unique id of the assignment attaching this property to an entity.'
+ ),
+ value: zod
+ .union([
+ zod.null(),
+ zod
+ .union([
+ zod
+ .object({
+ type: zod.enum(['Boolean']),
+ value: zod
+ .boolean()
+ .describe(
+ 'Boolean value\nSerializes as: {\"type\": \"Boolean\", \"value\": true}'
+ ),
+ })
+ .describe(
+ 'Boolean value\nSerializes as: {\"type\": \"Boolean\", \"value\": true}'
+ ),
+ zod
+ .object({
+ type: zod.enum(['Number']),
+ value: zod
+ .number()
+ .describe(
+ 'Numeric value\nSerializes as: {\"type\": \"Number\", \"value\": 42.5}'
+ ),
+ })
+ .describe(
+ 'Numeric value\nSerializes as: {\"type\": \"Number\", \"value\": 42.5}'
+ ),
+ zod
+ .object({
+ type: zod.enum(['String']),
+ value: zod
+ .string()
+ .describe(
+ 'String value\nSerializes as: {\"type\": \"String\", \"value\": \"text\"}'
+ ),
+ })
+ .describe(
+ 'String value\nSerializes as: {\"type\": \"String\", \"value\": \"text\"}'
+ ),
+ zod
+ .object({
+ type: zod.enum(['Date']),
+ value: zod.iso
+ .datetime({})
+ .describe(
+ 'Date\/timestamp value\nSerializes as: {\"type\": \"Date\", \"value\": \"2025-01-01T00:00:00Z\"}'
+ ),
+ })
+ .describe(
+ 'Date\/timestamp value\nSerializes as: {\"type\": \"Date\", \"value\": \"2025-01-01T00:00:00Z\"}'
+ ),
+ zod
+ .object({
+ type: zod.enum([
+ 'SelectOption',
+ ]),
+ value: zod
+ .array(zod.uuid())
+ .describe(
+ 'Select option(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"SelectOption\", \"value\": [\"uuid\"]} (length 0 or 1)\nMulti-select: {\"type\": \"SelectOption\", \"value\": [\"uuid1\", \"uuid2\", ...]} (length 0+)'
+ ),
+ })
+ .describe(
+ 'Select option(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"SelectOption\", \"value\": [\"uuid\"]} (length 0 or 1)\nMulti-select: {\"type\": \"SelectOption\", \"value\": [\"uuid1\", \"uuid2\", ...]} (length 0+)'
+ ),
+ zod
+ .object({
+ type: zod.enum([
+ 'EntityReference',
+ ]),
+ value: zod
+ .array(
+ zod
+ .object({
+ entity_id: zod.string(),
+ entity_type: zod
+ .enum([
+ 'CALL_RECORD',
+ 'CHANNEL',
+ 'CHAT',
+ 'COMPANY',
+ 'DOCUMENT',
+ 'PROJECT',
+ 'TASK',
+ 'THREAD',
+ 'USER',
+ ])
+ .describe(
+ 'Type of entity that can be referenced by entity properties.'
+ ),
+ specific_message_id: zod
+ .uuid()
+ .nullish()
+ .describe(
+ 'For CHANNEL, CHAT, THREAD entity types - optional specific message ID.\nThis allows referencing a specific message within a thread\/channel\/chat.'
+ ),
+ })
+ .describe(
+ 'Entity reference for entity-type property values.'
+ )
+ )
+ .describe(
+ 'Entity reference(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"EntityReference\", \"value\": [{...}]} (length 0 or 1)\nMulti-select: {\"type\": \"EntityReference\", \"value\": [{...}, {...}, ...]} (length 0+)'
+ ),
+ })
+ .describe(
+ 'Entity reference(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"EntityReference\", \"value\": [{...}]} (length 0 or 1)\nMulti-select: {\"type\": \"EntityReference\", \"value\": [{...}, {...}, ...]} (length 0+)'
+ ),
+ zod
+ .object({
+ type: zod.enum(['Link']),
+ value: zod
+ .array(zod.string())
+ .describe(
+ 'Link value(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\"]} (length 0 or 1)\nMulti-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\", \"https:\/\/other.com\"]} (length 0+)'
+ ),
+ })
+ .describe(
+ 'Link value(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\"]} (length 0 or 1)\nMulti-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\", \"https:\/\/other.com\"]} (length 0+)'
+ ),
+ ])
+ .describe(
+ 'Property value (service representation).\n\nRepresents the actual value stored for an entity property.\nThis is serialized to\/from JSONB in the database.'
+ ),
+ ])
+ .optional(),
+ })
+ .describe(
+ 'A property attached to a Soup item.\n\nThis is a simplified representation that includes only the definition and value,\nomitting the entity property assignment metadata and options.'
+ )
+ )
+ .describe('Properties attached to the entity.'),
+ })
+ .describe(
+ 'Property fields that can be flattened into property-bearing Soup items.'
+ )
+ )
.and(
zod.object({
attachments: zod
@@ -17860,236 +18295,14 @@ export const postItemsSoupAstGroupedResponse = zod
.string()
.nullish()
.describe(
- 'Contact photo URL from SFS, if available.'
- ),
- })
- .describe(
- 'A contact participating in an email thread as displayed in Soup.'
- )
- )
- .describe('Contacts participating in the thread.'),
- properties: zod
- .array(
- zod
- .object({
- definition: zod
- .object({
- created_at: zod.iso.datetime({}),
- data_type: zod
- .enum([
- 'BOOLEAN',
- 'DATE',
- 'NUMBER',
- 'STRING',
- 'SELECT_NUMBER',
- 'SELECT_STRING',
- 'TAG',
- 'ENTITY',
- 'LINK',
- ])
- .describe(
- 'Data type for property values, determining storage and validation.'
- ),
- display_name: zod.string(),
- id: zod.uuid(),
- is_metadata: zod
- .boolean()
- .describe(
- 'Flag to indicate if this is a system-generated metadata property.\nNot stored in database - computed at service layer.'
- ),
- is_multi_select: zod.boolean(),
- is_system: zod
- .boolean()
- .describe(
- 'Flag to indicate if this is a system property (stored in DB).'
- ),
- owner: zod
- .union([
- zod
- .object({
- scope: zod.enum(['user']),
- user_id: zod.string(),
- })
- .describe('User-scoped property.'),
- zod
- .object({
- scope: zod.enum(['team']),
- team_id: zod.uuid(),
- })
- .describe('Team-scoped property.'),
- zod
- .object({
- scope: zod.enum(['system']),
- })
- .describe(
- 'System-owned property (no user or team owner).'
- ),
- ])
- .describe(
- 'Defines who owns a property - user-scoped, team-scoped, or system.'
- ),
- specific_entity_type: zod
- .union([
- zod.null(),
- zod
- .enum([
- 'CALL_RECORD',
- 'CHANNEL',
- 'CHAT',
- 'COMPANY',
- 'DOCUMENT',
- 'PROJECT',
- 'TASK',
- 'THREAD',
- 'USER',
- ])
- .describe(
- 'Type of entity that can be referenced by entity properties.'
- ),
- ])
- .optional(),
- updated_at: zod.iso.datetime({}),
- })
- .describe(
- 'Property definition model (service representation).'
- ),
- id: zod
- .uuid()
- .describe(
- 'Globally unique id of the assignment attaching this property to an entity.'
+ 'Contact photo URL from SFS, if available.'
),
- value: zod
- .union([
- zod.null(),
- zod
- .union([
- zod
- .object({
- type: zod.enum(['Boolean']),
- value: zod
- .boolean()
- .describe(
- 'Boolean value\nSerializes as: {\"type\": \"Boolean\", \"value\": true}'
- ),
- })
- .describe(
- 'Boolean value\nSerializes as: {\"type\": \"Boolean\", \"value\": true}'
- ),
- zod
- .object({
- type: zod.enum(['Number']),
- value: zod
- .number()
- .describe(
- 'Numeric value\nSerializes as: {\"type\": \"Number\", \"value\": 42.5}'
- ),
- })
- .describe(
- 'Numeric value\nSerializes as: {\"type\": \"Number\", \"value\": 42.5}'
- ),
- zod
- .object({
- type: zod.enum(['String']),
- value: zod
- .string()
- .describe(
- 'String value\nSerializes as: {\"type\": \"String\", \"value\": \"text\"}'
- ),
- })
- .describe(
- 'String value\nSerializes as: {\"type\": \"String\", \"value\": \"text\"}'
- ),
- zod
- .object({
- type: zod.enum(['Date']),
- value: zod.iso
- .datetime({})
- .describe(
- 'Date\/timestamp value\nSerializes as: {\"type\": \"Date\", \"value\": \"2025-01-01T00:00:00Z\"}'
- ),
- })
- .describe(
- 'Date\/timestamp value\nSerializes as: {\"type\": \"Date\", \"value\": \"2025-01-01T00:00:00Z\"}'
- ),
- zod
- .object({
- type: zod.enum(['SelectOption']),
- value: zod
- .array(zod.uuid())
- .describe(
- 'Select option(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"SelectOption\", \"value\": [\"uuid\"]} (length 0 or 1)\nMulti-select: {\"type\": \"SelectOption\", \"value\": [\"uuid1\", \"uuid2\", ...]} (length 0+)'
- ),
- })
- .describe(
- 'Select option(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"SelectOption\", \"value\": [\"uuid\"]} (length 0 or 1)\nMulti-select: {\"type\": \"SelectOption\", \"value\": [\"uuid1\", \"uuid2\", ...]} (length 0+)'
- ),
- zod
- .object({
- type: zod.enum([
- 'EntityReference',
- ]),
- value: zod
- .array(
- zod
- .object({
- entity_id: zod.string(),
- entity_type: zod
- .enum([
- 'CALL_RECORD',
- 'CHANNEL',
- 'CHAT',
- 'COMPANY',
- 'DOCUMENT',
- 'PROJECT',
- 'TASK',
- 'THREAD',
- 'USER',
- ])
- .describe(
- 'Type of entity that can be referenced by entity properties.'
- ),
- specific_message_id: zod
- .uuid()
- .nullish()
- .describe(
- 'For CHANNEL, CHAT, THREAD entity types - optional specific message ID.\nThis allows referencing a specific message within a thread\/channel\/chat.'
- ),
- })
- .describe(
- 'Entity reference for entity-type property values.'
- )
- )
- .describe(
- 'Entity reference(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"EntityReference\", \"value\": [{...}]} (length 0 or 1)\nMulti-select: {\"type\": \"EntityReference\", \"value\": [{...}, {...}, ...]} (length 0+)'
- ),
- })
- .describe(
- 'Entity reference(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"EntityReference\", \"value\": [{...}]} (length 0 or 1)\nMulti-select: {\"type\": \"EntityReference\", \"value\": [{...}, {...}, ...]} (length 0+)'
- ),
- zod
- .object({
- type: zod.enum(['Link']),
- value: zod
- .array(zod.string())
- .describe(
- 'Link value(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\"]} (length 0 or 1)\nMulti-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\", \"https:\/\/other.com\"]} (length 0+)'
- ),
- })
- .describe(
- 'Link value(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\"]} (length 0 or 1)\nMulti-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\", \"https:\/\/other.com\"]} (length 0+)'
- ),
- ])
- .describe(
- 'Property value (service representation).\n\nRepresents the actual value stored for an entity property.\nThis is serialized to\/from JSONB in the database.'
- ),
- ])
- .optional(),
})
.describe(
- 'A property attached to a Soup item.\n\nThis is a simplified representation that includes only the definition and value,\nomitting the entity property assignment metadata and options.'
+ 'A contact participating in an email thread as displayed in Soup.'
)
)
- .describe('Properties attached to the thread.'),
+ .describe('Contacts participating in the thread.'),
})
)
.describe(
@@ -18483,63 +18696,6 @@ export const postItemsSoupAstGroupedResponse = zod
.object({
data: zod
.object({
- attended: zod
- .boolean()
- .describe(
- 'Whether the requesting user attended this call. Kept for compatibility\nand derived from `status == ATTENDED`.'
- ),
- callId: zod.uuid().describe('The call identifier.'),
- channelId: zod
- .uuid()
- .describe('The channel this call belongs to.'),
- channelName: zod
- .string()
- .nullish()
- .describe('Resolved display name for the channel.'),
- createdBy: zod
- .string()
- .describe('User who created the call.'),
- customName: zod
- .string()
- .nullish()
- .describe(
- 'User-supplied or AI-generated display name for the call.'
- ),
- durationMs: zod
- .number()
- .nullish()
- .describe(
- 'Call duration in milliseconds (None if still active).'
- ),
- endedAt: zod.iso
- .datetime({})
- .nullish()
- .describe(
- 'When the call ended (None if still active).'
- ),
- isActive: zod
- .boolean()
- .describe('Whether the call is currently active.'),
- participants: zod
- .array(
- zod
- .object({
- joinedAt: zod.iso
- .datetime({})
- .describe('When the user joined the call.'),
- leftAt: zod.iso
- .datetime({})
- .nullish()
- .describe(
- 'When the user left (None if still in an active call).'
- ),
- userId: zod.string().describe('The user id.'),
- })
- .describe(
- 'A participant in a call record, as displayed in Soup.'
- )
- )
- .describe('Participants in the call.'),
properties: zod
.array(
zod
@@ -18759,24 +18915,86 @@ export const postItemsSoupAstGroupedResponse = zod
'A property attached to a Soup item.\n\nThis is a simplified representation that includes only the definition and value,\nomitting the entity property assignment metadata and options.'
)
)
- .describe(
- 'Entity properties (e.g. tags). Populated after fetch by the soup repo.'
- ),
- startedAt: zod.iso
- .datetime({})
- .describe('When the call started.'),
- status: zod
- .enum(['ATTENDED', 'MISSED', 'UNATTENDED'])
- .describe(
- 'Viewer-relative attendance status for a call record.\nSerializes as `ATTENDED`, `MISSED`, or `UNATTENDED`.'
- ),
- summary: zod
- .string()
- .nullish()
- .describe(
- 'AI-generated summary of the call. Only set on archived\n`call_records` once summarization has run; active calls always\nreturn `None`.'
- ),
+ .describe('Properties attached to the entity.'),
})
+ .describe(
+ 'Property fields that can be flattened into property-bearing Soup items.'
+ )
+ .and(
+ zod.object({
+ attended: zod
+ .boolean()
+ .describe(
+ 'Whether the requesting user attended this call. Kept for compatibility\nand derived from `status == ATTENDED`.'
+ ),
+ callId: zod.uuid().describe('The call identifier.'),
+ channelId: zod
+ .uuid()
+ .describe('The channel this call belongs to.'),
+ channelName: zod
+ .string()
+ .nullish()
+ .describe('Resolved display name for the channel.'),
+ createdBy: zod
+ .string()
+ .describe('User who created the call.'),
+ customName: zod
+ .string()
+ .nullish()
+ .describe(
+ 'User-supplied or AI-generated display name for the call.'
+ ),
+ durationMs: zod
+ .number()
+ .nullish()
+ .describe(
+ 'Call duration in milliseconds (None if still active).'
+ ),
+ endedAt: zod.iso
+ .datetime({})
+ .nullish()
+ .describe(
+ 'When the call ended (None if still active).'
+ ),
+ isActive: zod
+ .boolean()
+ .describe('Whether the call is currently active.'),
+ participants: zod
+ .array(
+ zod
+ .object({
+ joinedAt: zod.iso
+ .datetime({})
+ .describe('When the user joined the call.'),
+ leftAt: zod.iso
+ .datetime({})
+ .nullish()
+ .describe(
+ 'When the user left (None if still in an active call).'
+ ),
+ userId: zod.string().describe('The user id.'),
+ })
+ .describe(
+ 'A participant in a call record, as displayed in Soup.'
+ )
+ )
+ .describe('Participants in the call.'),
+ startedAt: zod.iso
+ .datetime({})
+ .describe('When the call started.'),
+ status: zod
+ .enum(['ATTENDED', 'MISSED', 'UNATTENDED'])
+ .describe(
+ 'Viewer-relative attendance status for a call record.\nSerializes as `ATTENDED`, `MISSED`, or `UNATTENDED`.'
+ ),
+ summary: zod
+ .string()
+ .nullish()
+ .describe(
+ 'AI-generated summary of the call. Only set on archived\n`call_records` once summarization has run; active calls always\nreturn `None`.'
+ ),
+ })
+ )
.describe(
'A call record as displayed in Soup. Excludes room_name, egress_id,\nand transcript — fields that are irrelevant for the soup feed.'
),
@@ -18787,62 +19005,6 @@ export const postItemsSoupAstGroupedResponse = zod
.object({
data: zod
.object({
- createdAt: zod.iso
- .datetime({})
- .describe('When the company was created.'),
- description: zod
- .string()
- .nullish()
- .describe(
- "Display description from the primary domain's directory entry."
- ),
- domains: zod
- .array(
- zod
- .object({
- companyId: zod
- .uuid()
- .describe(
- 'The id of the company the domain belongs to.'
- ),
- createdAt: zod.iso
- .datetime({})
- .describe(
- 'When the domain record was created.'
- ),
- domain: zod
- .string()
- .describe(
- 'The domain (lowercased, e.g. \"acme.com\").'
- ),
- id: zod
- .uuid()
- .describe('The id of the domain record.'),
- })
- .describe(
- "A CRM domain as displayed in Soup. Mirrors the crm crate's\n[`CrmDomain`] with a stable wire shape that the FE can rely on."
- )
- )
- .describe(
- 'Domains associated with this company, ordered by creation time\nascending (primary first).'
- ),
- emailSync: zod
- .boolean()
- .describe(
- 'Whether email sync is enabled for this company.'
- ),
- hidden: zod
- .boolean()
- .describe(
- 'Whether the company is hidden from CRM listings. Soup filters\nthese out by default.'
- ),
- id: zod.uuid().describe('The id of the company.'),
- name: zod
- .string()
- .nullish()
- .describe(
- "Display name from the primary domain's directory entry, or\n`None` when unresolved."
- ),
properties: zod
.array(
zod
@@ -19062,25 +19224,85 @@ export const postItemsSoupAstGroupedResponse = zod
'A property attached to a Soup item.\n\nThis is a simplified representation that includes only the definition and value,\nomitting the entity property assignment metadata and options.'
)
)
- .optional()
- .describe(
- 'Properties attached to this company (system CRM properties like\nStage \/ Owner \/ Revenue plus any custom ones).'
- ),
- teamId: zod
- .uuid()
- .describe(
- 'The id of the team that owns this company record.'
- ),
- updatedAt: zod.iso
- .datetime({})
- .describe('When the company was last updated.'),
- viewedAt: zod.iso
- .datetime({})
- .nullish()
- .describe(
- 'When the requesting user last viewed this company, or `None` if\nnever viewed. Mirrors the `viewed_at` other soup entities carry.'
- ),
+ .describe('Properties attached to the entity.'),
})
+ .describe(
+ 'Property fields that can be flattened into property-bearing Soup items.'
+ )
+ .and(
+ zod.object({
+ createdAt: zod.iso
+ .datetime({})
+ .describe('When the company was created.'),
+ description: zod
+ .string()
+ .nullish()
+ .describe(
+ "Display description from the primary domain's directory entry."
+ ),
+ domains: zod
+ .array(
+ zod
+ .object({
+ companyId: zod
+ .uuid()
+ .describe(
+ 'The id of the company the domain belongs to.'
+ ),
+ createdAt: zod.iso
+ .datetime({})
+ .describe(
+ 'When the domain record was created.'
+ ),
+ domain: zod
+ .string()
+ .describe(
+ 'The domain (lowercased, e.g. \"acme.com\").'
+ ),
+ id: zod
+ .uuid()
+ .describe('The id of the domain record.'),
+ })
+ .describe(
+ "A CRM domain as displayed in Soup. Mirrors the crm crate's\n[`CrmDomain`] with a stable wire shape that the FE can rely on."
+ )
+ )
+ .describe(
+ 'Domains associated with this company, ordered by creation time\nascending (primary first).'
+ ),
+ emailSync: zod
+ .boolean()
+ .describe(
+ 'Whether email sync is enabled for this company.'
+ ),
+ hidden: zod
+ .boolean()
+ .describe(
+ 'Whether the company is hidden from CRM listings. Soup filters\nthese out by default.'
+ ),
+ id: zod.uuid().describe('The id of the company.'),
+ name: zod
+ .string()
+ .nullish()
+ .describe(
+ "Display name from the primary domain's directory entry, or\n`None` when unresolved."
+ ),
+ teamId: zod
+ .uuid()
+ .describe(
+ 'The id of the team that owns this company record.'
+ ),
+ updatedAt: zod.iso
+ .datetime({})
+ .describe('When the company was last updated.'),
+ viewedAt: zod.iso
+ .datetime({})
+ .nullish()
+ .describe(
+ 'When the requesting user last viewed this company, or `None` if\nnever viewed. Mirrors the `viewed_at` other soup entities carry.'
+ ),
+ })
+ )
.describe(
'A CRM company as displayed in Soup. Carries the core company\nfields plus display metadata resolved from `crm_domain_directory`\nagainst the primary (earliest-created) domain.'
),
diff --git a/apps/web/src/lib/service-clients/service-storage/openapi.json b/apps/web/src/lib/service-clients/service-storage/openapi.json
index cdd667a31f..1d5632e9c9 100644
--- a/apps/web/src/lib/service-clients/service-storage/openapi.json
+++ b/apps/web/src/lib/service-clients/service-storage/openapi.json
@@ -18352,90 +18352,6 @@
}
}
},
- "SoupCallRecord": {
- "type": "object",
- "description": "A call record as displayed in Soup. Excludes room_name, egress_id,\nand transcript — fields that are irrelevant for the soup feed.",
- "required": [
- "callId",
- "channelId",
- "createdBy",
- "startedAt",
- "isActive",
- "status",
- "attended",
- "participants",
- "properties"
- ],
- "properties": {
- "attended": {
- "type": "boolean",
- "description": "Whether the requesting user attended this call. Kept for compatibility\nand derived from `status == ATTENDED`."
- },
- "callId": {
- "type": "string",
- "format": "uuid",
- "description": "The call identifier."
- },
- "channelId": {
- "type": "string",
- "format": "uuid",
- "description": "The channel this call belongs to."
- },
- "channelName": {
- "type": ["string", "null"],
- "description": "Resolved display name for the channel."
- },
- "createdBy": {
- "type": "string",
- "description": "User who created the call."
- },
- "customName": {
- "type": ["string", "null"],
- "description": "User-supplied or AI-generated display name for the call."
- },
- "durationMs": {
- "type": ["integer", "null"],
- "format": "int64",
- "description": "Call duration in milliseconds (None if still active)."
- },
- "endedAt": {
- "type": ["string", "null"],
- "format": "date-time",
- "description": "When the call ended (None if still active)."
- },
- "isActive": {
- "type": "boolean",
- "description": "Whether the call is currently active."
- },
- "participants": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/SoupCallRecordParticipant"
- },
- "description": "Participants in the call."
- },
- "properties": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/SoupProperty"
- },
- "description": "Entity properties (e.g. tags). Populated after fetch by the soup repo."
- },
- "startedAt": {
- "type": "string",
- "format": "date-time",
- "description": "When the call started."
- },
- "status": {
- "$ref": "#/components/schemas/CallStatus",
- "description": "Viewer-relative call status for the requesting user."
- },
- "summary": {
- "type": ["string", "null"],
- "description": "AI-generated summary of the call. Only set on archived\n`call_records` once summarization has run; active calls always\nreturn `None`."
- }
- }
- },
"SoupCallRecordParticipant": {
"type": "object",
"description": "A participant in a call record, as displayed in Soup.",
@@ -18457,6 +18373,100 @@
}
}
},
+ "SoupCallRecord_SoupPropertiesField": {
+ "allOf": [
+ {
+ "type": "object",
+ "description": "Property fields that can be flattened into property-bearing Soup items.",
+ "required": ["properties"],
+ "properties": {
+ "properties": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/SoupProperty"
+ },
+ "description": "Properties attached to the entity."
+ }
+ }
+ },
+ {
+ "type": "object",
+ "required": [
+ "callId",
+ "channelId",
+ "createdBy",
+ "startedAt",
+ "isActive",
+ "status",
+ "attended",
+ "participants"
+ ],
+ "properties": {
+ "attended": {
+ "type": "boolean",
+ "description": "Whether the requesting user attended this call. Kept for compatibility\nand derived from `status == ATTENDED`."
+ },
+ "callId": {
+ "type": "string",
+ "format": "uuid",
+ "description": "The call identifier."
+ },
+ "channelId": {
+ "type": "string",
+ "format": "uuid",
+ "description": "The channel this call belongs to."
+ },
+ "channelName": {
+ "type": ["string", "null"],
+ "description": "Resolved display name for the channel."
+ },
+ "createdBy": {
+ "type": "string",
+ "description": "User who created the call."
+ },
+ "customName": {
+ "type": ["string", "null"],
+ "description": "User-supplied or AI-generated display name for the call."
+ },
+ "durationMs": {
+ "type": ["integer", "null"],
+ "format": "int64",
+ "description": "Call duration in milliseconds (None if still active)."
+ },
+ "endedAt": {
+ "type": ["string", "null"],
+ "format": "date-time",
+ "description": "When the call ended (None if still active)."
+ },
+ "isActive": {
+ "type": "boolean",
+ "description": "Whether the call is currently active."
+ },
+ "participants": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/SoupCallRecordParticipant"
+ },
+ "description": "Participants in the call."
+ },
+ "startedAt": {
+ "type": "string",
+ "format": "date-time",
+ "description": "When the call started."
+ },
+ "status": {
+ "$ref": "#/components/schemas/CallStatus",
+ "description": "Viewer-relative call status for the requesting user."
+ },
+ "summary": {
+ "type": ["string", "null"],
+ "description": "AI-generated summary of the call. Only set on archived\n`call_records` once summarization has run; active calls always\nreturn `None`."
+ }
+ }
+ }
+ ],
+ "description": "A call record as displayed in Soup. Excludes room_name, egress_id,\nand transcript — fields that are irrelevant for the soup feed."
+ },
"SoupChannel": {
"allOf": [
{
@@ -18563,69 +18573,79 @@
}
}
},
- "SoupChat": {
- "type": "object",
- "description": "A chat as displayed in Soup.",
- "required": [
- "id",
- "name",
- "ownerId",
- "isPersistent",
- "createdAt",
- "updatedAt",
- "properties"
- ],
- "properties": {
- "createdAt": {
- "type": "string",
- "format": "date-time",
- "description": "The time the chat was created"
- },
- "deletedAt": {
- "type": ["string", "null"],
- "format": "date-time",
- "description": "The time the chat was deleted"
- },
- "id": {
- "type": "string",
- "format": "uuid",
- "description": "The chat uuid"
- },
- "isPersistent": {
- "type": "boolean",
- "description": "Whether the chat is persistent or not"
- },
- "name": {
- "type": "string",
- "description": "The name of the chat"
- },
- "ownerId": {
- "type": "string",
- "description": "Who the chat belongs to"
- },
- "projectId": {
- "type": ["string", "null"],
- "format": "uuid",
- "description": "The project id of the chat"
- },
- "properties": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/SoupProperty"
- },
- "description": "Properties"
- },
- "updatedAt": {
- "type": "string",
- "format": "date-time",
- "description": "The time the chat was last updated"
+ "SoupChat_SoupPropertiesField": {
+ "allOf": [
+ {
+ "type": "object",
+ "description": "Property fields that can be flattened into property-bearing Soup items.",
+ "required": ["properties"],
+ "properties": {
+ "properties": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/SoupProperty"
+ },
+ "description": "Properties attached to the entity."
+ }
+ }
},
- "viewedAt": {
- "type": ["string", "null"],
- "format": "date-time",
- "description": "The time the chat was last viewed"
+ {
+ "type": "object",
+ "required": [
+ "id",
+ "name",
+ "ownerId",
+ "isPersistent",
+ "createdAt",
+ "updatedAt"
+ ],
+ "properties": {
+ "createdAt": {
+ "type": "string",
+ "format": "date-time",
+ "description": "The time the chat was created"
+ },
+ "deletedAt": {
+ "type": ["string", "null"],
+ "format": "date-time",
+ "description": "The time the chat was deleted"
+ },
+ "id": {
+ "type": "string",
+ "format": "uuid",
+ "description": "The chat uuid"
+ },
+ "isPersistent": {
+ "type": "boolean",
+ "description": "Whether the chat is persistent or not"
+ },
+ "name": {
+ "type": "string",
+ "description": "The name of the chat"
+ },
+ "ownerId": {
+ "type": "string",
+ "description": "Who the chat belongs to"
+ },
+ "projectId": {
+ "type": ["string", "null"],
+ "format": "uuid",
+ "description": "The project id of the chat"
+ },
+ "updatedAt": {
+ "type": "string",
+ "format": "date-time",
+ "description": "The time the chat was last updated"
+ },
+ "viewedAt": {
+ "type": ["string", "null"],
+ "format": "date-time",
+ "description": "The time the chat was last viewed"
+ }
+ }
}
- }
+ ],
+ "description": "A chat as displayed in Soup."
},
"SoupContact": {
"type": "object",
@@ -18674,75 +18694,86 @@
}
}
},
- "SoupCrmCompany": {
- "type": "object",
- "description": "A CRM company as displayed in Soup. Carries the core company\nfields plus display metadata resolved from `crm_domain_directory`\nagainst the primary (earliest-created) domain.",
- "required": [
- "id",
- "teamId",
- "emailSync",
- "hidden",
- "createdAt",
- "updatedAt",
- "domains"
- ],
- "properties": {
- "createdAt": {
- "type": "string",
- "format": "date-time",
- "description": "When the company was created."
- },
- "description": {
- "type": ["string", "null"],
- "description": "Display description from the primary domain's directory entry."
- },
- "domains": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/SoupCrmDomain"
- },
- "description": "Domains associated with this company, ordered by creation time\nascending (primary first)."
- },
- "emailSync": {
- "type": "boolean",
- "description": "Whether email sync is enabled for this company."
- },
- "hidden": {
- "type": "boolean",
- "description": "Whether the company is hidden from CRM listings. Soup filters\nthese out by default."
- },
- "id": {
- "type": "string",
- "format": "uuid",
- "description": "The id of the company."
- },
- "name": {
- "type": ["string", "null"],
- "description": "Display name from the primary domain's directory entry, or\n`None` when unresolved."
- },
- "properties": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/SoupProperty"
- },
- "description": "Properties attached to this company (system CRM properties like\nStage / Owner / Revenue plus any custom ones)."
- },
- "teamId": {
- "type": "string",
- "format": "uuid",
- "description": "The id of the team that owns this company record."
- },
- "updatedAt": {
- "type": "string",
- "format": "date-time",
- "description": "When the company was last updated."
+ "SoupCrmCompany_SoupPropertiesField": {
+ "allOf": [
+ {
+ "type": "object",
+ "description": "Property fields that can be flattened into property-bearing Soup items.",
+ "required": ["properties"],
+ "properties": {
+ "properties": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/SoupProperty"
+ },
+ "description": "Properties attached to the entity."
+ }
+ }
},
- "viewedAt": {
- "type": ["string", "null"],
- "format": "date-time",
- "description": "When the requesting user last viewed this company, or `None` if\nnever viewed. Mirrors the `viewed_at` other soup entities carry."
+ {
+ "type": "object",
+ "required": [
+ "id",
+ "teamId",
+ "emailSync",
+ "hidden",
+ "createdAt",
+ "updatedAt",
+ "domains"
+ ],
+ "properties": {
+ "createdAt": {
+ "type": "string",
+ "format": "date-time",
+ "description": "When the company was created."
+ },
+ "description": {
+ "type": ["string", "null"],
+ "description": "Display description from the primary domain's directory entry."
+ },
+ "domains": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/SoupCrmDomain"
+ },
+ "description": "Domains associated with this company, ordered by creation time\nascending (primary first)."
+ },
+ "emailSync": {
+ "type": "boolean",
+ "description": "Whether email sync is enabled for this company."
+ },
+ "hidden": {
+ "type": "boolean",
+ "description": "Whether the company is hidden from CRM listings. Soup filters\nthese out by default."
+ },
+ "id": {
+ "type": "string",
+ "format": "uuid",
+ "description": "The id of the company."
+ },
+ "name": {
+ "type": ["string", "null"],
+ "description": "Display name from the primary domain's directory entry, or\n`None` when unresolved."
+ },
+ "teamId": {
+ "type": "string",
+ "format": "uuid",
+ "description": "The id of the team that owns this company record."
+ },
+ "updatedAt": {
+ "type": "string",
+ "format": "date-time",
+ "description": "When the company was last updated."
+ },
+ "viewedAt": {
+ "type": ["string", "null"],
+ "format": "date-time",
+ "description": "When the requesting user last viewed this company, or `None` if\nnever viewed. Mirrors the `viewed_at` other soup entities carry."
+ }
+ }
}
- }
+ ],
+ "description": "A CRM company as displayed in Soup. Carries the core company\nfields plus display metadata resolved from `crm_domain_directory`\nagainst the primary (earliest-created) domain."
},
"SoupCrmDomain": {
"type": "object",
@@ -18770,105 +18801,6 @@
}
}
},
- "SoupDocument": {
- "type": "object",
- "description": "A document as displayed in Soup.",
- "required": [
- "id",
- "documentVersionId",
- "ownerId",
- "name",
- "createdAt",
- "updatedAt",
- "properties"
- ],
- "properties": {
- "branchedFromId": {
- "type": ["string", "null"],
- "format": "uuid",
- "description": "The id of the document this document branched from"
- },
- "branchedFromVersionId": {
- "type": ["integer", "null"],
- "format": "int64",
- "description": "The id of the version this document branched from\nThis could be either DocumentInstance or DocumentBom id depending on the file type"
- },
- "createdAt": {
- "type": "string",
- "format": "date-time",
- "description": "The time the document was created"
- },
- "deletedAt": {
- "type": ["string", "null"],
- "format": "date-time",
- "description": "The time the document was deleted"
- },
- "documentFamilyId": {
- "type": ["integer", "null"],
- "format": "int64",
- "description": "The id of the document family this document belongs to"
- },
- "documentVersionId": {
- "type": "integer",
- "format": "int64",
- "description": "The version of the document\nThis could be the document_instance_id or document_bom_id depending on the file type"
- },
- "fileType": {
- "type": ["string", "null"],
- "description": "The file type of the document (e.g. pdf, docx)"
- },
- "id": {
- "type": "string",
- "format": "uuid",
- "description": "The document id"
- },
- "name": {
- "type": "string",
- "description": "The name of the document"
- },
- "ownerId": {
- "type": "string",
- "description": "The owner of the document"
- },
- "projectId": {
- "type": ["string", "null"],
- "format": "uuid",
- "description": "The id of the project that this document belongs to"
- },
- "properties": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/SoupProperty"
- },
- "description": "Properties"
- },
- "sha": {
- "type": ["string", "null"],
- "description": "If the document is a PDF, this is the SHA of the pdf\nIf the document is a DOCX, this will not be present"
- },
- "subType": {
- "oneOf": [
- {
- "type": "null"
- },
- {
- "$ref": "#/components/schemas/SoupDocumentSubType",
- "description": "The sub type of the document if present.\nTask-related properties are encoded within the variant."
- }
- ]
- },
- "updatedAt": {
- "type": "string",
- "format": "date-time",
- "description": "The time the document instance / document BOM was updated"
- },
- "viewedAt": {
- "type": ["string", "null"],
- "format": "date-time",
- "description": "The time the document was last viewed"
- }
- }
- },
"SoupDocumentSubType": {
"oneOf": [
{
@@ -18900,6 +18832,115 @@
],
"description": "Sub type of a document with associated properties encoded in each variant.\nThis ensures type-safety: task properties only exist when the document is a task."
},
+ "SoupDocument_SoupPropertiesField": {
+ "allOf": [
+ {
+ "type": "object",
+ "description": "Property fields that can be flattened into property-bearing Soup items.",
+ "required": ["properties"],
+ "properties": {
+ "properties": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/SoupProperty"
+ },
+ "description": "Properties attached to the entity."
+ }
+ }
+ },
+ {
+ "type": "object",
+ "required": [
+ "id",
+ "documentVersionId",
+ "ownerId",
+ "name",
+ "createdAt",
+ "updatedAt"
+ ],
+ "properties": {
+ "branchedFromId": {
+ "type": ["string", "null"],
+ "format": "uuid",
+ "description": "The id of the document this document branched from"
+ },
+ "branchedFromVersionId": {
+ "type": ["integer", "null"],
+ "format": "int64",
+ "description": "The id of the version this document branched from\nThis could be either DocumentInstance or DocumentBom id depending on the file type"
+ },
+ "createdAt": {
+ "type": "string",
+ "format": "date-time",
+ "description": "The time the document was created"
+ },
+ "deletedAt": {
+ "type": ["string", "null"],
+ "format": "date-time",
+ "description": "The time the document was deleted"
+ },
+ "documentFamilyId": {
+ "type": ["integer", "null"],
+ "format": "int64",
+ "description": "The id of the document family this document belongs to"
+ },
+ "documentVersionId": {
+ "type": "integer",
+ "format": "int64",
+ "description": "The version of the document\nThis could be the document_instance_id or document_bom_id depending on the file type"
+ },
+ "fileType": {
+ "type": ["string", "null"],
+ "description": "The file type of the document (e.g. pdf, docx)"
+ },
+ "id": {
+ "type": "string",
+ "format": "uuid",
+ "description": "The document id"
+ },
+ "name": {
+ "type": "string",
+ "description": "The name of the document"
+ },
+ "ownerId": {
+ "type": "string",
+ "description": "The owner of the document"
+ },
+ "projectId": {
+ "type": ["string", "null"],
+ "format": "uuid",
+ "description": "The id of the project that this document belongs to"
+ },
+ "sha": {
+ "type": ["string", "null"],
+ "description": "If the document is a PDF, this is the SHA of the pdf\nIf the document is a DOCX, this will not be present"
+ },
+ "subType": {
+ "oneOf": [
+ {
+ "type": "null"
+ },
+ {
+ "$ref": "#/components/schemas/SoupDocumentSubType",
+ "description": "The sub type of the document if present.\nTask-related properties are encoded within the variant."
+ }
+ ]
+ },
+ "updatedAt": {
+ "type": "string",
+ "format": "date-time",
+ "description": "The time the document instance / document BOM was updated"
+ },
+ "viewedAt": {
+ "type": ["string", "null"],
+ "format": "date-time",
+ "description": "The time the document was last viewed"
+ }
+ }
+ }
+ ],
+ "description": "A document as displayed in Soup."
+ },
"SoupEmailThreadPreview": {
"type": "object",
"description": "Email thread preview data as displayed in Soup.",
@@ -18990,7 +19031,7 @@
}
}
},
- "SoupEnrichedEmailThreadPreview": {
+ "SoupEnrichedEmailThreadPreview_SoupPropertiesField": {
"allOf": [
{
"$ref": "#/components/schemas/SoupEmailThreadPreview",
@@ -18998,7 +19039,21 @@
},
{
"type": "object",
- "required": ["attachments", "participants", "labels", "properties"],
+ "description": "Property fields that can be flattened into property-bearing Soup items.",
+ "required": ["properties"],
+ "properties": {
+ "properties": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/SoupProperty"
+ },
+ "description": "Properties attached to the entity."
+ }
+ }
+ },
+ {
+ "type": "object",
+ "required": ["attachments", "participants", "labels"],
"properties": {
"attachments": {
"type": "array",
@@ -19020,13 +19075,6 @@
"$ref": "#/components/schemas/SoupContact"
},
"description": "Contacts participating in the thread."
- },
- "properties": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/SoupProperty"
- },
- "description": "Properties attached to the thread."
}
}
}
@@ -19092,7 +19140,7 @@
"required": ["data", "tag"],
"properties": {
"data": {
- "$ref": "#/components/schemas/SoupDocument",
+ "$ref": "#/components/schemas/SoupDocument_SoupPropertiesField",
"description": "Document item."
},
"tag": {
@@ -19107,7 +19155,7 @@
"required": ["data", "tag"],
"properties": {
"data": {
- "$ref": "#/components/schemas/SoupChat",
+ "$ref": "#/components/schemas/SoupChat_SoupPropertiesField",
"description": "Chat item."
},
"tag": {
@@ -19122,7 +19170,7 @@
"required": ["data", "tag"],
"properties": {
"data": {
- "$ref": "#/components/schemas/SoupProject",
+ "$ref": "#/components/schemas/SoupProject_SoupPropertiesField",
"description": "Project item."
},
"tag": {
@@ -19137,7 +19185,7 @@
"required": ["data", "tag"],
"properties": {
"data": {
- "$ref": "#/components/schemas/SoupEnrichedEmailThreadPreview",
+ "$ref": "#/components/schemas/SoupEnrichedEmailThreadPreview_SoupPropertiesField",
"description": "Email thread item."
},
"tag": {
@@ -19182,7 +19230,7 @@
"required": ["data", "tag"],
"properties": {
"data": {
- "$ref": "#/components/schemas/SoupCallRecord",
+ "$ref": "#/components/schemas/SoupCallRecord_SoupPropertiesField",
"description": "Call record item."
},
"tag": {
@@ -19197,7 +19245,7 @@
"required": ["data", "tag"],
"properties": {
"data": {
- "$ref": "#/components/schemas/SoupCrmCompany",
+ "$ref": "#/components/schemas/SoupCrmCompany_SoupPropertiesField",
"description": "CRM company item."
},
"tag": {
@@ -19369,62 +19417,80 @@
}
}
},
- "SoupProject": {
- "type": "object",
- "description": "A project as displayed in Soup.",
- "required": [
- "id",
- "name",
- "ownerId",
- "createdAt",
- "updatedAt",
- "properties"
+ "SoupProject_SoupPropertiesField": {
+ "allOf": [
+ {
+ "type": "object",
+ "description": "Property fields that can be flattened into property-bearing Soup items.",
+ "required": ["properties"],
+ "properties": {
+ "properties": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/SoupProperty"
+ },
+ "description": "Properties attached to the entity."
+ }
+ }
+ },
+ {
+ "type": "object",
+ "required": ["id", "name", "ownerId", "createdAt", "updatedAt"],
+ "properties": {
+ "createdAt": {
+ "type": "string",
+ "format": "date-time",
+ "description": "The time the project was created"
+ },
+ "deletedAt": {
+ "type": ["string", "null"],
+ "format": "date-time",
+ "description": "The time the project was deleted"
+ },
+ "id": {
+ "type": "string",
+ "format": "uuid",
+ "description": "The id of the project"
+ },
+ "name": {
+ "type": "string",
+ "description": "The name of the project"
+ },
+ "ownerId": {
+ "type": "string",
+ "description": "The user id of who created the project"
+ },
+ "parentId": {
+ "type": ["string", "null"],
+ "format": "uuid",
+ "description": "The parent project id"
+ },
+ "updatedAt": {
+ "type": "string",
+ "format": "date-time",
+ "description": "The time the project was updated"
+ },
+ "viewedAt": {
+ "type": ["string", "null"],
+ "format": "date-time",
+ "description": "The time the document was last viewed"
+ }
+ }
+ }
],
+ "description": "A project as displayed in Soup."
+ },
+ "SoupPropertiesField": {
+ "type": "object",
+ "description": "Property fields that can be flattened into property-bearing Soup items.",
+ "required": ["properties"],
"properties": {
- "createdAt": {
- "type": "string",
- "format": "date-time",
- "description": "The time the project was created"
- },
- "deletedAt": {
- "type": ["string", "null"],
- "format": "date-time",
- "description": "The time the project was deleted"
- },
- "id": {
- "type": "string",
- "format": "uuid",
- "description": "The id of the project"
- },
- "name": {
- "type": "string",
- "description": "The name of the project"
- },
- "ownerId": {
- "type": "string",
- "description": "The user id of who created the project"
- },
- "parentId": {
- "type": ["string", "null"],
- "format": "uuid",
- "description": "The parent project id"
- },
"properties": {
"type": "array",
"items": {
"$ref": "#/components/schemas/SoupProperty"
},
- "description": "Properties"
- },
- "updatedAt": {
- "type": "string",
- "format": "date-time",
- "description": "The time the project was updated"
- },
- "viewedAt": {
- "type": ["string", "null"],
- "format": "date-time",
- "description": "The time the document was last viewed"
+ "description": "Properties attached to the entity."
}
}
},
diff --git a/crates/channels/src/domain/list_service.rs b/crates/channels/src/domain/list_service.rs
index 9dc014995b..23d8f4d0f6 100644
--- a/crates/channels/src/domain/list_service.rs
+++ b/crates/channels/src/domain/list_service.rs
@@ -7,6 +7,24 @@ use macro_user_id::{cowlike::CowLike, user_id::MacroUserIdStr};
use model_entity::EntityType;
use uuid::Uuid;
+#[cfg(test)]
+mod test;
+
+async fn get_channel_frecency<'a, Frec: AggregateFrecencyStorage>(
+ service: &Frec,
+ include_frecency: bool,
+ user: MacroUserIdStr<'a>,
+ entities: &'a [model_entity::Entity<'a>],
+) -> Result<Vec<AggregateFrecency>, Frec::Err> {
+ if include_frecency {
+ service
+ .get_aggregate_for_user_entities(user, entities)
+ .await
+ } else {
+ Ok(Vec::new())
+ }
+}
+
use crate::domain::{
models::{
Activity, ChannelMessage, ChannelType, ChannelWithLatest, GetChannelsRequest,
@@ -49,6 +67,7 @@ where
&self,
req: GetChannelsRequest,
) -> Result<Vec<ChannelWithLatest>, rootcause::Report> {
+ let include_frecency = req.include_frecency;
let params = req.into_params();
let user = params.user().clone();
@@ -74,13 +93,19 @@ where
})
.collect();
+ let frecency = get_channel_frecency(
+ &self.frecency,
+ include_frecency,
+ user.clone(),
+ channel_entities.as_slice(),
+ );
+
let (names, latest_messages, activities, frecency) = tokio::join!(
self.users.get_names_for_ids(participant_ids),
self.channels
.get_latest_channel_messages_batch(&channel_ids),
self.channels.get_channel_list_activities(user.clone()),
- self.frecency
- .get_aggregate_for_user_entities(user.clone(), channel_entities.as_slice())
+ frecency,
);
let mut activity_lookup: HashMap<Uuid, Activity> = activities
diff --git a/crates/channels/src/domain/list_service/test.rs b/crates/channels/src/domain/list_service/test.rs
new file mode 100644
index 0000000000..07ab3b205d
--- /dev/null
+++ b/crates/channels/src/domain/list_service/test.rs
@@ -0,0 +1,37 @@
+use super::*;
+use frecency::domain::models::{AggregateFrecency, FrecencyPageRequest};
+
+struct PanicFrecencyStorage;
+
+impl AggregateFrecencyStorage for PanicFrecencyStorage {
+ type Err = anyhow::Error;
+
+ async fn get_top_entities(
+ &self,
+ _req: FrecencyPageRequest<'_>,
+ ) -> Result<Vec<AggregateFrecency>, Self::Err> {
+ panic!("top frecency lookup should not run")
+ }
+
+ async fn set_aggregate(&self, _frecency: AggregateFrecency) -> Result<(), Self::Err> {
+ panic!("frecency write should not run")
+ }
+
+ async fn get_aggregate_for_user_entities<'a>(
+ &self,
+ _user_id: MacroUserIdStr<'a>,
+ _entities: &'a [model_entity::Entity<'a>],
+ ) -> Result<Vec<AggregateFrecency>, Self::Err> {
+ panic!("frecency by-id lookup should not run")
+ }
+}
+
+#[tokio::test]
+async fn skips_frecency_lookup_when_not_requested() {
+ let user_id = MacroUserIdStr::parse_from_str("macro|[email protected]").unwrap();
+ let scores = get_channel_frecency(&PanicFrecencyStorage, false, user_id, &[])
+ .await
+ .unwrap();
+
+ assert!(scores.is_empty());
+}
diff --git a/crates/channels/src/domain/models.rs b/crates/channels/src/domain/models.rs
index 5a1b533f9e..eec6725fa2 100644
--- a/crates/channels/src/domain/models.rs
+++ b/crates/channels/src/domain/models.rs
@@ -1148,6 +1148,8 @@ pub struct GetChannelsRequest {
pub macro_id: MacroUserIdStr<'static>,
/// Optional result limit.
pub limit: Option<u32>,
+ /// Whether aggregate frecency should be loaded for the returned channels.
+ pub include_frecency: bool,
/// Cursor, sort, and channel-level filter.
pub query: Query<Uuid, SimpleSortMethod, LiteralTree<ChannelLiteral>>,
}
diff --git a/crates/channels/src/inbound/list_router.rs b/crates/channels/src/inbound/list_router.rs
index a7923cb878..eea7b0bf52 100644
--- a/crates/channels/src/inbound/list_router.rs
+++ b/crates/channels/src/inbound/list_router.rs
@@ -89,6 +89,7 @@ async fn get_channels_handler<S: ChannelListService>(
.get_channels(GetChannelsRequest {
macro_id: macro_user_id,
limit: Some(DEFAULT_CHANNEL_LIST_LIMIT),
+ include_frecency: true,
query: models_pagination::Query::Sort(
models_pagination::SimpleSortMethod::UpdatedAt,
None,
diff --git a/crates/complete_graph/Cargo.toml b/crates/complete_graph/Cargo.toml
index 3dad15e162..e1e3fa27fc 100644
--- a/crates/complete_graph/Cargo.toml
+++ b/crates/complete_graph/Cargo.toml
@@ -29,5 +29,7 @@ workspace-hack = { version = "0.1", path = "../workspace-hack" }
[dev-dependencies]
macro_user_id = { path = "../macro_user_id" }
models_pagination = { path = "../models_pagination" }
+models_properties = { path = "../models_properties" }
+serde = { workspace = true }
tokio = { workspace = true }
uuid = { workspace = true }
diff --git a/crates/complete_graph/src/schema/test.rs b/crates/complete_graph/src/schema/test.rs
index aeff02f5a4..3c26460f84 100644
--- a/crates/complete_graph/src/schema/test.rs
+++ b/crates/complete_graph/src/schema/test.rs
@@ -20,6 +20,97 @@ use uuid::Uuid;
use super::*;
+#[derive(Clone, Default)]
+struct CountingSoupService {
+ raw_calls: Arc<AtomicUsize>,
+ frecency_calls: Arc<AtomicUsize>,
+}
+
+fn test_soup_err() -> soup::domain::models::SoupErr {
+ soup::domain::models::SoupErr::SoupDbErr(anyhow::anyhow!("counting Soup service"))
+}
+
+impl SoupService for CountingSoupService {
+ async fn get_user_soup<T>(
+ &self,
+ _req: soup::domain::models::SoupRequest<T>,
+ _team_receipt: Option<EntityAccessReceipt<entity_access::domain::models::MemberTeamRole>>,
+ ) -> Result<soup::domain::ports::SoupOutput<T>, soup::domain::models::SoupErr>
+ where
+ soup::domain::models::SoupRequest<T>: soup::domain::models::IntoSoupReqAst,
+ T: Clone + serde::Serialize + Send,
+ {
+ self.raw_calls.fetch_add(1, Ordering::SeqCst);
+ Err(test_soup_err())
+ }
+
+ async fn get_user_soup_with_properties<T>(
+ &self,
+ _req: soup::domain::models::SoupRequest<T>,
+ _team_receipt: Option<EntityAccessReceipt<entity_access::domain::models::MemberTeamRole>>,
+ ) -> Result<
+ soup::domain::ports::SoupOutput<T, soup::domain::models::EnrichedSoupItem>,
+ soup::domain::models::SoupErr,
+ >
+ where
+ soup::domain::models::SoupRequest<T>: soup::domain::models::IntoSoupReqAst,
+ T: Clone + serde::Serialize + Send,
+ {
+ Err(test_soup_err())
+ }
+
+ async fn get_user_soup_with_frecency<T>(
+ &self,
+ _req: soup::domain::models::SoupRequest<T>,
+ _team_receipt: Option<EntityAccessReceipt<entity_access::domain::models::MemberTeamRole>>,
+ ) -> Result<
+ soup::domain::ports::SoupOutput<T, soup::domain::models::EnrichedSoupItem>,
+ soup::domain::models::SoupErr,
+ >
+ where
+ soup::domain::models::SoupRequest<T>: soup::domain::models::IntoSoupReqAst,
+ T: Clone + serde::Serialize + Send,
+ {
+ self.frecency_calls.fetch_add(1, Ordering::SeqCst);
+ Err(test_soup_err())
+ }
+
+ async fn get_user_soup_with_properties_and_frecency<T>(
+ &self,
+ _req: soup::domain::models::SoupRequest<T>,
+ _team_receipt: Option<EntityAccessReceipt<entity_access::domain::models::MemberTeamRole>>,
+ ) -> Result<
+ soup::domain::ports::SoupOutput<T, soup::domain::models::EnrichedSoupItem>,
+ soup::domain::models::SoupErr,
+ >
+ where
+ soup::domain::models::SoupRequest<T>: soup::domain::models::IntoSoupReqAst,
+ T: Clone + serde::Serialize + Send,
+ {
+ Err(test_soup_err())
+ }
+
+ async fn get_user_soup_grouped(
+ &self,
+ _req: soup::domain::models::GroupedSortRequest<'_>,
+ ) -> Result<
+ Vec<soup::domain::models::GroupedSoupItem<soup::domain::models::SoupPropertiesField>>,
+ soup::domain::models::SoupErr,
+ > {
+ Err(test_soup_err())
+ }
+
+ async fn caller_tag_sets<'a>(
+ &self,
+ _user_id: MacroUserIdStr<'a>,
+ ) -> Result<
+ Vec<models_properties::service::property_definition_with_options::PropertyDefinitionWithOptions>,
+ soup::domain::models::SoupErr,
+ >{
+ Err(test_soup_err())
+ }
+}
+
/// Email service whose inbox lookups are counted, so tests can assert when
/// the lazy extraction actually runs.
#[derive(Clone, Default)]
@@ -272,7 +363,7 @@ impl FromRef<TestState> for Arc<CountingEntityAccessService> {
struct TestHarness {
schema: SoupSchema<
- NoOpSoupService,
+ CountingSoupService,
CountingEmailService,
CountingEntityAccessService,
TestState,
@@ -283,21 +374,28 @@ struct TestHarness {
state: TestState,
inbox_calls: Arc<AtomicUsize>,
team_calls: Arc<AtomicUsize>,
+ raw_soup_calls: Arc<AtomicUsize>,
+ frecency_soup_calls: Arc<AtomicUsize>,
}
fn harness() -> TestHarness {
let email = CountingEmailService::default();
let entity_access = CountingEntityAccessService::default();
+ let soup = CountingSoupService::default();
let inbox_calls = Arc::clone(&email.inbox_calls);
let team_calls = Arc::clone(&entity_access.team_calls);
+ let raw_soup_calls = Arc::clone(&soup.raw_calls);
+ let frecency_soup_calls = Arc::clone(&soup.frecency_calls);
TestHarness {
- schema: build_schema_with_service(NoOpSoupService),
+ schema: build_schema_with_service(soup),
state: TestState {
email: EmailRouterState::new(email),
entity_access: Arc::new(entity_access),
},
inbox_calls,
team_calls,
+ raw_soup_calls,
+ frecency_soup_calls,
}
}
@@ -340,14 +438,26 @@ async fn user_id_resolves_without_touching_services() {
async fn soup_resolves_inboxes_but_skips_team_lookup_without_crm_scope() {
let harness = harness();
- // The schema-only soup service errors, but the laziness assertions below
- // are about which lookups ran before the service call.
let _response = harness
.execute("{ user { soup(input: {}) { hasMore } } }")
.await;
assert_eq!(harness.inbox_calls.load(Ordering::SeqCst), 1);
assert_eq!(harness.team_calls.load(Ordering::SeqCst), 0);
+ assert_eq!(harness.raw_soup_calls.load(Ordering::SeqCst), 1);
+ assert_eq!(harness.frecency_soup_calls.load(Ordering::SeqCst), 0);
+}
+
+#[tokio::test]
+async fn soup_requests_frecency_only_when_selected() {
+ let harness = harness();
+
+ let _response = harness
+ .execute("{ user { soup(input: {}) { items { frecencyScore } } } }")
+ .await;
+
+ assert_eq!(harness.raw_soup_calls.load(Ordering::SeqCst), 0);
+ assert_eq!(harness.frecency_soup_calls.load(Ordering::SeqCst), 1);
}
#[tokio::test]
diff --git a/crates/email/src/domain/models/preview.rs b/crates/email/src/domain/models/preview.rs
index e4fd65ac8d..bf47bfa183 100644
--- a/crates/email/src/domain/models/preview.rs
+++ b/crates/email/src/domain/models/preview.rs
@@ -145,6 +145,8 @@ pub struct GetEmailsRequest {
pub macro_id: MacroUserIdStr<'static>,
pub limit: Option<u32>,
pub query: Query<Uuid, SimpleSortMethod, LiteralTree<EmailLiteral>>,
+ /// Whether aggregate frecency should be loaded for the returned threads.
+ pub include_frecency: bool,
/// Proof that the caller belongs to a team. Forwarded by the soup
/// router unconditionally (when the user is on a team); the email
/// service uses it only when `crm_scope` is `Some` to authorize the
diff --git a/crates/email/src/domain/service/previews.rs b/crates/email/src/domain/service/previews.rs
index d8aa3d56b0..6c3142e872 100644
--- a/crates/email/src/domain/service/previews.rs
+++ b/crates/email/src/domain/service/previews.rs
@@ -19,6 +19,26 @@ use uuid::Uuid;
use super::EmailServiceImpl;
+#[cfg(test)]
+mod test;
+
+async fn get_frecency_scores<U: FrecencyQueryService>(
+ service: &U,
+ include_frecency: bool,
+ user_id: macro_user_id::user_id::MacroUserIdStr<'_>,
+ ids: &[model_entity::Entity<'_>],
+) -> Result<HashMap<AggregateId<'static>, FrecencyData>, frecency::domain::models::FrecencyQueryErr>
+{
+ if include_frecency {
+ service
+ .get_frecencies_by_ids(FrecencyByIdsRequest { user_id, ids })
+ .await
+ .map(|response| response.into_inner())
+ } else {
+ Ok(HashMap::new())
+ }
+}
+
impl<T, U, E, CS, Eam, B> EmailServiceImpl<T, U, E, CS, Eam, B>
where
T: EmailRepo,
@@ -39,6 +59,7 @@ where
macro_id,
limit,
query,
+ include_frecency,
team_receipt,
crm_scope,
} = req;
@@ -75,17 +96,18 @@ where
.map(|id| EntityType::EmailThread.with_entity_string(id.to_string()))
.collect();
- let frecency_request = FrecencyByIdsRequest {
- user_id: macro_id,
- ids: ids.as_slice(),
- };
+ let frecency_scores = get_frecency_scores(
+ &self.frecency_service,
+ include_frecency,
+ macro_id,
+ ids.as_slice(),
+ );
let (attachment_map_result, participant_result, labels_result, frecency_scores) = tokio::join!(
self.email_repo.attachments_by_thread_ids(&thread_ids),
self.email_repo.contacts_by_thread_ids(&thread_ids),
self.email_repo.labels_by_thread_ids(&thread_ids),
- self.frecency_service
- .get_frecencies_by_ids(frecency_request)
+ frecency_scores,
);
let mut attachment_map = attachment_map_result
@@ -101,8 +123,7 @@ where
.into_iter()
.group_by(|v| v.thread_id);
- let mut frecency_scores_map: HashMap<AggregateId<'static>, FrecencyData> =
- frecency_scores?.into_inner();
+ let mut frecency_scores_map: HashMap<AggregateId<'static>, FrecencyData> = frecency_scores?;
Ok(previews
.into_iter()
diff --git a/crates/email/src/domain/service/previews/test.rs b/crates/email/src/domain/service/previews/test.rs
new file mode 100644
index 0000000000..cbe3d91afa
--- /dev/null
+++ b/crates/email/src/domain/service/previews/test.rs
@@ -0,0 +1,33 @@
+use super::*;
+use frecency::domain::models::{
+ FrecencyByIdsRequest, FrecencyPageRequest, FrecencyPageResponse, FrecencyQueryErr,
+};
+use macro_user_id::user_id::MacroUserIdStr;
+
+struct PanicFrecencyService;
+
+impl FrecencyQueryService for PanicFrecencyService {
+ async fn get_frecency_page(
+ &self,
+ _query: FrecencyPageRequest<'_>,
+ ) -> Result<FrecencyPageResponse, FrecencyQueryErr> {
+ panic!("frecency page lookup should not run")
+ }
+
+ async fn get_frecencies_by_ids(
+ &self,
+ _request: FrecencyByIdsRequest<'_>,
+ ) -> Result<FrecencyPageResponse, FrecencyQueryErr> {
+ panic!("frecency by-id lookup should not run")
+ }
+}
+
+#[tokio::test]
+async fn skips_frecency_lookup_when_not_requested() {
+ let user_id = MacroUserIdStr::parse_from_str("macro|[email protected]").unwrap();
+ let scores = get_frecency_scores(&PanicFrecencyService, false, user_id, &[])
+ .await
+ .unwrap();
+
+ assert!(scores.is_empty());
+}
diff --git a/crates/email/src/inbound/axum/previews_router.rs b/crates/email/src/inbound/axum/previews_router.rs
index 7c6a1dd759..4988052e46 100644
--- a/crates/email/src/inbound/axum/previews_router.rs
+++ b/crates/email/src/inbound/axum/previews_router.rs
@@ -105,6 +105,7 @@ async fn cursor_handler<T: EmailService>(
(),
)
.map_filter(|_| None),
+ include_frecency: true,
team_receipt: None,
crm_scope: None,
})
diff --git a/crates/graphql_soup/src/objects.rs b/crates/graphql_soup/src/objects.rs
index 19eb084670..867d6b523f 100644
--- a/crates/graphql_soup/src/objects.rs
+++ b/crates/graphql_soup/src/objects.rs
@@ -16,7 +16,7 @@ use models_soup::{
project::SoupProject,
};
use serde_json::Value;
-use soup::domain::models::FrecencySoupItem;
+use soup::domain::models::EnrichedSoupItem;
/// Extension fields attached to every top-level Soup entity.
///
@@ -56,8 +56,19 @@ where
}
}
-impl<E: SoupEntityEdges> From<PaginatedOpaqueCursor<FrecencySoupItem>> for SoupPage<E> {
- fn from(page: PaginatedOpaqueCursor<FrecencySoupItem>) -> Self {
+impl<E: SoupEntityEdges> From<PaginatedOpaqueCursor<SoupItem<()>>> for SoupPage<E> {
+ fn from(page: PaginatedOpaqueCursor<SoupItem<()>>) -> Self {
+ let has_more = page.next_cursor.is_some();
+ Self {
+ items: page.items.into_iter().map(GraphqlSoupItem::from).collect(),
+ next_cursor: page.next_cursor,
+ has_more,
+ }
+ }
+}
+
+impl<E: SoupEntityEdges> From<PaginatedOpaqueCursor<EnrichedSoupItem>> for SoupPage<E> {
+ fn from(page: PaginatedOpaqueCursor<EnrichedSoupItem>) -> Self {
let has_more = page.next_cursor.is_some();
Self {
items: page.items.into_iter().map(GraphqlSoupItem::from).collect(),
@@ -97,13 +108,26 @@ where
}
}
-impl<E: SoupEntityEdges> From<FrecencySoupItem> for GraphqlSoupItem<E> {
- fn from(item: FrecencySoupItem) -> Self {
- let FrecencySoupItem {
+impl<E: SoupEntityEdges> From<SoupItem<()>> for GraphqlSoupItem<E> {
+ fn from(item: SoupItem<()>) -> Self {
+ let entity_ref = item.entity();
+ Self {
+ id: entity_ref.entity_id.into_owned(),
+ entity_type: GraphqlSoupEntityType::from(entity_ref.entity_type),
+ frecency_score: 0.0,
+ entity: GraphqlSoupEntity::from(item),
+ }
+ }
+}
+
+impl<E: SoupEntityEdges> From<EnrichedSoupItem> for GraphqlSoupItem<E> {
+ fn from(item: EnrichedSoupItem) -> Self {
+ let EnrichedSoupItem {
item,
frecency_score,
..
} = item;
+ let item = item.map_extra(|_| ());
let entity_ref = item.entity();
Self {
@@ -140,11 +164,11 @@ pub enum GraphqlSoupEntity<E: SoupEntityEdges> {
ForeignEntity(GraphqlSoupForeignEntity<E>),
}
-impl<E> From<SoupItem> for GraphqlSoupEntity<E>
+impl<E> From<SoupItem<()>> for GraphqlSoupEntity<E>
where
E: SoupEntityEdges,
{
- fn from(item: SoupItem) -> Self {
+ fn from(item: SoupItem<()>) -> Self {
match item {
SoupItem::Document(item) => {
let edges = E::from_entity(
@@ -208,7 +232,7 @@ where
}
/// GraphQL document entity.
-pub struct GraphqlSoupDocument<E: SoupEntityEdges>(SoupDocument, E);
+pub struct GraphqlSoupDocument<E: SoupEntityEdges>(SoupDocument<()>, E);
#[Object(name = "GraphqlSoupDocument")]
impl<E> GraphqlSoupDocument<E>
@@ -297,7 +321,7 @@ impl GraphqlSoupDocumentSubType {
}
/// GraphQL chat entity.
-pub struct GraphqlSoupChat<E: SoupEntityEdges>(SoupChat, E);
+pub struct GraphqlSoupChat<E: SoupEntityEdges>(SoupChat<()>, E);
#[Object(name = "GraphqlSoupChat")]
impl<E> GraphqlSoupChat<E>
@@ -347,7 +371,7 @@ where
}
/// GraphQL project entity.
-pub struct GraphqlSoupProject<E: SoupEntityEdges>(SoupProject, E);
+pub struct GraphqlSoupProject<E: SoupEntityEdges>(SoupProject<()>, E);
#[Object(name = "GraphqlSoupProject")]
impl<E> GraphqlSoupProject<E>
@@ -571,7 +595,7 @@ impl GraphqlSoupEmailAttachment {
}
/// GraphQL email thread entity.
-pub struct GraphqlSoupEmailThread<E: SoupEntityEdges>(SoupEnrichedEmailThreadPreview, E);
+pub struct GraphqlSoupEmailThread<E: SoupEntityEdges>(SoupEnrichedEmailThreadPreview<()>, E);
#[Object(name = "GraphqlSoupEmailThread")]
impl<E> GraphqlSoupEmailThread<E>
@@ -952,7 +976,7 @@ impl GraphqlSoupCallParticipant {
}
/// GraphQL call entity.
-pub struct GraphqlSoupCall<E: SoupEntityEdges>(SoupCallRecord, E);
+pub struct GraphqlSoupCall<E: SoupEntityEdges>(SoupCallRecord<()>, E);
#[Object(name = "GraphqlSoupCall")]
impl<E> GraphqlSoupCall<E>
@@ -1045,7 +1069,7 @@ where
}
/// GraphQL CRM company entity.
-pub struct GraphqlSoupCrmCompany<E: SoupEntityEdges>(SoupCrmCompany, E);
+pub struct GraphqlSoupCrmCompany<E: SoupEntityEdges>(SoupCrmCompany<()>, E);
#[Object(name = "GraphqlSoupCrmCompany")]
impl<E> GraphqlSoupCrmCompany<E>
diff --git a/crates/graphql_soup/src/resolvers.rs b/crates/graphql_soup/src/resolvers.rs
index 7284476927..83fd3ad514 100644
--- a/crates/graphql_soup/src/resolvers.rs
+++ b/crates/graphql_soup/src/resolvers.rs
@@ -62,6 +62,19 @@ where
None
};
- let page = service.get_user_soup(request, team_receipt).await?;
- Ok(SoupPage::from(page.type_erase()))
+ let include_frecency = ctx
+ .look_ahead()
+ .field("items")
+ .field("frecencyScore")
+ .exists();
+
+ if include_frecency {
+ let page = service
+ .get_user_soup_with_frecency(request, team_receipt)
+ .await?;
+ Ok(SoupPage::from(page.type_erase()))
+ } else {
+ let page = service.get_user_soup(request, team_receipt).await?;
+ Ok(SoupPage::from(page.type_erase()))
+ }
}
diff --git a/crates/models_pagination/src/cursor.rs b/crates/models_pagination/src/cursor.rs
index f4287de39c..ee3bf5eaa2 100644
--- a/crates/models_pagination/src/cursor.rs
+++ b/crates/models_pagination/src/cursor.rs
@@ -28,6 +28,16 @@ impl<T, U> Paginated<T, U> {
next_cursor,
}
}
+
+ /// Decomposes the page into its items and cursor.
+ pub fn into_parts(self) -> (Vec<T>, Option<U>) {
+ (self.items, self.next_cursor)
+ }
+
+ /// Builds a page from an item vector and cursor.
+ pub fn from_parts(items: Vec<T>, next_cursor: Option<U>) -> Self {
+ Self { items, next_cursor }
+ }
}
/// Top level cursor information encodes all the required information for paginating by [Cursor]
diff --git a/crates/models_soup/src/call_record.rs b/crates/models_soup/src/call_record.rs
index 4a4e6f0680..e5ab475cb8 100644
--- a/crates/models_soup/src/call_record.rs
+++ b/crates/models_soup/src/call_record.rs
@@ -4,8 +4,6 @@ use item_filters::CallStatus;
use serde::{Deserialize, Serialize};
use uuid::Uuid;
-use crate::SoupProperty;
-
/// A participant in a call record, as displayed in Soup.
#[derive(Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(utoipa::ToSchema))]
@@ -24,7 +22,7 @@ pub struct SoupCallRecordParticipant {
#[derive(Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(utoipa::ToSchema))]
#[serde(rename_all = "camelCase")]
-pub struct SoupCallRecord {
+pub struct SoupCallRecord<T = ()> {
/// The call identifier.
pub call_id: Uuid,
/// The channel this call belongs to.
@@ -54,8 +52,9 @@ pub struct SoupCallRecord {
pub attended: bool,
/// Participants in the call.
pub participants: Vec<SoupCallRecordParticipant>,
- /// Entity properties (e.g. tags). Populated after fetch by the soup repo.
- pub properties: Vec<SoupProperty>,
+ /// Extra fields passed from above
+ #[serde(flatten)]
+ pub extra: T,
}
fn participant_derived_status(participants: &[CallRecordParticipant], user_id: &str) -> CallStatus {
@@ -66,7 +65,7 @@ fn participant_derived_status(participants: &[CallRecordParticipant], user_id: &
CallStatus::Unattended
}
-impl SoupCallRecord {
+impl SoupCallRecord<()> {
/// Build a `SoupCallRecord` from a domain `CallRecord` in the context of a
/// specific viewer.
pub fn from_record_for_user(record: CallRecord, user_id: &str) -> Self {
@@ -97,7 +96,7 @@ impl SoupCallRecord {
left_at: p.left_at,
})
.collect(),
- properties: Vec::new(),
+ extra: (),
}
}
}
diff --git a/crates/models_soup/src/chat.rs b/crates/models_soup/src/chat.rs
index cb3a9b828f..3a93ca53ed 100644
--- a/crates/models_soup/src/chat.rs
+++ b/crates/models_soup/src/chat.rs
@@ -3,13 +3,11 @@ use macro_user_id::user_id::MacroUserIdStr;
use serde::{Deserialize, Serialize};
use uuid::Uuid;
-use crate::SoupProperty;
-
/// A chat as displayed in Soup.
#[derive(Serialize, Clone, Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
#[cfg_attr(feature = "schema", derive(utoipa::ToSchema))]
-pub struct SoupChat {
+pub struct SoupChat<T = ()> {
/// The chat uuid
pub id: Uuid,
@@ -39,6 +37,7 @@ pub struct SoupChat {
/// The time the chat was deleted
pub deleted_at: Option<chrono::DateTime<Utc>>,
- /// Properties
- pub properties: Vec<SoupProperty>,
+ /// Extra fields passed from above
+ #[serde(flatten)]
+ pub extra: T,
}
diff --git a/crates/models_soup/src/crm_company.rs b/crates/models_soup/src/crm_company.rs
index 5883122cfe..3bd0bcd001 100644
--- a/crates/models_soup/src/crm_company.rs
+++ b/crates/models_soup/src/crm_company.rs
@@ -1,4 +1,3 @@
-use crate::SoupProperty;
use chrono::{DateTime, Utc};
use crm::domain::model::{CrmCompanyForSoup, CrmDomain};
use serde::{Deserialize, Serialize};
@@ -37,7 +36,7 @@ impl From<CrmDomain> for SoupCrmDomain {
#[derive(Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(utoipa::ToSchema))]
#[serde(rename_all = "camelCase")]
-pub struct SoupCrmCompany {
+pub struct SoupCrmCompany<T = ()> {
/// The id of the company.
pub id: Uuid,
/// The id of the team that owns this company record.
@@ -62,13 +61,12 @@ pub struct SoupCrmCompany {
/// Domains associated with this company, ordered by creation time
/// ascending (primary first).
pub domains: Vec<SoupCrmDomain>,
- /// Properties attached to this company (system CRM properties like
- /// Stage / Owner / Revenue plus any custom ones).
- #[serde(default)]
- pub properties: Vec<SoupProperty>,
+ /// Extra fields passed from above
+ #[serde(flatten)]
+ pub extra: T,
}
-impl From<CrmCompanyForSoup> for SoupCrmCompany {
+impl From<CrmCompanyForSoup> for SoupCrmCompany<()> {
fn from(c: CrmCompanyForSoup) -> Self {
let CrmCompanyForSoup {
company,
@@ -91,7 +89,7 @@ impl From<CrmCompanyForSoup> for SoupCrmCompany {
.into_iter()
.map(SoupCrmDomain::from)
.collect(),
- properties: Vec::new(),
+ extra: (),
}
}
}
diff --git a/crates/models_soup/src/document.rs b/crates/models_soup/src/document.rs
index d6ac6a4b2a..eb0d5fc4e0 100644
--- a/crates/models_soup/src/document.rs
+++ b/crates/models_soup/src/document.rs
@@ -4,8 +4,6 @@ use macro_user_id::user_id::MacroUserIdStr;
use models_properties::EntityType;
use uuid::Uuid;
-use crate::SoupProperty;
-
/// Sub type of a document with associated properties encoded in each variant.
/// This ensures type-safety: task properties only exist when the document is a task.
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)]
@@ -48,7 +46,7 @@ impl SoupDocumentSubType {
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
#[cfg_attr(feature = "schema", derive(utoipa::ToSchema))]
-pub struct SoupDocument {
+pub struct SoupDocument<T = ()> {
/// The document id
pub id: Uuid,
@@ -106,11 +104,12 @@ pub struct SoupDocument {
/// The time the document was deleted
pub deleted_at: Option<chrono::DateTime<Utc>>,
- /// Properties
- pub properties: Vec<SoupProperty>,
+ /// Extra fields passed from above
+ #[serde(flatten)]
+ pub extra: T,
}
-impl SoupDocument {
+impl<T> SoupDocument<T> {
/// Returns the entity type for this document.
///
/// Documents with a `sub_type` of `Task` return `EntityType::Task`,
diff --git a/crates/models_soup/src/email_thread.rs b/crates/models_soup/src/email_thread.rs
index eb2f4c9985..c9d3aa4b8d 100644
--- a/crates/models_soup/src/email_thread.rs
+++ b/crates/models_soup/src/email_thread.rs
@@ -4,8 +4,6 @@ use macro_user_id::user_id::MacroUserIdStr;
use serde::{Deserialize, Serialize};
use uuid::Uuid;
-use crate::SoupProperty;
-
/// A contact participating in an email thread as displayed in Soup.
#[derive(Debug, Doppleganger, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(utoipa::ToSchema))]
@@ -164,7 +162,7 @@ pub struct SoupEmailThreadPreview {
#[derive(Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(utoipa::ToSchema))]
#[serde(rename_all = "camelCase")]
-pub struct SoupEnrichedEmailThreadPreview {
+pub struct SoupEnrichedEmailThreadPreview<T = ()> {
/// Base email thread preview.
#[serde(flatten)]
pub thread: SoupEmailThreadPreview,
@@ -174,6 +172,7 @@ pub struct SoupEnrichedEmailThreadPreview {
pub participants: Vec<SoupContact>,
/// Labels attached to the thread.
pub labels: Vec<SoupLabel>,
- /// Properties attached to the thread.
- pub properties: Vec<SoupProperty>,
+ /// Extra fields passed from above
+ #[serde(flatten)]
+ pub extra: T,
}
diff --git a/crates/models_soup/src/item.rs b/crates/models_soup/src/item.rs
index 80dc5e7e0e..fa9e60af2d 100644
--- a/crates/models_soup/src/item.rs
+++ b/crates/models_soup/src/item.rs
@@ -15,32 +15,35 @@ use models_properties::{EntityReference, EntityType as PropertiesEntityType};
use serde::{Deserialize, Serialize};
use uuid::Uuid;
+#[cfg(test)]
+mod test;
+
/// A single item in the Soup feed.
#[derive(Serialize, Deserialize, Debug)]
#[serde(rename_all = "camelCase", tag = "tag", content = "data")]
#[cfg_attr(feature = "schema", derive(utoipa::ToSchema))]
-pub enum SoupItem {
+pub enum SoupItem<T = ()> {
/// Document item.
- Document(SoupDocument),
+ Document(SoupDocument<T>),
/// Chat item.
- Chat(SoupChat),
+ Chat(SoupChat<T>),
/// Project item.
- Project(SoupProject),
+ Project(SoupProject<T>),
/// Email thread item.
- EmailThread(SoupEnrichedEmailThreadPreview),
+ EmailThread(SoupEnrichedEmailThreadPreview<T>),
/// Channel item.
Channel(SoupChannel),
/// Channel thread item.
ChannelThread(SoupChannelThread),
/// Call record item.
- Call(SoupCallRecord),
+ Call(SoupCallRecord<T>),
/// CRM company item.
- CrmCompany(SoupCrmCompany),
+ CrmCompany(SoupCrmCompany<T>),
/// Foreign entity item.
ForeignEntity(SoupForeignEntity),
}
-impl SoupItem {
+impl<T> SoupItem<T> {
/// return the [Entity] for this soup item
pub fn entity(&self) -> Entity<'static> {
match self {
@@ -88,9 +91,7 @@ impl SoupItem {
SoupItem::ForeignEntity(foreign_entity) => foreign_entity.updated_at,
}
}
-}
-impl SoupItem {
fn cursor_timestamp(&self, sort: SimpleSortMethod) -> DateTime<Utc> {
match (self, sort) {
(SoupItem::Document(soup_document), SimpleSortMethod::ViewedAt) => {
@@ -161,41 +162,7 @@ impl SoupItem {
(SoupItem::ForeignEntity(foreign_entity), _) => foreign_entity.updated_at,
}
}
-}
-
-impl Identify for SoupItem {
- type Id = Uuid;
- fn id(&self) -> Self::Id {
- match self {
- SoupItem::Document(soup_document) => soup_document.id,
- SoupItem::Chat(soup_chat) => soup_chat.id,
- SoupItem::Project(soup_project) => soup_project.id,
- SoupItem::EmailThread(thread) => thread.thread.id,
- SoupItem::Channel(soup_channel) => soup_channel.channel.channel.id.0,
- SoupItem::ChannelThread(thread) => thread.id,
- SoupItem::Call(record) => record.call_id,
- SoupItem::CrmCompany(company) => company.id,
- SoupItem::ForeignEntity(foreign_entity) => foreign_entity.id,
- }
- }
-}
-
-impl SortOn<SimpleSortMethod> for SoupItem {
- fn sort_on(
- sort: SimpleSortMethod,
- ) -> impl FnMut(&Self) -> models_pagination::CursorVal<SimpleSortMethod> {
- move |v| {
- let last_val = v.cursor_timestamp(sort);
- models_pagination::CursorVal {
- sort_type: sort,
- last_val,
- }
- }
- }
-}
-
-impl SoupItem {
/// Converts this item to an [`EntityReference`] for property lookups.
///
/// Returns `None` for item types that don't support properties
@@ -230,4 +197,200 @@ impl SoupItem {
SoupItem::ForeignEntity(_) => None,
}
}
+
+ /// Maps the extra fields attached to property-bearing Soup variants.
+ pub fn map_extra<U, F>(self, f: F) -> SoupItem<U>
+ where
+ F: FnOnce(T) -> U,
+ {
+ match self {
+ SoupItem::Document(SoupDocument {
+ id,
+ document_version_id,
+ owner_id,
+ name,
+ file_type,
+ sha,
+ project_id,
+ branched_from_id,
+ branched_from_version_id,
+ document_family_id,
+ created_at,
+ updated_at,
+ viewed_at,
+ sub_type,
+ deleted_at,
+ extra,
+ }) => SoupItem::Document(SoupDocument {
+ id,
+ document_version_id,
+ owner_id,
+ name,
+ file_type,
+ sha,
+ project_id,
+ branched_from_id,
+ branched_from_version_id,
+ document_family_id,
+ created_at,
+ updated_at,
+ viewed_at,
+ sub_type,
+ deleted_at,
+ extra: f(extra),
+ }),
+ SoupItem::Chat(SoupChat {
+ id,
+ name,
+ owner_id,
+ project_id,
+ is_persistent,
+ created_at,
+ updated_at,
+ viewed_at,
+ deleted_at,
+ extra,
+ }) => SoupItem::Chat(SoupChat {
+ id,
+ name,
+ owner_id,
+ project_id,
+ is_persistent,
+ created_at,
+ updated_at,
+ viewed_at,
+ deleted_at,
+ extra: f(extra),
+ }),
+ SoupItem::Project(SoupProject {
+ id,
+ name,
+ owner_id,
+ parent_id,
+ created_at,
+ updated_at,
+ viewed_at,
+ deleted_at,
+ extra,
+ }) => SoupItem::Project(SoupProject {
+ id,
+ name,
+ owner_id,
+ parent_id,
+ created_at,
+ updated_at,
+ viewed_at,
+ deleted_at,
+ extra: f(extra),
+ }),
+ SoupItem::EmailThread(SoupEnrichedEmailThreadPreview {
+ thread,
+ attachments,
+ participants,
+ labels,
+ extra,
+ }) => SoupItem::EmailThread(SoupEnrichedEmailThreadPreview {
+ thread,
+ attachments,
+ participants,
+ labels,
+ extra: f(extra),
+ }),
+ SoupItem::Channel(channel) => SoupItem::Channel(channel),
+ SoupItem::ChannelThread(soup_channel_thread) => {
+ SoupItem::ChannelThread(soup_channel_thread)
+ }
+ SoupItem::Call(SoupCallRecord {
+ call_id,
+ channel_id,
+ created_by,
+ started_at,
+ ended_at,
+ duration_ms,
+ channel_name,
+ custom_name,
+ summary,
+ is_active,
+ status,
+ attended,
+ participants,
+ extra,
+ }) => SoupItem::Call(SoupCallRecord {
+ call_id,
+ channel_id,
+ created_by,
+ started_at,
+ ended_at,
+ duration_ms,
+ channel_name,
+ custom_name,
+ summary,
+ is_active,
+ status,
+ attended,
+ participants,
+ extra: f(extra),
+ }),
+ SoupItem::CrmCompany(SoupCrmCompany {
+ id,
+ team_id,
+ name,
+ description,
+ email_sync,
+ hidden,
+ created_at,
+ updated_at,
+ viewed_at,
+ domains,
+ extra,
+ }) => SoupItem::CrmCompany(SoupCrmCompany {
+ id,
+ team_id,
+ name,
+ description,
+ email_sync,
+ hidden,
+ created_at,
+ updated_at,
+ viewed_at,
+ domains,
+ extra: f(extra),
+ }),
+ SoupItem::ForeignEntity(soup_foreign_entity) => {
+ SoupItem::ForeignEntity(soup_foreign_entity)
+ }
+ }
+ }
+}
+
+impl<T> Identify for SoupItem<T> {
+ type Id = Uuid;
+
+ fn id(&self) -> Self::Id {
+ match self {
+ SoupItem::Document(soup_document) => soup_document.id,
+ SoupItem::Chat(soup_chat) => soup_chat.id,
+ SoupItem::Project(soup_project) => soup_project.id,
+ SoupItem::EmailThread(thread) => thread.thread.id,
+ SoupItem::Channel(soup_channel) => soup_channel.channel.channel.id.0,
+ SoupItem::ChannelThread(thread) => thread.id,
+ SoupItem::Call(record) => record.call_id,
+ SoupItem::CrmCompany(company) => company.id,
+ SoupItem::ForeignEntity(foreign_entity) => foreign_entity.id,
+ }
+ }
+}
+
+impl<T> SortOn<SimpleSortMethod> for SoupItem<T> {
+ fn sort_on(
+ sort: SimpleSortMethod,
+ ) -> impl FnMut(&Self) -> models_pagination::CursorVal<SimpleSortMethod> {
+ move |v| {
+ let last_val = v.cursor_timestamp(sort);
+ models_pagination::CursorVal {
+ sort_type: sort,
+ last_val,
+ }
+ }
+ }
}
diff --git a/crates/models_soup/src/item/test.rs b/crates/models_soup/src/item/test.rs
new file mode 100644
index 0000000000..76ffdca79d
--- /dev/null
+++ b/crates/models_soup/src/item/test.rs
@@ -0,0 +1,42 @@
+use super::*;
+use crate::chat::SoupChat;
+use macro_user_id::user_id::MacroUserIdStr;
+
+#[derive(Debug, Serialize, Deserialize)]
+struct TestPropertiesField {
+ properties: Vec<String>,
+}
+
+fn raw_chat() -> SoupItem<()> {
+ SoupItem::Chat(SoupChat {
+ id: Uuid::nil(),
+ name: "Test chat".to_string(),
+ owner_id: MacroUserIdStr::try_from("macro|[email protected]".to_string()).unwrap(),
+ project_id: None,
+ is_persistent: true,
+ created_at: DateTime::<Utc>::default(),
+ updated_at: DateTime::<Utc>::default(),
+ viewed_at: None,
+ deleted_at: None,
+ extra: (),
+ })
+}
+
+#[test]
+fn raw_extra_serializes_without_fields() {
+ let value = serde_json::to_value(raw_chat()).unwrap();
+
+ assert!(value["data"].get("extra").is_none());
+ assert!(value["data"].get("properties").is_none());
+}
+
+#[test]
+fn mapped_extra_is_flattened_into_the_item_data() {
+ let item = raw_chat().map_extra(|()| TestPropertiesField {
+ properties: vec!["priority".to_string()],
+ });
+ let value = serde_json::to_value(item).unwrap();
+
+ assert_eq!(value["data"]["properties"], serde_json::json!(["priority"]));
+ assert!(value["data"].get("extra").is_none());
+}
diff --git a/crates/models_soup/src/project.rs b/crates/models_soup/src/project.rs
index 013e24dc74..55b2b64d02 100644
--- a/crates/models_soup/src/project.rs
+++ b/crates/models_soup/src/project.rs
@@ -3,13 +3,11 @@ use macro_user_id::user_id::MacroUserIdStr;
use serde::{Deserialize, Serialize};
use uuid::Uuid;
-use crate::SoupProperty;
-
/// A project as displayed in Soup.
#[derive(Serialize, Clone, Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
#[cfg_attr(feature = "schema", derive(utoipa::ToSchema))]
-pub struct SoupProject {
+pub struct SoupProject<T = ()> {
/// The id of the project
pub id: Uuid,
@@ -36,6 +34,7 @@ pub struct SoupProject {
/// The time the project was deleted
pub deleted_at: Option<chrono::DateTime<Utc>>,
- /// Properties
- pub properties: Vec<SoupProperty>,
+ /// Extra fields passed from above
+ #[serde(flatten)]
+ pub extra: T,
}
diff --git a/crates/soup/src/domain/models.rs b/crates/soup/src/domain/models.rs
index 884b468fec..cf3b6d9df9 100644
--- a/crates/soup/src/domain/models.rs
+++ b/crates/soup/src/domain/models.rs
@@ -33,12 +33,11 @@ use item_filters::{
use macro_user_id::user_id::MacroUserIdStr;
use model_entity::Entity;
use models_grouping::GroupingConfig;
-use models_pagination::{
- Cursor, CursorVal, CursorWithValAndFilter, Frecency, FrecencyValue, Identify, Query,
- SimpleSortMethod, SortOn,
-};
+use models_pagination::{Cursor, CursorWithValAndFilter, Frecency, Query, SimpleSortMethod};
+use models_soup::SoupProperty;
use models_soup::item::SoupItem;
use non_empty::IsEmpty;
+use serde::{Deserialize, Serialize};
use std::sync::Arc;
use thiserror::Error;
use uuid::Uuid;
@@ -364,6 +363,7 @@ impl SoupRequest<Option<EntityFilterAst>> {
// we don't yet have sort by frecency implemented for emails yet
SoupQuery::Frecency(_) => None,
}?,
+ include_frecency: false,
team_receipt,
crm_scope,
})
@@ -518,6 +518,7 @@ impl SoupRequest<Option<EntityFilterAst>> {
Some(GetChannelsRequest {
macro_id: self.user.clone(),
limit: Some(self.limit as u32),
+ include_frecency: false,
query: match &self.cursor {
SoupQuery::Simple(SimpleQueryInner(Query::Sort(t, f))) => Some(Query::Sort(
*t,
@@ -749,44 +750,19 @@ fn or_is_ids_only(expr: &Expr<CrmCompanyLiteral>, out: &mut CrmCompanyFilterExtr
}
}
-/// a [SoupItem] with an associated frecency score
+/// A Soup result with both optional enrichments represented in one model.
+///
+/// Service methods decide which fields to populate. An unfetched enrichment
+/// remains empty without changing the response model.
#[derive(Debug)]
#[non_exhaustive]
-pub struct FrecencySoupItem {
- /// the soup item
- pub item: SoupItem,
- /// the frecency score
+pub struct EnrichedSoupItem {
+ /// The Soup item with its property projection.
+ pub item: SoupItem<SoupPropertiesField>,
+ /// The aggregate frecency score, when requested and available.
pub frecency_score: Option<AggregateFrecency>,
}
-impl Identify for FrecencySoupItem {
- type Id = String;
-
- fn id(&self) -> Self::Id {
- self.item.entity().entity_id.to_string()
- }
-}
-
-impl SortOn<Frecency> for FrecencySoupItem {
- fn sort_on(sort_type: Frecency) -> impl FnMut(&Self) -> models_pagination::CursorVal<Frecency> {
- move |val| CursorVal {
- sort_type,
- // if this record does not have a frecency score we fallback to created_at as the sort
- last_val: match &val.frecency_score {
- Some(f) => FrecencyValue::FrecencyScore(f.data.frecency_score),
- None => FrecencyValue::UpdatedAt(val.item.updated_at()),
- },
- }
- }
-}
-
-impl SortOn<SimpleSortMethod> for FrecencySoupItem {
- fn sort_on(sort: SimpleSortMethod) -> impl FnMut(&Self) -> CursorVal<SimpleSortMethod> {
- let mut cb = SoupItem::sort_on(sort);
- move |v| cb(&v.item)
- }
-}
-
/// A soup request with optional grouping configuration.
#[derive(Debug)]
pub struct GroupedSoupRequest<T> {
@@ -798,9 +774,9 @@ pub struct GroupedSoupRequest<T> {
/// A soup item with group metadata attached (returned from grouped queries).
#[derive(Debug)]
-pub struct GroupedSoupItem {
+pub struct GroupedSoupItem<T = ()> {
/// The soup item
- pub item: SoupItem,
+ pub item: SoupItem<T>,
/// The frecency score (if available)
pub frecency_score: Option<AggregateFrecency>,
/// Which group this item belongs to
@@ -851,3 +827,21 @@ pub enum SoupErr {
#[error(transparent)]
AstErr(#[from] ExpandErr),
}
+
+/// Property fields that can be flattened into property-bearing Soup items.
+#[derive(Debug, Clone, Default, Serialize, Deserialize)]
+#[cfg_attr(feature = "axum", derive(utoipa::ToSchema))]
+pub struct SoupPropertiesField {
+ /// Properties attached to the entity.
+ pub properties: Vec<SoupProperty>,
+}
+
+/// A Soup item with entity properties attached.
+pub type SoupItemWithProperties = SoupItem<SoupPropertiesField>;
+
+impl SoupPropertiesField {
+ /// Creates an extra field containing the supplied properties.
+ pub fn new(properties: Vec<SoupProperty>) -> Self {
+ Self { properties }
+ }
+}
diff --git a/crates/soup/src/domain/models/grouping.rs b/crates/soup/src/domain/models/grouping.rs
index 081a09b156..ebd9963363 100644
--- a/crates/soup/src/domain/models/grouping.rs
+++ b/crates/soup/src/domain/models/grouping.rs
@@ -1,6 +1,6 @@
//! Grouping utilities for soup queries.
-use super::FrecencySoupItem;
+use super::{EnrichedSoupItem, SoupPropertiesField};
use item_filters::ast::EntityFilterAst;
use models_grouping::{GroupByField, date_bucket_label, date_bucket_order};
use models_pagination::{
@@ -52,7 +52,7 @@ pub struct GroupMeta {
#[derive(Debug)]
pub struct GroupedResponse {
/// Items pool keyed by id. Ordering is described by `groups[].item_ids`.
- pub items: HashMap<Uuid, FrecencySoupItem>,
+ pub items: HashMap<Uuid, EnrichedSoupItem>,
/// Group metadata for each group.
pub groups: Vec<GroupMeta>,
/// Page-level cursor for loading more items.
@@ -61,7 +61,7 @@ pub struct GroupedResponse {
/// Build a grouped response from grouped soup items.
pub fn build_grouped_response(
- items: Vec<super::GroupedSoupItem>,
+ items: Vec<super::GroupedSoupItem<SoupPropertiesField>>,
group_by: &GroupByField,
sort_method: SimpleSortMethod,
requested_group_key: Option<String>,
@@ -77,7 +77,7 @@ pub fn build_grouped_response(
}
let mut group_stats: HashMap<String, GroupData> = HashMap::new();
- let mut items_pool: HashMap<Uuid, FrecencySoupItem> = HashMap::with_capacity(items.len());
+ let mut items_pool: HashMap<Uuid, EnrichedSoupItem> = HashMap::with_capacity(items.len());
let mut get_cursor_val = SoupItem::sort_on(sort_method);
for grouped_item in items.into_iter() {
@@ -108,7 +108,7 @@ pub fn build_grouped_response(
// overwriting an already-populated entry.
items_pool
.entry(item_id)
- .or_insert_with(|| FrecencySoupItem {
+ .or_insert_with(|| EnrichedSoupItem {
item: grouped_item.item,
frecency_score: grouped_item.frecency_score,
});
diff --git a/crates/soup/src/domain/ports.rs b/crates/soup/src/domain/ports.rs
index 00f212f192..a3230762d6 100644
--- a/crates/soup/src/domain/ports.rs
+++ b/crates/soup/src/domain/ports.rs
@@ -1,8 +1,8 @@
use std::sync::Arc;
use crate::domain::models::{
- AdvancedSortParams, FrecencySoupItem, GroupedSortRequest, GroupedSoupItem, IntoSoupReqAst,
- SimpleSortRequest, SoupErr, SoupRequest,
+ AdvancedSortParams, EnrichedSoupItem, GroupedSortRequest, GroupedSoupItem, IntoSoupReqAst,
+ SimpleSortRequest, SoupErr, SoupPropertiesField, SoupRequest,
};
use either::Either;
use entity_access::domain::models::{EntityAccessReceipt, MemberTeamRole};
@@ -21,33 +21,34 @@ pub trait SoupRepo: Send + Sync + 'static {
fn expanded_generic_cursor_soup<'a>(
&self,
req: SimpleSortRequest<'a>,
- ) -> impl Future<Output = Result<Vec<SoupItem>, Self::Err>> + Send;
+ ) -> impl Future<Output = Result<Vec<SoupItem<()>>, Self::Err>> + Send;
/// Fetch unexpanded soup items for a simple sorted cursor query.
fn unexpanded_generic_cursor_soup<'a>(
&self,
req: SimpleSortRequest<'a>,
- ) -> impl Future<Output = Result<Vec<SoupItem>, Self::Err>> + Send;
+ ) -> impl Future<Output = Result<Vec<SoupItem<()>>, Self::Err>> + Send;
/// Fetch expanded soup items for an explicit list of entity ids.
fn expanded_soup_by_ids<'a>(
&self,
req: AdvancedSortParams<'a>,
- ) -> impl Future<Output = Result<Vec<SoupItem>, Self::Err>> + Send;
+ ) -> impl Future<Output = Result<Vec<SoupItem<()>>, Self::Err>> + Send;
/// Fetch unexpanded soup items for an explicit list of entity ids.
fn unexpanded_soup_by_ids<'a>(
&self,
req: AdvancedSortParams<'a>,
- ) -> impl Future<Output = Result<Vec<SoupItem>, Self::Err>> + Send;
+ ) -> impl Future<Output = Result<Vec<SoupItem<()>>, Self::Err>> + Send;
- /// Populates properties for a slice of SoupItems. The user id scopes which
- /// tag properties are visible (the caller's own and their team's).
+ /// Attaches properties to raw Soup items while preserving their order and
+ /// count. The user id scopes which tag properties are visible (the
+ /// caller's own and their team's).
fn populate_properties<'a>(
&self,
user_id: MacroUserIdStr<'a>,
- items: &'a mut [SoupItem],
- ) -> impl Future<Output = Result<(), Self::Err>> + Send;
+ items: Vec<SoupItem<()>>,
+ ) -> impl Future<Output = Result<Vec<SoupItem<SoupPropertiesField>>, Self::Err>> + Send;
/// Fetches the tag definitions visible to a user — their own plus their
/// teams' — with options attached.
@@ -60,18 +61,18 @@ pub trait SoupRepo: Send + Sync + 'static {
fn expanded_grouped_cursor_soup<'a>(
&self,
req: GroupedSortRequest<'a>,
- ) -> impl Future<Output = Result<Vec<GroupedSoupItem>, Self::Err>> + Send;
+ ) -> impl Future<Output = Result<Vec<GroupedSoupItem<()>>, Self::Err>> + Send;
}
/// type alias which represents the posible outputs of soup
/// The response is a paginated cursor where
-/// 1. The item type is [FrecencySoupItem]
+/// 1. The item type is the requested raw or enriched Soup representation
/// 1. The id type is [String] (this should be changed to uuid)
/// 1. The sort method is [Either] [SimpleSortMethod] or [Frecency]
/// 1. The filter type is an [Option] [EntityFilterAst]
-pub type SoupOutput<T> = Either<
- PaginatedCursor<FrecencySoupItem, String, SimpleSortMethod, T>,
- PaginatedCursor<FrecencySoupItem, String, Frecency, T>,
+pub type SoupOutput<T, Item = SoupItem<()>> = Either<
+ PaginatedCursor<Item, String, SimpleSortMethod, T>,
+ PaginatedCursor<Item, String, Frecency, T>,
>;
#[cfg(test)]
@@ -79,7 +80,7 @@ mod test;
/// Service abstraction for executing user-facing soup queries.
pub trait SoupService: Send + Sync + 'static {
- /// Run a soup query for the authenticated user.
+ /// Run a soup query without loading entity properties or frecency.
///
/// `team_receipt` proves the user belongs to a team and may be used by
/// filters that broaden visibility beyond the user's own mailboxes (e.g.
@@ -94,11 +95,41 @@ pub trait SoupService: Send + Sync + 'static {
SoupRequest<T>: IntoSoupReqAst,
T: Clone + Serialize + Send;
- /// Run a grouped soup query for the authenticated user.
+ /// Run a soup query and attach entity properties to the returned page.
+ fn get_user_soup_with_properties<T>(
+ &self,
+ req: SoupRequest<T>,
+ team_receipt: Option<EntityAccessReceipt<MemberTeamRole>>,
+ ) -> impl Future<Output = Result<SoupOutput<T, EnrichedSoupItem>, SoupErr>> + Send
+ where
+ SoupRequest<T>: IntoSoupReqAst,
+ T: Clone + Serialize + Send;
+
+ /// Run a soup query and attach frecency to the returned page.
+ fn get_user_soup_with_frecency<T>(
+ &self,
+ req: SoupRequest<T>,
+ team_receipt: Option<EntityAccessReceipt<MemberTeamRole>>,
+ ) -> impl Future<Output = Result<SoupOutput<T, EnrichedSoupItem>, SoupErr>> + Send
+ where
+ SoupRequest<T>: IntoSoupReqAst,
+ T: Clone + Serialize + Send;
+
+ /// Run a soup query and attach both properties and frecency to the page.
+ fn get_user_soup_with_properties_and_frecency<T>(
+ &self,
+ req: SoupRequest<T>,
+ team_receipt: Option<EntityAccessReceipt<MemberTeamRole>>,
+ ) -> impl Future<Output = Result<SoupOutput<T, EnrichedSoupItem>, SoupErr>> + Send
+ where
+ SoupRequest<T>: IntoSoupReqAst,
+ T: Clone + Serialize + Send;
+
+ /// Run a grouped soup query for the authenticated user with properties.
fn get_user_soup_grouped(
&self,
req: GroupedSortRequest<'_>,
- ) -> impl Future<Output = Result<Vec<GroupedSoupItem>, SoupErr>> + Send;
+ ) -> impl Future<Output = Result<Vec<GroupedSoupItem<SoupPropertiesField>>, SoupErr>> + Send;
/// Fetch the tag definitions visible to a user — their own plus their
/// teams' — with options attached.
@@ -124,10 +155,52 @@ where
(**self).get_user_soup(req, team_receipt).await
}
+ async fn get_user_soup_with_properties<T>(
+ &self,
+ req: SoupRequest<T>,
+ team_receipt: Option<EntityAccessReceipt<MemberTeamRole>>,
+ ) -> Result<SoupOutput<T, EnrichedSoupItem>, SoupErr>
+ where
+ SoupRequest<T>: IntoSoupReqAst,
+ T: Clone + Serialize + Send,
+ {
+ (**self)
+ .get_user_soup_with_properties(req, team_receipt)
+ .await
+ }
+
+ async fn get_user_soup_with_frecency<T>(
+ &self,
+ req: SoupRequest<T>,
+ team_receipt: Option<EntityAccessReceipt<MemberTeamRole>>,
+ ) -> Result<SoupOutput<T, EnrichedSoupItem>, SoupErr>
+ where
+ SoupRequest<T>: IntoSoupReqAst,
+ T: Clone + Serialize + Send,
+ {
+ (**self)
+ .get_user_soup_with_frecency(req, team_receipt)
+ .await
+ }
+
+ async fn get_user_soup_with_properties_and_frecency<T>(
+ &self,
+ req: SoupRequest<T>,
+ team_receipt: Option<EntityAccessReceipt<MemberTeamRole>>,
+ ) -> Result<SoupOutput<T, EnrichedSoupItem>, SoupErr>
+ where
+ SoupRequest<T>: IntoSoupReqAst,
+ T: Clone + Serialize + Send,
+ {
+ (**self)
+ .get_user_soup_with_properties_and_frecency(req, team_receipt)
+ .await
+ }
+
async fn get_user_soup_grouped(
&self,
req: GroupedSortRequest<'_>,
- ) -> Result<Vec<GroupedSoupItem>, SoupErr> {
+ ) -> Result<Vec<GroupedSoupItem<SoupPropertiesField>>, SoupErr> {
(**self).get_user_soup_grouped(req).await
}
@@ -162,10 +235,46 @@ impl SoupService for NoOpSoupService {
Err(no_op_soup_err())
}
+ async fn get_user_soup_with_properties<T>(
+ &self,
+ _req: SoupRequest<T>,
+ _team_receipt: Option<EntityAccessReceipt<MemberTeamRole>>,
+ ) -> Result<SoupOutput<T, EnrichedSoupItem>, SoupErr>
+ where
+ SoupRequest<T>: IntoSoupReqAst,
+ T: Clone + Serialize + Send,
+ {
+ Err(no_op_soup_err())
+ }
+
+ async fn get_user_soup_with_frecency<T>(
+ &self,
+ _req: SoupRequest<T>,
+ _team_receipt: Option<EntityAccessReceipt<MemberTeamRole>>,
+ ) -> Result<SoupOutput<T, EnrichedSoupItem>, SoupErr>
+ where
+ SoupRequest<T>: IntoSoupReqAst,
+ T: Clone + Serialize + Send,
+ {
+ Err(no_op_soup_err())
+ }
+
+ async fn get_user_soup_with_properties_and_frecency<T>(
+ &self,
+ _req: SoupRequest<T>,
+ _team_receipt: Option<EntityAccessReceipt<MemberTeamRole>>,
+ ) -> Result<SoupOutput<T, EnrichedSoupItem>, SoupErr>
+ where
+ SoupRequest<T>: IntoSoupReqAst,
+ T: Clone + Serialize + Send,
+ {
+ Err(no_op_soup_err())
+ }
+
async fn get_user_soup_grouped(
&self,
_req: GroupedSortRequest<'_>,
- ) -> Result<Vec<GroupedSoupItem>, SoupErr> {
+ ) -> Result<Vec<GroupedSoupItem<SoupPropertiesField>>, SoupErr> {
Err(no_op_soup_err())
}
diff --git a/crates/soup/src/domain/service.rs b/crates/soup/src/domain/service.rs
index 2824ae7524..9b398c3ebc 100644
--- a/crates/soup/src/domain/service.rs
+++ b/crates/soup/src/domain/service.rs
@@ -1,8 +1,8 @@
use crate::domain::{
models::{
- AdvancedSortParams, FrecencyQueryInner, FrecencySoupItem, GetCrmCompaniesRequest,
+ AdvancedSortParams, EnrichedSoupItem, FrecencyQueryInner, GetCrmCompaniesRequest,
GroupedSortRequest, GroupedSoupItem, IntoSoupReqAst, SimpleQueryInner, SimpleSortQuery,
- SimpleSortRequest, SoupErr, SoupQuery, SoupRequest, SoupType,
+ SimpleSortRequest, SoupErr, SoupPropertiesField, SoupQuery, SoupRequest, SoupType,
},
ports::{SoupOutput, SoupRepo, SoupService},
};
@@ -25,13 +25,16 @@ use foreign_entity::domain::{
ports::{ForeignEntityListQuery, ForeignEntityService},
};
use frecency::domain::{
- models::{AggregateId, FrecencyPageRequest, JoinFrecency},
+ models::{
+ AggregateFrecency, AggregateId, FrecencyByIdsRequest, FrecencyPageRequest, JoinFrecency,
+ },
ports::FrecencyQueryService,
};
use item_filters::ast::EntityFilterAst;
use macro_user_id::user_id::MacroUserIdStr;
use models_pagination::{
- Cursor, CursorVal, Frecency, FrecencyValue, PaginateOn, Query, SimpleSortMethod,
+ Cursor, CursorVal, Frecency, FrecencyValue, Identify, PaginateOn, Paginated, Query,
+ SimpleSortMethod, SortOn,
};
use models_properties::service::property_definition_with_options::PropertyDefinitionWithOptions;
use models_soup::{
@@ -52,7 +55,40 @@ use uuid::Uuid;
#[cfg(test)]
mod tests;
-fn foreign_entity_to_soup_item(entity: ForeignEntity) -> SoupItem {
+#[derive(Debug)]
+struct SoupCandidate {
+ item: SoupItem<()>,
+ frecency_score: Option<AggregateFrecency>,
+}
+
+impl Identify for SoupCandidate {
+ type Id = String;
+
+ fn id(&self) -> Self::Id {
+ self.item.entity().entity_id.to_string()
+ }
+}
+
+impl SortOn<Frecency> for SoupCandidate {
+ fn sort_on(sort_type: Frecency) -> impl FnMut(&Self) -> CursorVal<Frecency> {
+ move |candidate| CursorVal {
+ sort_type,
+ last_val: match &candidate.frecency_score {
+ Some(frecency) => FrecencyValue::FrecencyScore(frecency.data.frecency_score),
+ None => FrecencyValue::UpdatedAt(candidate.item.updated_at()),
+ },
+ }
+ }
+}
+
+impl SortOn<SimpleSortMethod> for SoupCandidate {
+ fn sort_on(sort: SimpleSortMethod) -> impl FnMut(&Self) -> CursorVal<SimpleSortMethod> {
+ let mut sort_item = SoupItem::sort_on(sort);
+ move |candidate| sort_item(&candidate.item)
+ }
+}
+
+fn foreign_entity_to_soup_item(entity: ForeignEntity) -> SoupItem<()> {
SoupItem::ForeignEntity(SoupForeignEntity {
id: entity.id,
foreign_entity_id: entity.foreign_entity_id,
@@ -120,7 +156,7 @@ where
&self,
soup_type: SoupType,
req: SimpleSortRequest<'_>,
- ) -> Result<impl Iterator<Item = FrecencySoupItem>, SoupErr> {
+ ) -> Result<impl Iterator<Item = SoupCandidate>, SoupErr> {
let res = match soup_type {
SoupType::Expanded => self
.soup_storage
@@ -134,7 +170,7 @@ where
.map_err(anyhow::Error::from)?,
};
- Ok(res.into_iter().map(|item| FrecencySoupItem {
+ Ok(res.into_iter().map(|item| SoupCandidate {
item,
frecency_score: None,
}))
@@ -144,7 +180,7 @@ where
async fn handle_grouped_soup_request(
&self,
req: GroupedSortRequest<'_>,
- ) -> Result<Vec<GroupedSoupItem>, SoupErr> {
+ ) -> Result<Vec<GroupedSoupItem<()>>, SoupErr> {
self.soup_storage
.expanded_grouped_cursor_soup(req)
.await
@@ -157,7 +193,7 @@ where
&self,
soup_type: SoupType,
req: AdvancedSortParams<'_>,
- ) -> Result<Vec<SoupItem>, T::Err> {
+ ) -> Result<Vec<SoupItem<()>>, T::Err> {
match soup_type {
SoupType::Expanded => self.soup_storage.expanded_soup_by_ids(req).await,
SoupType::UnExpanded => self.soup_storage.unexpanded_soup_by_ids(req).await,
@@ -170,9 +206,9 @@ where
&self,
soup_type: SoupType,
user: MacroUserIdStr<'_>,
- frecency_items: impl ExactSizeIterator<Item = FrecencySoupItem>,
+ frecency_items: impl ExactSizeIterator<Item = SoupCandidate>,
limit: u16,
- ) -> Result<impl Iterator<Item = FrecencySoupItem>, SoupErr> {
+ ) -> Result<impl Iterator<Item = SoupCandidate>, SoupErr> {
let len = frecency_items.len();
let remainder_to_fetch = (limit as usize).saturating_sub(len);
@@ -199,7 +235,7 @@ where
soup_type: SoupType,
user: MacroUserIdStr<'static>,
limit: u16,
- ) -> Result<impl Iterator<Item = FrecencySoupItem>, SoupErr> {
+ ) -> Result<impl Iterator<Item = SoupCandidate>, SoupErr> {
let from_score = match cursor {
Query::Sort(_, _) => None,
Query::Cursor(Cursor {
@@ -272,7 +308,7 @@ where
soup_type: SoupType,
user: MacroUserIdStr<'static>,
limit: u16,
- ) -> Result<impl Iterator<Item = FrecencySoupItem>, SoupErr> {
+ ) -> Result<impl Iterator<Item = SoupCandidate>, SoupErr> {
let (from_score, filters) = match from_value {
None => (None, None),
Some((s, f)) => (Some(s), f),
@@ -306,7 +342,7 @@ where
user_id: user.copied().into_owned(),
})
.into_iter()
- .map(|(soup_item, frecency)| FrecencySoupItem {
+ .map(|(soup_item, frecency)| SoupCandidate {
item: soup_item,
frecency_score: Some(frecency),
});
@@ -323,9 +359,8 @@ where
#[tracing::instrument(err, skip(self, req))]
async fn handle_email_request(
&self,
- user_id: MacroUserIdStr<'_>,
req: Option<GetEmailsRequest>,
- ) -> Result<impl Iterator<Item = FrecencySoupItem>, SoupErr> {
+ ) -> Result<impl Iterator<Item = SoupCandidate>, SoupErr> {
use frecency::domain::models::AggregateFrecency;
let Some(req) = req else {
@@ -336,7 +371,7 @@ where
let mut frecency_scores: Vec<Option<AggregateFrecency>> =
Vec::with_capacity(email_response.items.len());
- let mut items: Vec<SoupItem> = email_response
+ let items: Vec<SoupItem<()>> = email_response
.items
.into_iter()
.map(
@@ -354,35 +389,26 @@ where
attachments: Vec::<SoupAttachment>::mirror(attachments),
participants: Vec::<SoupContact>::mirror(participants),
labels: Vec::<SoupLabel>::mirror(labels),
- properties: Default::default(),
+ extra: (),
};
SoupItem::EmailThread(soup_email)
},
)
.collect();
- self.soup_storage
- .populate_properties(user_id, &mut items)
- .await
- .map_err(anyhow::Error::from)?;
-
- let emails_with_props: Vec<FrecencySoupItem> = items
- .into_iter()
- .zip(frecency_scores)
- .map(|(item, frecency_score)| FrecencySoupItem {
+ Ok(Either::Right(items.into_iter().zip(frecency_scores).map(
+ |(item, frecency_score)| SoupCandidate {
item,
frecency_score,
- })
- .collect();
-
- Ok(Either::Right(emails_with_props.into_iter()))
+ },
+ )))
}
#[tracing::instrument(err, skip(self, req))]
async fn handle_comms_request(
&self,
req: Option<GetChannelsRequest>,
- ) -> Result<impl Iterator<Item = FrecencySoupItem>, SoupErr> {
+ ) -> Result<impl Iterator<Item = SoupCandidate>, SoupErr> {
let Some(req) = req else {
return Ok(Either::Left(None.into_iter()));
};
@@ -396,7 +422,7 @@ where
r.into_iter().map(|mut c| {
let frecency_score = c.frecency_score.take();
let soup_channel = SoupChannel::new_from_channels(c);
- FrecencySoupItem {
+ SoupCandidate {
item: SoupItem::Channel(soup_channel),
frecency_score,
}
@@ -409,7 +435,7 @@ where
async fn handle_comms_thread_request(
&self,
req: Option<GetThreadReplyRowsRequest>,
- ) -> Result<impl Iterator<Item = FrecencySoupItem>, SoupErr> {
+ ) -> Result<impl Iterator<Item = SoupCandidate>, SoupErr> {
let Some(req) = req else {
return Ok(Either::Left(None.into_iter()));
};
@@ -420,7 +446,7 @@ where
.await
.map_err(|_| SoupErr::CommsErr)?
.into_iter()
- .map(|message| FrecencySoupItem {
+ .map(|message| SoupCandidate {
item: SoupItem::ChannelThread(SoupChannelThread::new_from_channel_message(
message,
)),
@@ -433,7 +459,7 @@ where
async fn handle_crm_company_request(
&self,
req: Option<GetCrmCompaniesRequest>,
- ) -> Result<impl Iterator<Item = FrecencySoupItem>, SoupErr> {
+ ) -> Result<impl Iterator<Item = SoupCandidate>, SoupErr> {
let Some(req) = req else {
return Ok(Either::Left(None.into_iter()));
};
@@ -448,7 +474,7 @@ where
limit,
} = req;
- let mut items: Vec<SoupItem> = self
+ let items: Vec<SoupItem<()>> = self
.crm_service
.list_companies_for_soup(
&access,
@@ -468,20 +494,9 @@ where
.map(|company| SoupItem::CrmCompany(SoupCrmCompany::from(company)))
.collect();
- // Companies are fetched outside the main soup queries (which hydrate
- // their own items), so attach entity properties here.
- if !items.is_empty() {
- self.soup_storage
- .populate_properties(user_id, &mut items)
- .await
- .map_err(anyhow::Error::from)?;
- }
-
- Ok(Either::Right(items.into_iter().map(|item| {
- FrecencySoupItem {
- item,
- frecency_score: None,
- }
+ Ok(Either::Right(items.into_iter().map(|item| SoupCandidate {
+ item,
+ frecency_score: None,
})))
}
@@ -489,15 +504,14 @@ where
async fn handle_call_request(
&self,
req: Option<GetCallRecordsRequest>,
- ) -> Result<impl Iterator<Item = FrecencySoupItem>, SoupErr> {
+ ) -> Result<impl Iterator<Item = SoupCandidate>, SoupErr> {
let Some(req) = req else {
return Ok(Either::Left(None.into_iter()));
};
- let user_id = req.user_id.clone();
- let user_id_str = user_id.as_ref().to_string();
+ let user_id_str = req.user_id.as_ref().to_string();
- let mut items: Vec<SoupItem> = self
+ let items: Vec<SoupItem<()>> = self
.call_record_service
.get_user_call_records(req)
.await
@@ -508,20 +522,9 @@ where
})
.collect();
- // Calls are fetched outside the main soup queries (which hydrate their
- // own items), so attach entity properties (tags) here, like CRM.
- if !items.is_empty() {
- self.soup_storage
- .populate_properties(user_id, &mut items)
- .await
- .map_err(anyhow::Error::from)?;
- }
-
- Ok(Either::Right(items.into_iter().map(|item| {
- FrecencySoupItem {
- item,
- frecency_score: None,
- }
+ Ok(Either::Right(items.into_iter().map(|item| SoupCandidate {
+ item,
+ frecency_score: None,
})))
}
@@ -532,7 +535,7 @@ where
source_ids: Vec<SourceId>,
limit: u32,
query: Option<ForeignEntityListQuery>,
- ) -> Result<impl Iterator<Item = FrecencySoupItem>, SoupErr> {
+ ) -> Result<impl Iterator<Item = SoupCandidate>, SoupErr> {
let Some(query) = query else {
return Ok(Either::Left(None.into_iter()));
};
@@ -542,31 +545,224 @@ where
.get_foreign_entities_for_user(requesting_user, source_ids, limit, query)
.await?
.into_iter()
- .map(|entity| FrecencySoupItem {
+ .map(|entity| SoupCandidate {
item: foreign_entity_to_soup_item(entity),
frecency_score: None,
}),
))
}
-}
-impl<T, U, V, C, K, Crm, F> SoupService for SoupImpl<T, U, V, C, K, Crm, F>
-where
- T: SoupRepo,
- anyhow::Error: From<T::Err>,
- U: FrecencyQueryService,
- V: EmailPreviewServiceReadOnly,
- C: ChannelListService,
- K: CallRecordQueryService,
- Crm: CrmService,
- F: ForeignEntityService,
-{
- #[tracing::instrument(err, skip(self, req, team_receipt))]
- async fn get_user_soup<R>(
+ async fn populate_properties_items(
+ &self,
+ user_id: MacroUserIdStr<'_>,
+ items: Vec<SoupCandidate>,
+ ) -> Result<Vec<EnrichedSoupItem>, SoupErr> {
+ if items.is_empty() {
+ return Ok(Vec::new());
+ }
+
+ let (items, frecency_scores): (Vec<_>, Vec<_>) = items
+ .into_iter()
+ .map(|item| (item.item, item.frecency_score))
+ .unzip();
+ let items = self
+ .soup_storage
+ .populate_properties(user_id, items)
+ .await
+ .map_err(anyhow::Error::from)?;
+ if items.len() != frecency_scores.len() {
+ return Err(SoupErr::SoupDbErr(anyhow::anyhow!(
+ "property hydration changed the number of Soup items"
+ )));
+ }
+
+ Ok(items
+ .into_iter()
+ .zip(frecency_scores)
+ .map(|(item, frecency_score)| EnrichedSoupItem {
+ item,
+ frecency_score,
+ })
+ .collect())
+ }
+
+ async fn populate_properties_page<Cursor>(
+ &self,
+ user_id: MacroUserIdStr<'_>,
+ page: Paginated<SoupCandidate, Cursor>,
+ ) -> Result<Paginated<EnrichedSoupItem, Cursor>, SoupErr> {
+ let (items, next_cursor) = page.into_parts();
+ let items = self.populate_properties_items(user_id, items).await?;
+ Ok(Paginated::from_parts(items, next_cursor))
+ }
+
+ async fn populate_properties_output<R>(
+ &self,
+ user_id: MacroUserIdStr<'_>,
+ output: SoupOutput<R, SoupCandidate>,
+ ) -> Result<SoupOutput<R, EnrichedSoupItem>, SoupErr> {
+ match output {
+ Either::Left(page) => Ok(Either::Left(
+ self.populate_properties_page(user_id, page).await?,
+ )),
+ Either::Right(page) => Ok(Either::Right(
+ self.populate_properties_page(user_id, page).await?,
+ )),
+ }
+ }
+
+ async fn populate_frecency_page<Cursor>(
+ &self,
+ user_id: MacroUserIdStr<'_>,
+ mut page: Paginated<SoupCandidate, Cursor>,
+ ) -> Result<Paginated<SoupCandidate, Cursor>, SoupErr> {
+ if page.items.is_empty() {
+ return Ok(page);
+ }
+
+ let entities: Vec<_> = page.items.iter().map(|item| item.item.entity()).collect();
+ let mut frecency = self
+ .frecency
+ .get_frecencies_by_ids(FrecencyByIdsRequest {
+ user_id: user_id.clone(),
+ ids: &entities,
+ })
+ .await?
+ .into_inner();
+
+ for item in &mut page.items {
+ let id = AggregateId {
+ user_id: user_id.clone().into_owned(),
+ entity: item.item.entity(),
+ };
+ item.frecency_score = frecency.remove(&id).map(|data| id.into_aggregate(data));
+ }
+
+ Ok(page)
+ }
+
+ async fn populate_frecency_output<R>(
+ &self,
+ user_id: MacroUserIdStr<'_>,
+ output: SoupOutput<R, SoupCandidate>,
+ ) -> Result<SoupOutput<R, SoupCandidate>, SoupErr> {
+ match output {
+ // Simple sorting does not need frecency to construct the page, so
+ // load it once for only the final page.
+ Either::Left(page) => Ok(Either::Left(
+ self.populate_frecency_page(user_id, page).await?,
+ )),
+ // Frecency sorting already loaded the scores needed for ordering
+ // and cursor construction. Reuse them rather than issuing a
+ // duplicate by-id lookup.
+ Either::Right(page) => Ok(Either::Right(page)),
+ }
+ }
+
+ fn into_raw_output<R>(output: SoupOutput<R, SoupCandidate>) -> SoupOutput<R> {
+ let into_raw = |candidate: SoupCandidate| candidate.item;
+ match output {
+ Either::Left(page) => Either::Left(page.map(into_raw)),
+ Either::Right(page) => Either::Right(page.map(into_raw)),
+ }
+ }
+
+ fn into_enriched_output<R>(
+ output: SoupOutput<R, SoupCandidate>,
+ ) -> SoupOutput<R, EnrichedSoupItem> {
+ let into_enriched = |candidate: SoupCandidate| EnrichedSoupItem {
+ item: candidate
+ .item
+ .map_extra(|()| SoupPropertiesField::default()),
+ frecency_score: candidate.frecency_score,
+ };
+ match output {
+ Either::Left(page) => Either::Left(page.map(into_enriched)),
+ Either::Right(page) => Either::Right(page.map(into_enriched)),
+ }
+ }
+
+ fn clear_frecency<R>(
+ output: SoupOutput<R, EnrichedSoupItem>,
+ ) -> SoupOutput<R, EnrichedSoupItem> {
+ let clear = |mut item: EnrichedSoupItem| {
+ item.frecency_score = None;
+ item
+ };
+ match output {
+ Either::Left(page) => Either::Left(page.map(clear)),
+ Either::Right(page) => Either::Right(page.map(clear)),
+ }
+ }
+
+ async fn populate_grouped_items(
+ &self,
+ user_id: MacroUserIdStr<'_>,
+ items: Vec<GroupedSoupItem<()>>,
+ ) -> Result<Vec<GroupedSoupItem<SoupPropertiesField>>, SoupErr> {
+ if items.is_empty() {
+ return Ok(Vec::new());
+ }
+
+ let (items, metadata): (Vec<_>, Vec<_>) = items
+ .into_iter()
+ .map(|item| {
+ (
+ item.item,
+ (
+ item.frecency_score,
+ item.group_key,
+ item.group_total_count,
+ item.row_in_group,
+ item.group_label,
+ item.group_display_order,
+ ),
+ )
+ })
+ .unzip();
+ let items = self
+ .soup_storage
+ .populate_properties(user_id, items)
+ .await
+ .map_err(anyhow::Error::from)?;
+ if items.len() != metadata.len() {
+ return Err(SoupErr::SoupDbErr(anyhow::anyhow!(
+ "property hydration changed the number of grouped Soup items"
+ )));
+ }
+
+ Ok(items
+ .into_iter()
+ .zip(metadata)
+ .map(
+ |(
+ item,
+ (
+ frecency_score,
+ group_key,
+ group_total_count,
+ row_in_group,
+ group_label,
+ group_display_order,
+ ),
+ )| GroupedSoupItem {
+ item,
+ frecency_score,
+ group_key,
+ group_total_count,
+ row_in_group,
+ group_label,
+ group_display_order,
+ },
+ )
+ .collect())
+ }
+
+ async fn get_user_soup_internal<R>(
&self,
req: SoupRequest<R>,
team_receipt: Option<EntityAccessReceipt<MemberTeamRole>>,
- ) -> Result<SoupOutput<R>, SoupErr>
+ ) -> Result<SoupOutput<R, SoupCandidate>, SoupErr>
where
SoupRequest<R>: IntoSoupReqAst,
R: Clone + Serialize + Send,
@@ -609,17 +805,11 @@ where
user_id: req.user.copied(),
},
);
-
- let email_soup_fut = self.handle_email_request(req.user.copied(), email_request);
-
+ let email_soup_fut = self.handle_email_request(email_request);
let comms_soup_fut = self.handle_comms_request(comms_request);
-
let comms_thread_soup_fut = self.handle_comms_thread_request(comms_thread_request);
-
let call_soup_fut = self.handle_call_request(call_request);
-
let crm_company_soup_fut = self.handle_crm_company_request(crm_company_request);
-
let foreign_entity_soup_fut = self.handle_foreign_entity_request(
Some(req.user.to_string()),
foreign_entity_source_ids,
@@ -668,13 +858,91 @@ where
)),
}
}
+}
+
+impl<T, U, V, C, K, Crm, F> SoupService for SoupImpl<T, U, V, C, K, Crm, F>
+where
+ T: SoupRepo,
+ anyhow::Error: From<T::Err>,
+ U: FrecencyQueryService,
+ V: EmailPreviewServiceReadOnly,
+ C: ChannelListService,
+ K: CallRecordQueryService,
+ Crm: CrmService,
+ F: ForeignEntityService,
+{
+ #[tracing::instrument(err, skip(self, req, team_receipt))]
+ async fn get_user_soup<R>(
+ &self,
+ req: SoupRequest<R>,
+ team_receipt: Option<EntityAccessReceipt<MemberTeamRole>>,
+ ) -> Result<SoupOutput<R>, SoupErr>
+ where
+ SoupRequest<R>: IntoSoupReqAst,
+ R: Clone + Serialize + Send,
+ {
+ let output = self.get_user_soup_internal(req, team_receipt).await?;
+ Ok(Self::into_raw_output(output))
+ }
+
+ #[tracing::instrument(err, skip(self, req, team_receipt))]
+ async fn get_user_soup_with_frecency<R>(
+ &self,
+ req: SoupRequest<R>,
+ team_receipt: Option<EntityAccessReceipt<MemberTeamRole>>,
+ ) -> Result<SoupOutput<R, EnrichedSoupItem>, SoupErr>
+ where
+ SoupRequest<R>: IntoSoupReqAst,
+ R: Clone + Serialize + Send,
+ {
+ let user_id = req.user.clone();
+ let output = self.get_user_soup_internal(req, team_receipt).await?;
+ let output = self.populate_frecency_output(user_id, output).await?;
+ Ok(Self::into_enriched_output(output))
+ }
+
+ #[tracing::instrument(err, skip(self, req, team_receipt))]
+ async fn get_user_soup_with_properties<R>(
+ &self,
+ req: SoupRequest<R>,
+ team_receipt: Option<EntityAccessReceipt<MemberTeamRole>>,
+ ) -> Result<SoupOutput<R, EnrichedSoupItem>, SoupErr>
+ where
+ SoupRequest<R>: IntoSoupReqAst,
+ R: Clone + Serialize + Send,
+ {
+ let user_id = req.user.clone();
+ let output = self.get_user_soup_internal(req, team_receipt).await?;
+ let output = self.populate_properties_output(user_id, output).await?;
+ Ok(Self::clear_frecency(output))
+ }
+
+ #[tracing::instrument(err, skip(self, req, team_receipt))]
+ async fn get_user_soup_with_properties_and_frecency<R>(
+ &self,
+ req: SoupRequest<R>,
+ team_receipt: Option<EntityAccessReceipt<MemberTeamRole>>,
+ ) -> Result<SoupOutput<R, EnrichedSoupItem>, SoupErr>
+ where
+ SoupRequest<R>: IntoSoupReqAst,
+ R: Clone + Serialize + Send,
+ {
+ let user_id = req.user.clone();
+ let output = self.get_user_soup_internal(req, team_receipt).await?;
+ let output = self
+ .populate_frecency_output(user_id.clone(), output)
+ .await?;
+ self.populate_properties_output(user_id, output).await
+ }
#[tracing::instrument(err, skip(self, req))]
async fn get_user_soup_grouped(
&self,
req: GroupedSortRequest<'_>,
- ) -> Result<Vec<GroupedSoupItem>, SoupErr> {
- self.handle_grouped_soup_request(req).await
+ ) -> Result<Vec<GroupedSoupItem<SoupPropertiesField>>, SoupErr> {
+ let user_id = req.user_id.clone();
+ let items = self.handle_grouped_soup_request(req).await?;
+ self.populate_grouped_items(user_id, items).await
}
#[tracing::instrument(err, skip(self))]
diff --git a/crates/soup/src/domain/service/tests.rs b/crates/soup/src/domain/service/tests.rs
index 85eaeb4470..d79634dc0d 100644
--- a/crates/soup/src/domain/service/tests.rs
+++ b/crates/soup/src/domain/service/tests.rs
@@ -1,4 +1,3 @@
-use crate::domain::models::FrecencySoupItem;
use crate::domain::ports::MockSoupRepo;
use channels::domain::{
models::{
@@ -24,9 +23,10 @@ use frecency::domain::services::FrecencyQueryServiceImpl;
use frecency::{domain::models::AggregateFrecency, outbound::mock::MockFrecencyStorage};
use item_filters::{
ChannelThreadFilters, EntityFilters, ForeignEntityFilters,
- ast::foreign_entity::ForeignEntityLiteral,
+ ast::{EntityFilterAst, foreign_entity::ForeignEntityLiteral},
};
use model_entity::EntityType;
+use models_grouping::{GroupByField, GroupingConfig};
use models_pagination::{
Cursor, CursorVal, CursorWithValAndFilter, FrecencyValue, PaginatedCursor, SimpleSortMethod,
TypeEraseCursor,
@@ -44,11 +44,12 @@ struct NoopEmailPreviewService;
impl EmailPreviewServiceReadOnly for NoopEmailPreviewService {
async fn get_email_thread_previews(
&self,
- _req: email::domain::models::GetEmailsRequest,
+ req: email::domain::models::GetEmailsRequest,
) -> Result<
PaginatedCursor<EnrichedEmailThreadPreview, Uuid, SimpleSortMethod, ()>,
email::domain::models::EmailErr,
> {
+ assert!(!req.include_frecency);
Ok(Option::<EnrichedEmailThreadPreview>::None
.into_iter()
.paginate_on(0, SimpleSortMethod::CreatedAt)
@@ -61,8 +62,9 @@ struct NoopCommsService;
impl ChannelListService for NoopCommsService {
async fn get_channels(
&self,
- _req: GetChannelsRequest,
+ req: GetChannelsRequest,
) -> Result<Vec<channels::domain::models::ChannelWithLatest>, Report> {
+ assert!(!req.include_frecency);
Ok(Vec::new())
}
@@ -124,6 +126,7 @@ impl ChannelListService for RecordingCommsService {
&self,
req: GetChannelsRequest,
) -> Result<Vec<channels::domain::models::ChannelWithLatest>, Report> {
+ assert!(!req.include_frecency);
*self.channel_calls.lock().unwrap() += 1;
self.channel_filters
.lock()
@@ -467,8 +470,8 @@ fn soup_document_with_is_completed(
updated_at,
viewed_at: Default::default(),
sub_type: is_completed.map(|is_completed| SoupDocumentSubType::Task { is_completed }),
- properties: Default::default(),
deleted_at: None,
+ extra: (),
}
}
@@ -578,7 +581,7 @@ async fn simple_soup_includes_channel_threads() {
assert_eq!(page.items.len(), 1);
assert_matches!(
- &page.items[0].item,
+ &page.items[0],
SoupItem::ChannelThread(thread) => {
assert_eq!(thread.channel_id, channel_id);
assert_eq!(thread.id, thread_id);
@@ -700,10 +703,10 @@ async fn simple_soup_includes_foreign_entities() {
assert_eq!(page.items.len(), 2);
assert_matches!(
- &page.items[0].item,
+ &page.items[0],
SoupItem::ForeignEntity(entity) => assert_eq!(entity.id, foreign_entity_id)
);
- assert_matches!(&page.items[1].item, SoupItem::Document(_));
+ assert_matches!(&page.items[1], SoupItem::Document(_));
let calls = foreign_entity_service.calls();
assert_eq!(calls.len(), 1);
@@ -971,9 +974,7 @@ async fn it_should_not_query_frecency() {
.collect())
})
});
- soup_mock
- .expect_populate_properties()
- .returning(|_, _| Box::pin(async { Ok(()) }));
+ soup_mock.expect_populate_properties().times(0);
let res = SoupImpl::new(
soup_mock,
@@ -1009,6 +1010,284 @@ async fn it_should_not_query_frecency() {
assert_eq!(res.items.len(), 10)
}
+#[tokio::test]
+async fn properties_are_populated_once_after_pagination() {
+ let mut soup_mock = MockSoupRepo::new();
+ soup_mock
+ .expect_unexpanded_generic_cursor_soup()
+ .times(1)
+ .returning(|_| {
+ Box::pin(async move {
+ Ok((0..100)
+ .map(|i| soup_document(&format!("document-{i}")))
+ .map(SoupItem::Document)
+ .collect())
+ })
+ });
+ soup_mock
+ .expect_populate_properties()
+ .withf(|user_id, items| user_id.as_ref() == "macro|[email protected]" && items.len() == 20)
+ .times(1)
+ .returning(|_, items| {
+ Box::pin(async move {
+ Ok(items
+ .into_iter()
+ .map(|item| item.map_extra(|()| SoupPropertiesField::default()))
+ .collect())
+ })
+ });
+
+ let res = SoupImpl::new(
+ soup_mock,
+ FrecencyQueryServiceImpl::new(MockFrecencyStorage::new()),
+ NoopEmailPreviewService,
+ NoopCommsService,
+ NoopCallRecordQueryService,
+ NoOpCrmService,
+ NoopForeignEntityService,
+ )
+ .get_user_soup_with_properties(
+ SoupRequest {
+ email_preview_view: PreviewView::StandardLabel(
+ email::domain::models::PreviewViewStandardLabel::Inbox,
+ ),
+ link_ids: vec![Uuid::new_v4()],
+ soup_type: SoupType::UnExpanded,
+ limit: 20,
+ cursor: SoupQuery::new_sort_simple(
+ SimpleSortMethod::ViewedUpdated,
+ EntityFilters::default(),
+ ),
+ user: MacroUserIdStr::parse_from_str("macro|[email protected]").unwrap(),
+ },
+ None,
+ )
+ .await
+ .unwrap()
+ .type_erase();
+
+ assert_eq!(res.items.len(), 20);
+ assert!(res.items.into_iter().all(|item| {
+ item.frecency_score.is_none()
+ && match item.item {
+ SoupItem::Document(document) => document.extra.properties.is_empty(),
+ _ => false,
+ }
+ }));
+}
+
+#[tokio::test]
+async fn frecency_is_populated_once_after_pagination() {
+ let mut soup_mock = MockSoupRepo::new();
+ soup_mock
+ .expect_unexpanded_generic_cursor_soup()
+ .times(1)
+ .returning(|_| {
+ Box::pin(async move {
+ Ok((0..100)
+ .map(|i| soup_document(&format!("document-{i}")))
+ .map(SoupItem::Document)
+ .collect())
+ })
+ });
+ soup_mock.expect_populate_properties().times(0);
+
+ let mut frecency = MockFrecencyQueryService::new();
+ frecency
+ .expect_get_frecencies_by_ids()
+ .withf(|request| {
+ request.user_id.as_ref() == "macro|[email protected]" && request.ids.len() == 20
+ })
+ .times(1)
+ .returning(|request| {
+ let scores = request.ids.iter().enumerate().map(|(index, entity)| {
+ AggregateFrecency::new_mock(
+ EntityType::Document.with_entity_string(entity.entity_id.to_string()),
+ index as f64 + 1.0,
+ )
+ });
+ let response = FrecencyPageResponse::new_mock(scores);
+ Box::pin(async move { Ok(response) })
+ });
+
+ let res = SoupImpl::new(
+ soup_mock,
+ frecency,
+ NoopEmailPreviewService,
+ NoopCommsService,
+ NoopCallRecordQueryService,
+ NoOpCrmService,
+ NoopForeignEntityService,
+ )
+ .get_user_soup_with_frecency(
+ SoupRequest {
+ email_preview_view: PreviewView::StandardLabel(
+ email::domain::models::PreviewViewStandardLabel::Inbox,
+ ),
+ link_ids: vec![Uuid::new_v4()],
+ soup_type: SoupType::UnExpanded,
+ limit: 20,
+ cursor: SoupQuery::new_sort_simple(
+ SimpleSortMethod::ViewedUpdated,
+ EntityFilters::default(),
+ ),
+ user: MacroUserIdStr::parse_from_str("macro|[email protected]").unwrap(),
+ },
+ None,
+ )
+ .await
+ .unwrap()
+ .type_erase();
+
+ assert_eq!(res.items.len(), 20);
+ assert!(res.items.iter().all(|item| item.frecency_score.is_some()));
+}
+
+#[tokio::test]
+async fn properties_and_frecency_are_composed_after_pagination() {
+ let mut soup_mock = MockSoupRepo::new();
+ soup_mock
+ .expect_unexpanded_generic_cursor_soup()
+ .times(1)
+ .returning(|_| {
+ Box::pin(async move { Ok(vec![SoupItem::Document(soup_document("document-1"))]) })
+ });
+ soup_mock
+ .expect_populate_properties()
+ .withf(|_, items| items.len() == 1)
+ .times(1)
+ .returning(|_, items| {
+ Box::pin(async move {
+ Ok(items
+ .into_iter()
+ .map(|item| item.map_extra(|()| SoupPropertiesField::default()))
+ .collect())
+ })
+ });
+
+ let mut frecency = MockFrecencyQueryService::new();
+ frecency
+ .expect_get_frecencies_by_ids()
+ .withf(|request| request.ids.len() == 1)
+ .times(1)
+ .returning(|request| {
+ let score = AggregateFrecency::new_mock(
+ EntityType::Document.with_entity_string(request.ids[0].entity_id.to_string()),
+ 42.0,
+ );
+ Box::pin(async move { Ok(FrecencyPageResponse::new_mock([score])) })
+ });
+
+ let res = SoupImpl::new(
+ soup_mock,
+ frecency,
+ NoopEmailPreviewService,
+ NoopCommsService,
+ NoopCallRecordQueryService,
+ NoOpCrmService,
+ NoopForeignEntityService,
+ )
+ .get_user_soup_with_properties_and_frecency(
+ SoupRequest {
+ email_preview_view: PreviewView::StandardLabel(
+ email::domain::models::PreviewViewStandardLabel::Inbox,
+ ),
+ link_ids: vec![Uuid::new_v4()],
+ soup_type: SoupType::UnExpanded,
+ limit: 20,
+ cursor: SoupQuery::new_sort_simple(
+ SimpleSortMethod::ViewedUpdated,
+ EntityFilters::default(),
+ ),
+ user: MacroUserIdStr::parse_from_str("macro|[email protected]").unwrap(),
+ },
+ None,
+ )
+ .await
+ .unwrap()
+ .type_erase();
+
+ assert_eq!(res.items.len(), 1);
+ assert_eq!(
+ res.items[0]
+ .frecency_score
+ .as_ref()
+ .map(|score| score.data.frecency_score),
+ Some(42.0)
+ );
+ assert!(match &res.items[0].item {
+ SoupItem::Document(document) => document.extra.properties.is_empty(),
+ _ => false,
+ });
+}
+
+#[tokio::test]
+async fn grouped_properties_are_populated_by_the_service() {
+ let mut soup_mock = MockSoupRepo::new();
+ soup_mock
+ .expect_expanded_grouped_cursor_soup()
+ .times(1)
+ .returning(|_| {
+ Box::pin(async move {
+ Ok(vec![GroupedSoupItem {
+ item: SoupItem::Document(soup_document("grouped-document")),
+ frecency_score: None,
+ group_key: "document".to_string(),
+ group_total_count: 1,
+ row_in_group: 1,
+ group_label: Some("Documents".to_string()),
+ group_display_order: Some(1),
+ }])
+ })
+ });
+ soup_mock
+ .expect_populate_properties()
+ .withf(|_, items| items.len() == 1)
+ .times(1)
+ .returning(|_, items| {
+ Box::pin(async move {
+ Ok(items
+ .into_iter()
+ .map(|item| item.map_extra(|()| SoupPropertiesField::default()))
+ .collect())
+ })
+ });
+
+ let service = SoupImpl::new(
+ soup_mock,
+ FrecencyQueryServiceImpl::new(MockFrecencyStorage::new()),
+ NoopEmailPreviewService,
+ NoopCommsService,
+ NoopCallRecordQueryService,
+ NoOpCrmService,
+ NoopForeignEntityService,
+ );
+ let items = service
+ .get_user_soup_grouped(GroupedSortRequest {
+ limit: 20,
+ cursor: Query::Sort(
+ SimpleSortMethod::ViewedUpdated,
+ EntityFilterAst::mock_empty(),
+ ),
+ user_id: MacroUserIdStr::parse_from_str("macro|[email protected]").unwrap(),
+ grouping: GroupingConfig {
+ field: GroupByField::EntityType,
+ group_key: None,
+ per_group_limit: None,
+ },
+ })
+ .await
+ .unwrap();
+
+ assert_eq!(items.len(), 1);
+ assert_eq!(items[0].group_key, "document");
+ assert_eq!(items[0].group_label.as_deref(), Some("Documents"));
+ assert!(match &items[0].item {
+ SoupItem::Document(document) => document.extra.properties.is_empty(),
+ _ => false,
+ });
+}
+
#[tokio::test]
async fn it_should_query_frecency() {
let mut frecency_mock = MockFrecencyStorage::new();
@@ -1155,7 +1434,7 @@ async fn it_should_sort_frecency_descending() {
NoOpCrmService,
NoopForeignEntityService,
)
- .get_user_soup(
+ .get_user_soup_with_frecency(
SoupRequest {
email_preview_view: PreviewView::StandardLabel(
email::domain::models::PreviewViewStandardLabel::Inbox,
@@ -1253,7 +1532,7 @@ async fn frecency_should_fallback() {
NoOpCrmService,
NoopForeignEntityService,
)
- .get_user_soup(
+ .get_user_soup_with_frecency(
SoupRequest {
email_preview_view: PreviewView::StandardLabel(
email::domain::models::PreviewViewStandardLabel::Inbox,
@@ -1335,7 +1614,7 @@ async fn frecency_should_paginate() {
NoOpCrmService,
NoopForeignEntityService,
)
- .get_user_soup(
+ .get_user_soup_with_frecency(
SoupRequest {
email_preview_view: PreviewView::StandardLabel(
email::domain::models::PreviewViewStandardLabel::Inbox,
@@ -1419,7 +1698,7 @@ async fn frecency_should_resume_cursor() {
NoOpCrmService,
NoopForeignEntityService,
)
- .get_user_soup(
+ .get_user_soup_with_frecency(
SoupRequest {
email_preview_view: PreviewView::StandardLabel(
email::domain::models::PreviewViewStandardLabel::Inbox,
@@ -1519,7 +1798,7 @@ async fn frecency_fallback_cursor_should_resume() {
NoOpCrmService,
NoopForeignEntityService,
)
- .get_user_soup(
+ .get_user_soup_with_frecency(
SoupRequest {
email_preview_view: PreviewView::StandardLabel(
email::domain::models::PreviewViewStandardLabel::Inbox,
@@ -1582,9 +1861,6 @@ async fn cursor_should_return_simple_sort() {
.collect();
Box::pin(async move { Ok(res) })
});
- soup_mock
- .expect_populate_properties()
- .returning(|_, _| Box::pin(async { Ok(()) }));
let res = SoupImpl::new(
soup_mock,
@@ -1693,9 +1969,9 @@ async fn cursor_should_return_frecency() {
})
}
-/// Helper to extract is_completed from a FrecencySoupItem
-fn get_is_completed(item: &FrecencySoupItem) -> Option<bool> {
- match &item.item {
+/// Helper to extract is_completed from a raw Soup item.
+fn get_is_completed(item: &SoupItem<()>) -> Option<bool> {
+ match item {
SoupItem::Document(doc) => doc.sub_type.as_ref().and_then(|st| st.is_task_completed()),
_ => None,
}
@@ -1716,9 +1992,6 @@ async fn it_should_return_is_completed_true_for_completed_tasks() {
))])
})
});
- soup_mock
- .expect_populate_properties()
- .returning(|_, _| Box::pin(async { Ok(()) }));
let res = SoupImpl::new(
soup_mock,
@@ -1768,9 +2041,6 @@ async fn it_should_return_is_completed_false_for_incomplete_tasks() {
))])
})
});
- soup_mock
- .expect_populate_properties()
- .returning(|_, _| Box::pin(async { Ok(()) }));
let res = SoupImpl::new(
soup_mock,
@@ -1820,9 +2090,6 @@ async fn it_should_return_is_completed_none_for_non_tasks() {
))])
})
});
- soup_mock
- .expect_populate_properties()
- .returning(|_, _| Box::pin(async { Ok(()) }));
let res = SoupImpl::new(
soup_mock,
@@ -1884,9 +2151,6 @@ async fn it_should_preserve_is_completed_for_mixed_items() {
])
})
});
- soup_mock
- .expect_populate_properties()
- .returning(|_, _| Box::pin(async { Ok(()) }));
let res = SoupImpl::new(
soup_mock,
diff --git a/crates/soup/src/inbound/axum_router.rs b/crates/soup/src/inbound/axum_router.rs
index acbefd9959..2217124e73 100644
--- a/crates/soup/src/inbound/axum_router.rs
+++ b/crates/soup/src/inbound/axum_router.rs
@@ -1,7 +1,8 @@
use crate::domain::{
models::{
- FrecencyQueryInner, FrecencySoupItem, GroupMeta, GroupedSortRequest, IntoSoupReqAst,
- SimpleQueryInner, SoupErr, SoupQuery, SoupRequest, SoupType, build_grouped_response,
+ EnrichedSoupItem, FrecencyQueryInner, GroupMeta, GroupedSortRequest, IntoSoupReqAst,
+ SimpleQueryInner, SoupErr, SoupItemWithProperties, SoupQuery, SoupRequest, SoupType,
+ build_grouped_response,
},
ports::SoupService,
};
@@ -53,7 +54,6 @@ use models_pagination::{
CursorWithValAndFilter, Frecency, PaginatedOpaqueCursor, SimpleSortMethod, SortMethod,
TypeEraseCursor,
};
-use models_soup::item::SoupItem;
use non_empty::IsEmpty;
use recursion::CollapsibleExt;
use rootcause::{Report, report};
@@ -496,7 +496,7 @@ where
// whatever membership the extractor resolved.
let res = self
.service
- .get_user_soup(
+ .get_user_soup_with_properties_and_frecency(
SoupRequest {
soup_type: match params.expand {
Some(true) | None => SoupType::Expanded,
@@ -600,17 +600,18 @@ where
#[derive(Debug, Serialize, utoipa::ToSchema)]
pub struct SoupApiItem {
#[serde(flatten)]
- item: SoupItem,
+ item: SoupItemWithProperties,
frecency_score: f64,
/// Whether the requesting user has favorited this entity.
is_favorited: bool,
}
impl SoupApiItem {
- fn from_frecency_soup_item(item: FrecencySoupItem) -> Self {
- let FrecencySoupItem {
+ fn from_frecency_soup_item(item: EnrichedSoupItem) -> Self {
+ let EnrichedSoupItem {
item,
frecency_score,
+ ..
} = item;
SoupApiItem {
item,
diff --git a/crates/soup/src/inbound/axum_router/tests.rs b/crates/soup/src/inbound/axum_router/tests.rs
index 206917fc60..64de6f5a49 100644
--- a/crates/soup/src/inbound/axum_router/tests.rs
+++ b/crates/soup/src/inbound/axum_router/tests.rs
@@ -27,8 +27,9 @@ use item_filters::ast::EntityFilterAst;
use crate::{
domain::{
models::{
- FrecencyQueryInner, GroupedSortRequest, GroupedSoupItem, IntoSoupReqAst,
- SimpleQueryInner, SoupErr, SoupQuery, SoupRequest, SoupType,
+ EnrichedSoupItem, FrecencyQueryInner, GroupedSortRequest, GroupedSoupItem,
+ IntoSoupReqAst, SimpleQueryInner, SoupErr, SoupPropertiesField, SoupQuery, SoupRequest,
+ SoupType,
},
ports::{SoupOutput, SoupService},
},
@@ -72,13 +73,61 @@ impl MockSoup {
impl SoupService for MockSoup {
async fn get_user_soup<T>(
&self,
- req: SoupRequest<T>,
+ _req: SoupRequest<T>,
_team_receipt: Option<
entity_access::domain::models::EntityAccessReceipt<
entity_access::domain::models::MemberTeamRole,
>,
>,
) -> Result<SoupOutput<T>, SoupErr>
+ where
+ SoupRequest<T>: IntoSoupReqAst,
+ T: Clone + Serialize + Send,
+ {
+ Err(SoupErr::SoupDbErr(anyhow::anyhow!("Not implemented")))
+ }
+
+ async fn get_user_soup_with_properties<T>(
+ &self,
+ _req: SoupRequest<T>,
+ _team_receipt: Option<
+ entity_access::domain::models::EntityAccessReceipt<
+ entity_access::domain::models::MemberTeamRole,
+ >,
+ >,
+ ) -> Result<SoupOutput<T, EnrichedSoupItem>, SoupErr>
+ where
+ SoupRequest<T>: IntoSoupReqAst,
+ T: Clone + Serialize + Send,
+ {
+ Err(SoupErr::SoupDbErr(anyhow::anyhow!("Not implemented")))
+ }
+
+ async fn get_user_soup_with_frecency<T>(
+ &self,
+ _req: SoupRequest<T>,
+ _team_receipt: Option<
+ entity_access::domain::models::EntityAccessReceipt<
+ entity_access::domain::models::MemberTeamRole,
+ >,
+ >,
+ ) -> Result<SoupOutput<T, EnrichedSoupItem>, SoupErr>
+ where
+ SoupRequest<T>: IntoSoupReqAst,
+ T: Clone + Serialize + Send,
+ {
+ Err(SoupErr::SoupDbErr(anyhow::anyhow!("Not implemented")))
+ }
+
+ async fn get_user_soup_with_properties_and_frecency<T>(
+ &self,
+ req: SoupRequest<T>,
+ _team_receipt: Option<
+ entity_access::domain::models::EntityAccessReceipt<
+ entity_access::domain::models::MemberTeamRole,
+ >,
+ >,
+ ) -> Result<SoupOutput<T, EnrichedSoupItem>, SoupErr>
where
SoupRequest<T>: IntoSoupReqAst,
T: Clone + Serialize + Send,
@@ -113,7 +162,7 @@ impl SoupService for MockSoup {
async fn get_user_soup_grouped(
&self,
_req: GroupedSortRequest<'_>,
- ) -> Result<Vec<GroupedSoupItem>, SoupErr> {
+ ) -> Result<Vec<GroupedSoupItem<SoupPropertiesField>>, SoupErr> {
Err(SoupErr::SoupDbErr(anyhow::anyhow!("Not implemented")))
}
diff --git a/crates/soup/src/inbound/toolset/list_entities.rs b/crates/soup/src/inbound/toolset/list_entities.rs
index 6f22c78316..02e50159f9 100644
--- a/crates/soup/src/inbound/toolset/list_entities.rs
+++ b/crates/soup/src/inbound/toolset/list_entities.rs
@@ -1,7 +1,7 @@
//! ListEntities tool for browsing workspace items.
use crate::domain::{
- models::{FrecencySoupItem, SoupQuery, SoupRequest, SoupType},
+ models::{EnrichedSoupItem, SoupPropertiesField, SoupQuery, SoupRequest, SoupType},
ports::SoupService,
};
use ai_toolset::{AsyncTool, RequestContext, ServiceContext, ToolCallError, ToolResult};
@@ -212,7 +212,10 @@ pub enum EntityItem {
}
impl EntityItem {
- pub(super) fn from_soup_item(item: SoupItem, tag_map: &HashMap<Uuid, AppliedTag>) -> Self {
+ pub(super) fn from_soup_item(
+ item: SoupItem<SoupPropertiesField>,
+ tag_map: &HashMap<Uuid, AppliedTag>,
+ ) -> Self {
match item {
SoupItem::Document(doc) => EntityItem::Document {
id: doc.id,
@@ -225,17 +228,17 @@ impl EntityItem {
}),
file_type: doc.file_type,
name: doc.name,
- tags: resolve_applied_tags(&doc.properties, tag_map),
+ tags: resolve_applied_tags(&doc.extra.properties, tag_map),
},
SoupItem::Chat(chat) => EntityItem::AiChat {
id: chat.id,
name: chat.name,
- tags: resolve_applied_tags(&chat.properties, tag_map),
+ tags: resolve_applied_tags(&chat.extra.properties, tag_map),
},
SoupItem::Project(project) => EntityItem::Project {
id: project.id,
name: project.name,
- tags: resolve_applied_tags(&project.properties, tag_map),
+ tags: resolve_applied_tags(&project.extra.properties, tag_map),
},
SoupItem::EmailThread(thread) => EntityItem::Email {
id: thread.thread.id,
@@ -246,7 +249,7 @@ impl EntityItem {
inbox_visible: thread.thread.inbox_visible,
is_read: thread.thread.is_read,
is_draft: thread.thread.is_draft,
- tags: resolve_applied_tags(&thread.properties, tag_map),
+ tags: resolve_applied_tags(&thread.extra.properties, tag_map),
},
SoupItem::Channel(channel) => EntityItem::Channel {
id: channel.channel.channel.id.0,
@@ -259,7 +262,7 @@ impl EntityItem {
SoupItem::Call(record) => EntityItem::Call {
id: record.call_id,
created_by: record.created_by,
- tags: resolve_applied_tags(&record.properties, tag_map),
+ tags: resolve_applied_tags(&record.extra.properties, tag_map),
},
// `entity_filter_ast` force-filters CrmCompany out — kept
// loud here so a contract break is obvious, not silent.
@@ -302,14 +305,14 @@ fn resolve_applied_tags(
}
/// True when any item carries a tag property that would need label resolution.
-fn any_item_has_tags(items: &[FrecencySoupItem]) -> bool {
- items.iter().any(|FrecencySoupItem { item, .. }| {
+fn any_item_has_tags(items: &[EnrichedSoupItem]) -> bool {
+ items.iter().any(|EnrichedSoupItem { item, .. }| {
let properties = match item {
- SoupItem::Document(doc) => &doc.properties,
- SoupItem::Chat(chat) => &chat.properties,
- SoupItem::Project(project) => &project.properties,
- SoupItem::EmailThread(thread) => &thread.properties,
- SoupItem::CrmCompany(company) => &company.properties,
+ SoupItem::Document(doc) => &doc.extra.properties,
+ SoupItem::Chat(chat) => &chat.extra.properties,
+ SoupItem::Project(project) => &project.extra.properties,
+ SoupItem::EmailThread(thread) => &thread.extra.properties,
+ SoupItem::CrmCompany(company) => &company.extra.properties,
SoupItem::Channel(_)
| SoupItem::ChannelThread(_)
| SoupItem::Call(_)
@@ -704,7 +707,7 @@ where
let result = service_context
.service
- .get_user_soup(
+ .get_user_soup_with_properties(
SoupRequest {
soup_type: SoupType::Expanded,
limit,
@@ -736,7 +739,7 @@ where
let items: Vec<EntityItem> = paginated
.items
.into_iter()
- .map(|FrecencySoupItem { item, .. }| EntityItem::from_soup_item(item, &tag_map))
+ .map(|EnrichedSoupItem { item, .. }| EntityItem::from_soup_item(item, &tag_map))
.collect();
// Build summary
diff --git a/crates/soup/src/inbound/toolset/test.rs b/crates/soup/src/inbound/toolset/test.rs
index b138ee9697..f4a44490ca 100644
--- a/crates/soup/src/inbound/toolset/test.rs
+++ b/crates/soup/src/inbound/toolset/test.rs
@@ -366,6 +366,7 @@ fn test_tag_filter_expr_ands_with_existing_propf() {
#[test]
fn test_from_soup_item_resolves_tags_via_caller_map() {
+ use crate::domain::models::SoupPropertiesField;
use macro_user_id::user_id::MacroUserIdStr;
use models_properties::service::property_definition::PropertyDefinition;
use models_properties::service::property_value::PropertyValue;
@@ -418,7 +419,7 @@ fn test_from_soup_item_resolves_tags_via_caller_map() {
viewed_at: None,
sub_type: None,
deleted_at: None,
- properties: vec![tag_property],
+ extra: SoupPropertiesField::new(vec![tag_property]),
};
let tag_map: HashMap<_, _> = [(
diff --git a/crates/soup/src/outbound/pg_soup_repo.rs b/crates/soup/src/outbound/pg_soup_repo.rs
index 70c8a0606e..37e284d0f0 100644
--- a/crates/soup/src/outbound/pg_soup_repo.rs
+++ b/crates/soup/src/outbound/pg_soup_repo.rs
@@ -2,7 +2,7 @@ use crate::{
domain::{
models::{
AdvancedSortParams, GroupedSortRequest, GroupedSoupItem, SimpleSortQuery,
- SimpleSortRequest,
+ SimpleSortRequest, SoupPropertiesField,
},
ports::SoupRepo,
},
@@ -39,7 +39,7 @@ impl SoupRepo for PgSoupRepo {
fn expanded_generic_cursor_soup<'a>(
&self,
req: SimpleSortRequest<'a>,
- ) -> impl Future<Output = Result<Vec<SoupItem>, Self::Err>> + Send {
+ ) -> impl Future<Output = Result<Vec<SoupItem<()>>, Self::Err>> + Send {
match req.cursor {
SimpleSortQuery::ItemsAndFrecencyFilter(query) => {
// Extract the EntityFilterAst from the tuple (Frecency, EntityFilterAst)
@@ -88,7 +88,7 @@ impl SoupRepo for PgSoupRepo {
fn unexpanded_generic_cursor_soup<'a>(
&self,
req: SimpleSortRequest<'a>,
- ) -> impl Future<Output = Result<Vec<SoupItem>, Self::Err>> + Send {
+ ) -> impl Future<Output = Result<Vec<SoupItem<()>>, Self::Err>> + Send {
match req.cursor {
SimpleSortQuery::ItemsFilter(_) => Either::Left(Either::Left(not_implemented(req))),
SimpleSortQuery::ItemsAndFrecencyFilter(_) => {
@@ -116,22 +116,22 @@ impl SoupRepo for PgSoupRepo {
fn expanded_soup_by_ids<'a>(
&self,
req: AdvancedSortParams<'a>,
- ) -> impl Future<Output = Result<Vec<SoupItem>, Self::Err>> + Send {
+ ) -> impl Future<Output = Result<Vec<SoupItem<()>>, Self::Err>> + Send {
expanded::by_ids::expanded_soup_by_ids(&self.pool.0, req.user_id, req.entities)
}
fn unexpanded_soup_by_ids<'a>(
&self,
req: AdvancedSortParams<'a>,
- ) -> impl Future<Output = Result<Vec<SoupItem>, Self::Err>> + Send {
+ ) -> impl Future<Output = Result<Vec<SoupItem<()>>, Self::Err>> + Send {
unexpanded::by_ids::unexpanded_soup_by_ids(&self.pool.0, req.user_id, req.entities)
}
fn populate_properties<'a>(
&self,
user_id: MacroUserIdStr<'a>,
- items: &'a mut [SoupItem],
- ) -> impl Future<Output = Result<(), Self::Err>> + Send {
+ items: Vec<SoupItem<()>>,
+ ) -> impl Future<Output = Result<Vec<SoupItem<SoupPropertiesField>>, Self::Err>> + Send {
populate_properties(&self.pool.0, user_id, items)
}
@@ -150,7 +150,7 @@ impl SoupRepo for PgSoupRepo {
fn expanded_grouped_cursor_soup<'a>(
&self,
req: GroupedSortRequest<'a>,
- ) -> impl Future<Output = Result<Vec<GroupedSoupItem>, Self::Err>> + Send {
+ ) -> impl Future<Output = Result<Vec<GroupedSoupItem<()>>, Self::Err>> + Send {
expanded::dynamic::expanded_dynamic_cursor_soup_grouped(
&self.pool.0,
GroupedDynamicCursorArgs {
@@ -178,25 +178,28 @@ fn type_err<E: std::fmt::Display>(e: E) -> sqlx::Error {
}
}
-/// Fetches and populates properties for a slice of SoupItems.
+/// Fetches properties and attaches them to raw Soup items.
///
-/// This helper collects entity references from items that support properties,
-/// fetches their properties in bulk, and assigns them to each item. System
-/// properties are always included, plus the caller's own and team tag properties.
-/// Tasks use `EntityType::Task` while regular documents use `EntityType::Document`.
+/// This helper collects entity references from items that support properties
+/// and performs one bulk lookup. System properties are always included, plus
+/// the caller's own and team tag properties. Tasks use `EntityType::Task` while
+/// regular documents use `EntityType::Document`.
#[tracing::instrument(err, skip(db, items))]
pub(crate) async fn populate_properties(
db: &sqlx::PgPool,
user_id: MacroUserIdStr<'_>,
- items: &mut [SoupItem],
-) -> Result<(), sqlx::Error> {
+ items: Vec<SoupItem<()>>,
+) -> Result<Vec<SoupItem<SoupPropertiesField>>, sqlx::Error> {
let entity_refs = items
.iter()
- .filter_map(|item| item.to_entity_reference())
+ .filter_map(SoupItem::to_entity_reference)
.collect::<Vec<_>>();
if entity_refs.is_empty() {
- return Ok(());
+ return Ok(items
+ .into_iter()
+ .map(|item| item.map_extra(|()| SoupPropertiesField::default()))
+ .collect());
}
let property_ids = SystemPropertyKey::all_system_property_keys();
@@ -210,35 +213,27 @@ pub(crate) async fn populate_properties(
.await
.map_err(|e| sqlx::Error::Decode(e.into()))?;
- // `items` may repeat an id (one row per group it belongs to), so use
- // `.get()` not `.remove()` — every occurrence needs the props.
- for item in items {
- let props = match item {
- SoupItem::Document(x) => properties_map.get(&x.id.to_string()),
- SoupItem::Project(x) => properties_map.get(&x.id.to_string()),
- SoupItem::EmailThread(x) => properties_map.get(&x.thread.id.to_string()),
- SoupItem::Chat(x) => properties_map.get(&x.id.to_string()),
- SoupItem::CrmCompany(x) => properties_map.get(&x.id.to_string()),
- SoupItem::Call(x) => properties_map.get(&x.call_id.to_string()),
- // Channels and foreign entities are not in entity_properties.
- SoupItem::Channel(_) | SoupItem::ChannelThread(_) | SoupItem::ForeignEntity(_) => None,
- };
- if let Some(props) = props {
- let soup_props: Vec<SoupProperty> =
- props.iter().cloned().map(SoupProperty::from).collect();
- match item {
- SoupItem::Document(x) => x.properties = soup_props,
- SoupItem::Project(x) => x.properties = soup_props,
- SoupItem::EmailThread(x) => x.properties = soup_props,
- SoupItem::Chat(x) => x.properties = soup_props,
- SoupItem::CrmCompany(x) => x.properties = soup_props,
- SoupItem::Call(x) => x.properties = soup_props,
- SoupItem::Channel(_) | SoupItem::ChannelThread(_) | SoupItem::ForeignEntity(_) => {}
+ // Items may repeat an id when grouped, so use `get` rather than `remove`.
+ Ok(items
+ .into_iter()
+ .map(|item| {
+ let properties = match &item {
+ SoupItem::Document(x) => properties_map.get(&x.id.to_string()),
+ SoupItem::Project(x) => properties_map.get(&x.id.to_string()),
+ SoupItem::EmailThread(x) => properties_map.get(&x.thread.id.to_string()),
+ SoupItem::Chat(x) => properties_map.get(&x.id.to_string()),
+ SoupItem::CrmCompany(x) => properties_map.get(&x.id.to_string()),
+ SoupItem::Call(x) => properties_map.get(&x.call_id.to_string()),
+ SoupItem::Channel(_) | SoupItem::ChannelThread(_) | SoupItem::ForeignEntity(_) => {
+ None
+ }
}
- }
- }
+ .map(|properties| properties.iter().cloned().map(SoupProperty::from).collect())
+ .unwrap_or_default();
- Ok(())
+ item.map_extra(|()| SoupPropertiesField::new(properties))
+ })
+ .collect())
}
/// this defines a macro which maps the soup query types for statically checked soup queries
@@ -282,7 +277,7 @@ macro_rules! map_soup_type {
r.is_completed,
),
deleted_at: r.deleted_at,
- properties: Default::default(),
+ extra: (),
},
)),
"chat" => Ok(::models_soup::item::SoupItem::Chat(
@@ -303,7 +298,7 @@ macro_rules! map_soup_type {
updated_at: r.updated_at,
viewed_at: r.viewed_at,
deleted_at: r.deleted_at,
- properties: Default::default(),
+ extra: (),
},
)),
"project" => Ok(::models_soup::item::SoupItem::Project(
@@ -323,7 +318,7 @@ macro_rules! map_soup_type {
updated_at: r.updated_at,
viewed_at: r.viewed_at,
deleted_at: r.deleted_at,
- properties: Default::default(),
+ extra: (),
},
)),
_ => Err(sqlx::Error::TypeNotFound {
diff --git a/crates/soup/src/outbound/pg_soup_repo/expanded/by_cursor.rs b/crates/soup/src/outbound/pg_soup_repo/expanded/by_cursor.rs
index 3d20a2c9a1..8e5b226e2b 100644
--- a/crates/soup/src/outbound/pg_soup_repo/expanded/by_cursor.rs
+++ b/crates/soup/src/outbound/pg_soup_repo/expanded/by_cursor.rs
@@ -1,5 +1,5 @@
use crate::map_soup_type;
-use crate::outbound::pg_soup_repo::{populate_properties, type_err};
+use crate::outbound::pg_soup_repo::type_err;
use document_sub_type::DocumentSubType;
use macro_user_id::cowlike::CowLike;
use macro_user_id::user_id::MacroUserIdStr;
@@ -23,7 +23,7 @@ pub async fn expanded_generic_cursor_soup(
user_id: MacroUserIdStr<'_>,
limit: u16,
cursor: Query<Uuid, SimpleSortMethod, ()>,
-) -> Result<Vec<SoupItem>, sqlx::Error> {
+) -> Result<Vec<SoupItem<()>>, sqlx::Error> {
let query_limit = limit as i64;
let sort_method_str = cursor.sort_method().to_string();
let (cursor_id, cursor_timestamp) = cursor.vals();
@@ -32,7 +32,7 @@ pub async fn expanded_generic_cursor_soup(
let status_property_id = SystemPropertyKey::STATUS_UUID;
let completed_option_id = StatusOption::COMPLETED_UUID.to_string();
- let mut items: Vec<SoupItem> = sqlx::query!(
+ let items: Vec<SoupItem<()>> = sqlx::query!(
r#"
-- =============================================================================
-- EXPANDED GENERIC CURSOR SOUP QUERY
@@ -258,8 +258,6 @@ r#"
.fetch_all(db)
.await?;
- populate_properties(db, user_id.copied(), &mut items).await?;
-
Ok(items)
}
@@ -271,7 +269,7 @@ pub async fn no_frecency_expanded_generic_soup(
user_id: MacroUserIdStr<'_>,
limit: u16,
cursor: Query<Uuid, SimpleSortMethod, Frecency>,
-) -> Result<Vec<SoupItem>, sqlx::Error> {
+) -> Result<Vec<SoupItem<()>>, sqlx::Error> {
let query_limit = limit as i64;
let sort_method_str = cursor.sort_method().to_string();
let (cursor_id, cursor_timestamp) = cursor.vals();
@@ -280,7 +278,7 @@ pub async fn no_frecency_expanded_generic_soup(
let status_property_id = SystemPropertyKey::STATUS_UUID;
let completed_option_id = StatusOption::COMPLETED_UUID.to_string();
- let mut items: Vec<SoupItem> = sqlx::query!(
+ let items: Vec<SoupItem<()>> = sqlx::query!(
r#"
WITH user_source_ids AS (
SELECT cp.channel_id::text as source_id FROM comms_channel_participants cp
@@ -452,7 +450,5 @@ r#"
.fetch_all(db)
.await?;
- populate_properties(db, user_id.copied(), &mut items).await?;
-
Ok(items)
}
diff --git a/crates/soup/src/outbound/pg_soup_repo/expanded/by_ids.rs b/crates/soup/src/outbound/pg_soup_repo/expanded/by_ids.rs
index 83fd05422b..5432c6264f 100644
--- a/crates/soup/src/outbound/pg_soup_repo/expanded/by_ids.rs
+++ b/crates/soup/src/outbound/pg_soup_repo/expanded/by_ids.rs
@@ -1,7 +1,4 @@
-use crate::{
- map_soup_type,
- outbound::pg_soup_repo::{populate_properties, type_err},
-};
+use crate::{map_soup_type, outbound::pg_soup_repo::type_err};
use document_sub_type::DocumentSubType;
use macro_user_id::{cowlike::CowLike, user_id::MacroUserIdStr};
use model_entity::{Entity, EntityType};
@@ -23,7 +20,7 @@ pub async fn expanded_soup_by_ids<'a>(
db: &PgPool,
user_id: MacroUserIdStr<'_>,
entities: impl IntoIterator<Item = &'a Entity<'a>>,
-) -> Result<Vec<SoupItem>, sqlx::Error> {
+) -> Result<Vec<SoupItem<()>>, sqlx::Error> {
let mut document_ids = Vec::new();
let mut chat_ids = Vec::new();
@@ -41,7 +38,7 @@ pub async fn expanded_soup_by_ids<'a>(
let status_property_id = SystemPropertyKey::STATUS_UUID;
let completed_option_id = StatusOption::COMPLETED_UUID.to_string();
- let mut items: Vec<SoupItem> = sqlx::query!(
+ let items: Vec<SoupItem<()>> = sqlx::query!(
r#"
WITH user_source_ids AS (
SELECT cp.channel_id::text as source_id FROM comms_channel_participants cp
@@ -162,7 +159,5 @@ pub async fn expanded_soup_by_ids<'a>(
.fetch_all(db)
.await?;
- populate_properties(db, user_id.copied(), &mut items).await?;
-
Ok(items)
}
diff --git a/crates/soup/src/outbound/pg_soup_repo/expanded/dynamic.rs b/crates/soup/src/outbound/pg_soup_repo/expanded/dynamic.rs
index 6bdbf3b34c..13ae9ba58e 100644
--- a/crates/soup/src/outbound/pg_soup_repo/expanded/dynamic.rs
+++ b/crates/soup/src/outbound/pg_soup_repo/expanded/dynamic.rs
@@ -31,7 +31,7 @@ use crate::domain::models::GroupedSoupItem;
use crate::outbound::pg_soup_repo::grouping::{
GroupJoinClause, group_join_clause, group_select_expr,
};
-use crate::outbound::pg_soup_repo::{populate_properties, type_err};
+use crate::outbound::pg_soup_repo::type_err;
use models_grouping::{GroupByField, GroupingConfig, date_bucket_sql_order};
static PREFIX: &str = r#"
@@ -1435,7 +1435,7 @@ impl<'a> FromRow<'a, PgRow> for SoupRow {
}
impl SoupRow {
- fn into_soup_item(self) -> Result<SoupItem, sqlx::Error> {
+ fn into_soup_item(self) -> Result<SoupItem<()>, sqlx::Error> {
Ok(match self {
SoupRow::Document(DocumentRow {
id,
@@ -1482,7 +1482,7 @@ impl SoupRow {
viewed_at,
sub_type: SoupDocumentSubType::from_db(sub_type, is_completed),
deleted_at,
- properties: Default::default(),
+ extra: (),
}),
SoupRow::Chat(ChatRow {
id,
@@ -1510,7 +1510,7 @@ impl SoupRow {
updated_at,
viewed_at,
deleted_at,
- properties: Default::default(),
+ extra: (),
}),
SoupRow::Project(ProjectRow {
id,
@@ -1536,7 +1536,7 @@ impl SoupRow {
updated_at,
viewed_at,
deleted_at,
- properties: Default::default(),
+ extra: (),
}),
})
}
@@ -1559,7 +1559,7 @@ pub(crate) struct ExpandedDynamicCursorArgs<'a> {
pub(crate) async fn expanded_dynamic_cursor_soup(
db: &PgPool,
args: ExpandedDynamicCursorArgs<'_>,
-) -> Result<Vec<SoupItem>, sqlx::Error> {
+) -> Result<Vec<SoupItem<()>>, sqlx::Error> {
let ExpandedDynamicCursorArgs {
user_id,
limit,
@@ -1574,7 +1574,7 @@ pub(crate) async fn expanded_dynamic_cursor_soup(
let assignees_property_id = SystemPropertyKey::ASSIGNEES_UUID;
let completed_option_id = StatusOption::COMPLETED_UUID.to_string();
- let mut items = build_query(cursor.filter(), exclude_frecency, *cursor.sort_method())
+ let items = build_query(cursor.filter(), exclude_frecency, *cursor.sort_method())
.build()
.bind(user_id.as_ref())
.bind(sort_method_str)
@@ -1595,8 +1595,6 @@ pub(crate) async fn expanded_dynamic_cursor_soup(
.fetch_all(db)
.await?;
- populate_properties(db, user_id.copied(), &mut items).await?;
-
Ok(items)
}
@@ -1884,7 +1882,7 @@ fn build_grouped_query<'a>(
pub async fn expanded_dynamic_cursor_soup_grouped(
db: &PgPool,
args: GroupedDynamicCursorArgs<'_>,
-) -> Result<Vec<GroupedSoupItem>, sqlx::Error> {
+) -> Result<Vec<GroupedSoupItem<()>>, sqlx::Error> {
let GroupedDynamicCursorArgs {
user_id,
limit,
@@ -1932,7 +1930,7 @@ pub async fn expanded_dynamic_cursor_soup_grouped(
.await?;
// Convert rows to (SoupItem, GroupFields) pairs and unzip
- let (mut soup_items, groups): (Vec<SoupItem>, Vec<GroupFields>) = rows
+ let (soup_items, groups): (Vec<SoupItem<()>>, Vec<GroupFields>) = rows
.into_iter()
.map(|row| {
let item = row.item.into_soup_item()?;
@@ -1942,8 +1940,6 @@ pub async fn expanded_dynamic_cursor_soup_grouped(
.into_iter()
.unzip();
- populate_properties(db, user_id.copied(), &mut soup_items).await?;
-
let items = soup_items
.into_iter()
.zip(groups)
diff --git a/crates/soup/src/outbound/pg_soup_repo/expanded/tests.rs b/crates/soup/src/outbound/pg_soup_repo/expanded/tests.rs
index 92f266046a..21bbe1450f 100644
--- a/crates/soup/src/outbound/pg_soup_repo/expanded/tests.rs
+++ b/crates/soup/src/outbound/pg_soup_repo/expanded/tests.rs
@@ -1,7 +1,10 @@
-use crate::outbound::pg_soup_repo::expanded::{
- by_cursor::{expanded_generic_cursor_soup, no_frecency_expanded_generic_soup},
- by_ids::expanded_soup_by_ids,
- dynamic::{ExpandedDynamicCursorArgs, expanded_dynamic_cursor_soup},
+use crate::outbound::pg_soup_repo::{
+ expanded::{
+ by_cursor::{expanded_generic_cursor_soup, no_frecency_expanded_generic_soup},
+ by_ids::expanded_soup_by_ids,
+ dynamic::{ExpandedDynamicCursorArgs, expanded_dynamic_cursor_soup},
+ },
+ populate_properties,
};
use filter_ast::Expr;
use item_filters::{
@@ -2585,7 +2588,7 @@ async fn test_filter_projects_by_importance(db: PgPool) -> anyhow::Result<()> {
scripts("soup_items_with_properties")
)
)]
-async fn test_expanded_dynamic_cursor_populates_properties(
+async fn test_bulk_populate_properties_enriches_raw_soup_items(
pool: Pool<Postgres>,
) -> anyhow::Result<()> {
let user_id = MacroUserIdStr::parse_from_str("macro|[email protected]").unwrap();
@@ -2600,6 +2603,7 @@ async fn test_expanded_dynamic_cursor_populates_properties(
},
)
.await?;
+ let items = populate_properties(&pool, user_id, items).await?;
// Should get 2 documents and 2 projects (A and B)
assert!(!items.is_empty(), "Should return some items");
@@ -2613,7 +2617,7 @@ async fn test_expanded_dynamic_cursor_populates_properties(
let doc = unwrap_enum!(doc_a, SoupItem::Document);
assert_eq!(
- doc.properties.len(),
+ doc.extra.properties.len(),
2,
"Document in A should have 2 properties"
);
@@ -2626,7 +2630,7 @@ async fn test_expanded_dynamic_cursor_populates_properties(
let doc = unwrap_enum!(doc_b, Some => SoupItem::Document);
// Document in B has Priority and Due Date properties
assert_eq!(
- doc.properties.len(),
+ doc.extra.properties.len(),
2,
"Document in B should have 2 properties"
);
@@ -2638,11 +2642,15 @@ async fn test_expanded_dynamic_cursor_populates_properties(
let proj = unwrap_enum!(proj_a, Some => SoupItem::Project);
assert!(
- !proj.properties.is_empty(),
+ !proj.extra.properties.is_empty(),
"Project A should have properties populated"
);
// Project A has Priority property
- assert_eq!(proj.properties.len(), 1, "Project A should have 1 property");
+ assert_eq!(
+ proj.extra.properties.len(),
+ 1,
+ "Project A should have 1 property"
+ );
// Check that Project B has no properties (none were added in fixture)
let proj_b_uuid = Uuid::parse_str("bbbbbbbb-ffff-ffff-ffff-ffffffffffff").unwrap();
@@ -2651,7 +2659,7 @@ async fn test_expanded_dynamic_cursor_populates_properties(
let proj = unwrap_enum!(proj_b, Some => SoupItem::Project);
// Project B has no properties in the fixture, so it should be empty or None
- let props_count = proj.properties.len();
+ let props_count = proj.extra.properties.len();
assert_eq!(props_count, 0, "Project B should have 0 properties");
Ok(())
diff --git a/crates/soup/src/outbound/pg_soup_repo/unexpanded/by_cursor.rs b/crates/soup/src/outbound/pg_soup_repo/unexpanded/by_cursor.rs
index 7170aaa0e0..48f155eaeb 100644
--- a/crates/soup/src/outbound/pg_soup_repo/unexpanded/by_cursor.rs
+++ b/crates/soup/src/outbound/pg_soup_repo/unexpanded/by_cursor.rs
@@ -1,7 +1,4 @@
-use crate::{
- map_soup_type,
- outbound::pg_soup_repo::{populate_properties, type_err},
-};
+use crate::{map_soup_type, outbound::pg_soup_repo::type_err};
use document_sub_type::DocumentSubType;
use macro_user_id::{cowlike::CowLike, user_id::MacroUserIdStr};
use models_pagination::{Query, SimpleSortMethod};
@@ -24,7 +21,7 @@ pub async fn unexpanded_generic_cursor_soup(
user_id: MacroUserIdStr<'_>,
limit: u16,
cursor: Query<Uuid, SimpleSortMethod, ()>,
-) -> Result<Vec<SoupItem>, sqlx::Error> {
+) -> Result<Vec<SoupItem<()>>, sqlx::Error> {
let query_limit = limit as i64;
let sort_method_str = cursor.sort_method().to_string();
let (cursor_id, cursor_timestamp) = cursor.vals();
@@ -33,7 +30,7 @@ pub async fn unexpanded_generic_cursor_soup(
let status_property_id = SystemPropertyKey::STATUS_UUID;
let completed_option_id = StatusOption::COMPLETED_UUID.to_string();
- let mut items: Vec<SoupItem> = sqlx::query!(
+ let items: Vec<SoupItem<()>> = sqlx::query!(
r#"
WITH user_source_ids AS (
SELECT cp.channel_id::text as source_id FROM comms_channel_participants cp
@@ -207,7 +204,5 @@ pub async fn unexpanded_generic_cursor_soup(
.fetch_all(db)
.await?;
- populate_properties(db, user_id.copied(), &mut items).await?;
-
Ok(items)
}
diff --git a/crates/soup/src/outbound/pg_soup_repo/unexpanded/by_ids.rs b/crates/soup/src/outbound/pg_soup_repo/unexpanded/by_ids.rs
index 9de869d11a..79a12a5108 100644
--- a/crates/soup/src/outbound/pg_soup_repo/unexpanded/by_ids.rs
+++ b/crates/soup/src/outbound/pg_soup_repo/unexpanded/by_ids.rs
@@ -1,7 +1,4 @@
-use crate::{
- map_soup_type,
- outbound::pg_soup_repo::{populate_properties, type_err},
-};
+use crate::{map_soup_type, outbound::pg_soup_repo::type_err};
use document_sub_type::DocumentSubType;
use macro_user_id::{cowlike::CowLike, user_id::MacroUserIdStr};
use model_entity::{Entity, EntityType};
@@ -23,7 +20,7 @@ pub async fn unexpanded_soup_by_ids<'a>(
db: &PgPool,
user_id: MacroUserIdStr<'_>,
entities: impl IntoIterator<Item = &'a Entity<'a>>,
-) -> Result<Vec<SoupItem>, sqlx::Error> {
+) -> Result<Vec<SoupItem<()>>, sqlx::Error> {
let mut document_ids = Vec::new();
let mut chat_ids = Vec::new();
let mut project_ids = Vec::new();
@@ -42,7 +39,7 @@ pub async fn unexpanded_soup_by_ids<'a>(
let status_property_id = SystemPropertyKey::STATUS_UUID;
let completed_option_id = StatusOption::COMPLETED_UUID.to_string();
- let mut items: Vec<SoupItem> = sqlx::query!(
+ let items: Vec<SoupItem<()>> = sqlx::query!(
r#"
WITH user_source_ids AS (
SELECT cp.channel_id::text as source_id FROM comms_channel_participants cp
@@ -199,7 +196,5 @@ pub async fn unexpanded_soup_by_ids<'a>(
.fetch_all(db)
.await?;
- populate_properties(db, user_id.copied(), &mut items).await?;
-
Ok(items)
}
diff --git a/services/document_storage_service/src/api/swagger.rs b/services/document_storage_service/src/api/swagger.rs
index 977dcae0af..f685547f10 100644
--- a/services/document_storage_service/src/api/swagger.rs
+++ b/services/document_storage_service/src/api/swagger.rs
@@ -124,8 +124,8 @@ use models_soup::email_thread::{
SoupLabelListVisibility, SoupLabelType, SoupMessageListVisibility,
};
use models_soup::foreign_entity::SoupForeignEntity;
-use models_soup::item::SoupItem;
use models_soup::project::SoupProject;
+use soup::domain::models::{SoupItemWithProperties, SoupPropertiesField};
use soup::inbound::axum_router::{
ApiGroupByField, ApiGroupMeta, GroupedSoupGroupPage, GroupedSoupInitialPage, GroupedSoupPage,
PostGroupedSoupAstGroupPageRequest, PostGroupedSoupAstInitialRequest,
@@ -405,11 +405,12 @@ use utoipa::OpenApi;
DocumentPermissionsTokenRequest,
ExportDocumentResponse,
SyncServiceVersionID,
- SoupItem,
+ SoupItemWithProperties,
SoupApiItem,
- SoupDocument,
- SoupChat,
- SoupProject,
+ SoupDocument<SoupPropertiesField>,
+ SoupChat<SoupPropertiesField>,
+ SoupProject<SoupPropertiesField>,
+ SoupPropertiesField,
SoupForeignEntity,
ForeignEntity,
Favorite,
@@ -419,7 +420,7 @@ use utoipa::OpenApi;
ReorderFavoritesRequest,
SoupApiSort,
SoupPage,
- SoupEnrichedEmailThreadPreview,
+ SoupEnrichedEmailThreadPreview<SoupPropertiesField>,
SoupEmailThreadPreview,
SoupAttachment,
SoupContact,
@@ -521,7 +522,7 @@ use utoipa::OpenApi;
call::domain::models::GetBatchCallRecordPreviewResponse,
call::domain::models::RingStatus,
call::domain::models::RingStatusResponse,
- SoupCallRecord,
+ SoupCallRecord<SoupPropertiesField>,
SoupCallRecordParticipant,
// Webhooks