Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
feat(properties): add properties to soup queries. (#952)
cowlicks9c044c8fd94e
diff --git a/js/app/packages/core/constant/servers.ts b/js/app/packages/core/constant/servers.tsindex 76915a2ee1..71ef4e9210 100644--- a/js/app/packages/core/constant/servers.ts+++ b/js/app/packages/core/constant/servers.ts@@ -23,7 +23,8 @@ const devServerSuffix = import.meta.env.MODE === 'development' ? '-dev' : '';const serverHostRemote = {'auth-service': `https://auth-service${devServerSuffix}.macro.com`,'pdf-service': `https://pdf-service${devServerSuffix}.macro.com`,- 'document-storage-service': `https://cloud-storage${devServerSuffix}.macro.com`,+ // 'document-storage-service': `https://cloud-storage${devServerSuffix}.macro.com`,+ 'document-storage-service': `http://localhost:8083`,'websocket-service': `wss://services${devServerSuffix}.macro.com`,'cognition-service': `https://document-cognition${devServerSuffix}.macro.com`,'cognition-websocket-service': `wss://document-cognition${devServerSuffix}.macro.com`,diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/dataType.ts b/js/app/packages/service-clients/service-storage/generated/schemas/dataType.tsnew file mode 100644index 0000000000..90bfbafcc2--- /dev/null+++ b/js/app/packages/service-clients/service-storage/generated/schemas/dataType.ts@@ -0,0 +1,23 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * document_storage_service+ * OpenAPI spec version: 0.1.0+ */++/**+ * Data type for property values, determining storage and validation.+ */+export type DataType = (typeof DataType)[keyof typeof DataType];++// eslint-disable-next-line @typescript-eslint/no-redeclare+export const DataType = {+ BOOLEAN: 'BOOLEAN',+ DATE: 'DATE',+ NUMBER: 'NUMBER',+ STRING: 'STRING',+ SELECT_NUMBER: 'SELECT_NUMBER',+ SELECT_STRING: 'SELECT_STRING',+ ENTITY: 'ENTITY',+ LINK: 'LINK',+} as const;diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/index.ts b/js/app/packages/service-clients/service-storage/generated/schemas/index.tsindex 36efedee58..42411a6346 100644--- a/js/app/packages/service-clients/service-storage/generated/schemas/index.ts+++ b/js/app/packages/service-clients/service-storage/generated/schemas/index.ts@@ -133,6 +133,7 @@ export * from './createUnthreadedPdfAnchorRequestOneOf';export * from './createUnthreadedPdfAnchorRequestOneOfAllOf';export * from './createUnthreadedPdfAnchorRequestOneOfAllOfAnchorType';export * from './createViewRequest';+export * from './dataType';export * from './deleteAnchorInfo';export * from './deleteAnchorInfoAllOf';export * from './deleteCommentRequest';@@ -379,7 +380,33 @@ export * from './projectPreviewOneOfSeven';export * from './projectPreviewOneOfSevenAllOf';export * from './projectPreviewOneOfSevenAllOfAccess';export * from './projectType';+export * from './propertyDefinition';+export * from './propertyDefinitionSpecificEntityType';export * from './propertyInput';+export * from './propertyOwner';+export * from './propertyOwnerOneOf';+export * from './propertyOwnerOneOfFive';+export * from './propertyOwnerOneOfFiveScope';+export * from './propertyOwnerOneOfScope';+export * from './propertyOwnerOneOfSeven';+export * from './propertyOwnerOneOfSevenScope';+export * from './propertyOwnerOneOfThree';+export * from './propertyOwnerOneOfThreeScope';+export * from './propertyValue';+export * from './propertyValueOneOf';+export * from './propertyValueOneOfFive';+export * from './propertyValueOneOfFiveType';+export * from './propertyValueOneOfNine';+export * from './propertyValueOneOfNineType';+export * from './propertyValueOneOfOneone';+export * from './propertyValueOneOfOneoneType';+export * from './propertyValueOneOfOnethree';+export * from './propertyValueOneOfOnethreeType';+export * from './propertyValueOneOfSeven';+export * from './propertyValueOneOfSevenType';+export * from './propertyValueOneOfThree';+export * from './propertyValueOneOfThreeType';+export * from './propertyValueOneOfType';export * from './recentlyDeletedResponseData';export * from './reorderPinRequest';export * from './s3ObjectInfo';@@ -478,6 +505,8 @@ export * from './soupPageNextCursor';export * from './soupProject';export * from './soupProjectParentId';export * from './soupProjectViewedAt';+export * from './soupProperty';+export * from './soupPropertyValue';export * from './successResponse';export * from './syncServiceVersionID';export * from './thread';diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/propertyDefinition.ts b/js/app/packages/service-clients/service-storage/generated/schemas/propertyDefinition.tsnew file mode 100644index 0000000000..39eee3117a--- /dev/null+++ b/js/app/packages/service-clients/service-storage/generated/schemas/propertyDefinition.ts@@ -0,0 +1,28 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * document_storage_service+ * OpenAPI spec version: 0.1.0+ */+import type { DataType } from './dataType';+import type { PropertyDefinitionSpecificEntityType } from './propertyDefinitionSpecificEntityType';+import type { PropertyOwner } from './propertyOwner';++/**+ * Property definition model (service representation).+ */+export interface PropertyDefinition {+ created_at: string;+ data_type: DataType;+ display_name: string;+ id: string;+ /** Flag to indicate if this is a system-generated metadata property.+Not stored in database - computed at service layer. */+ is_metadata: boolean;+ is_multi_select: boolean;+ /** Flag to indicate if this is a system property (stored in DB). */+ is_system: boolean;+ owner: PropertyOwner;+ specific_entity_type?: PropertyDefinitionSpecificEntityType;+ updated_at: string;+}diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/propertyDefinitionSpecificEntityType.ts b/js/app/packages/service-clients/service-storage/generated/schemas/propertyDefinitionSpecificEntityType.tsnew file mode 100644index 0000000000..60e4de9281--- /dev/null+++ b/js/app/packages/service-clients/service-storage/generated/schemas/propertyDefinitionSpecificEntityType.ts@@ -0,0 +1,9 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * document_storage_service+ * OpenAPI spec version: 0.1.0+ */+import type { EntityType } from './entityType';++export type PropertyDefinitionSpecificEntityType = null | EntityType;diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/propertyOwner.ts b/js/app/packages/service-clients/service-storage/generated/schemas/propertyOwner.tsnew file mode 100644index 0000000000..ff5804f180--- /dev/null+++ b/js/app/packages/service-clients/service-storage/generated/schemas/propertyOwner.ts@@ -0,0 +1,19 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * document_storage_service+ * OpenAPI spec version: 0.1.0+ */+import type { PropertyOwnerOneOf } from './propertyOwnerOneOf';+import type { PropertyOwnerOneOfFive } from './propertyOwnerOneOfFive';+import type { PropertyOwnerOneOfSeven } from './propertyOwnerOneOfSeven';+import type { PropertyOwnerOneOfThree } from './propertyOwnerOneOfThree';++/**+ * Defines who owns a property - user-scoped, org-scoped, system, or both user and org.+ */+export type PropertyOwner =+ | PropertyOwnerOneOf+ | PropertyOwnerOneOfThree+ | PropertyOwnerOneOfFive+ | PropertyOwnerOneOfSeven;diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/propertyOwnerOneOf.ts b/js/app/packages/service-clients/service-storage/generated/schemas/propertyOwnerOneOf.tsnew file mode 100644index 0000000000..f78048e87c--- /dev/null+++ b/js/app/packages/service-clients/service-storage/generated/schemas/propertyOwnerOneOf.ts@@ -0,0 +1,15 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * document_storage_service+ * OpenAPI spec version: 0.1.0+ */+import type { PropertyOwnerOneOfScope } from './propertyOwnerOneOfScope';++/**+ * User-scoped property only+ */+export type PropertyOwnerOneOf = {+ scope: PropertyOwnerOneOfScope;+ user_id: string;+};diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/propertyOwnerOneOfFive.ts b/js/app/packages/service-clients/service-storage/generated/schemas/propertyOwnerOneOfFive.tsnew file mode 100644index 0000000000..8b2171dd5d--- /dev/null+++ b/js/app/packages/service-clients/service-storage/generated/schemas/propertyOwnerOneOfFive.ts@@ -0,0 +1,16 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * document_storage_service+ * OpenAPI spec version: 0.1.0+ */+import type { PropertyOwnerOneOfFiveScope } from './propertyOwnerOneOfFiveScope';++/**+ * Both user and organization-scoped+ */+export type PropertyOwnerOneOfFive = {+ organization_id: number;+ scope: PropertyOwnerOneOfFiveScope;+ user_id: string;+};diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/propertyOwnerOneOfFiveScope.ts b/js/app/packages/service-clients/service-storage/generated/schemas/propertyOwnerOneOfFiveScope.tsnew file mode 100644index 0000000000..87e70c64ce--- /dev/null+++ b/js/app/packages/service-clients/service-storage/generated/schemas/propertyOwnerOneOfFiveScope.ts@@ -0,0 +1,14 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * document_storage_service+ * OpenAPI spec version: 0.1.0+ */++export type PropertyOwnerOneOfFiveScope =+ (typeof PropertyOwnerOneOfFiveScope)[keyof typeof PropertyOwnerOneOfFiveScope];++// eslint-disable-next-line @typescript-eslint/no-redeclare+export const PropertyOwnerOneOfFiveScope = {+ user_and_organization: 'user_and_organization',+} as const;diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/propertyOwnerOneOfScope.ts b/js/app/packages/service-clients/service-storage/generated/schemas/propertyOwnerOneOfScope.tsnew file mode 100644index 0000000000..fe7d1c1e38--- /dev/null+++ b/js/app/packages/service-clients/service-storage/generated/schemas/propertyOwnerOneOfScope.ts@@ -0,0 +1,14 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * document_storage_service+ * OpenAPI spec version: 0.1.0+ */++export type PropertyOwnerOneOfScope =+ (typeof PropertyOwnerOneOfScope)[keyof typeof PropertyOwnerOneOfScope];++// eslint-disable-next-line @typescript-eslint/no-redeclare+export const PropertyOwnerOneOfScope = {+ user: 'user',+} as const;diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/propertyOwnerOneOfSeven.ts b/js/app/packages/service-clients/service-storage/generated/schemas/propertyOwnerOneOfSeven.tsnew file mode 100644index 0000000000..ae5a64ee51--- /dev/null+++ b/js/app/packages/service-clients/service-storage/generated/schemas/propertyOwnerOneOfSeven.ts@@ -0,0 +1,14 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * document_storage_service+ * OpenAPI spec version: 0.1.0+ */+import type { PropertyOwnerOneOfSevenScope } from './propertyOwnerOneOfSevenScope';++/**+ * System-owned property (no user or org owner)+ */+export type PropertyOwnerOneOfSeven = {+ scope: PropertyOwnerOneOfSevenScope;+};diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/propertyOwnerOneOfSevenScope.ts b/js/app/packages/service-clients/service-storage/generated/schemas/propertyOwnerOneOfSevenScope.tsnew file mode 100644index 0000000000..265728c12f--- /dev/null+++ b/js/app/packages/service-clients/service-storage/generated/schemas/propertyOwnerOneOfSevenScope.ts@@ -0,0 +1,14 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * document_storage_service+ * OpenAPI spec version: 0.1.0+ */++export type PropertyOwnerOneOfSevenScope =+ (typeof PropertyOwnerOneOfSevenScope)[keyof typeof PropertyOwnerOneOfSevenScope];++// eslint-disable-next-line @typescript-eslint/no-redeclare+export const PropertyOwnerOneOfSevenScope = {+ system: 'system',+} as const;diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/propertyOwnerOneOfThree.ts b/js/app/packages/service-clients/service-storage/generated/schemas/propertyOwnerOneOfThree.tsnew file mode 100644index 0000000000..bd9da67cef--- /dev/null+++ b/js/app/packages/service-clients/service-storage/generated/schemas/propertyOwnerOneOfThree.ts@@ -0,0 +1,15 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * document_storage_service+ * OpenAPI spec version: 0.1.0+ */+import type { PropertyOwnerOneOfThreeScope } from './propertyOwnerOneOfThreeScope';++/**+ * Organization-scoped property only+ */+export type PropertyOwnerOneOfThree = {+ organization_id: number;+ scope: PropertyOwnerOneOfThreeScope;+};diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/propertyOwnerOneOfThreeScope.ts b/js/app/packages/service-clients/service-storage/generated/schemas/propertyOwnerOneOfThreeScope.tsnew file mode 100644index 0000000000..82643d5f2a--- /dev/null+++ b/js/app/packages/service-clients/service-storage/generated/schemas/propertyOwnerOneOfThreeScope.ts@@ -0,0 +1,14 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * document_storage_service+ * OpenAPI spec version: 0.1.0+ */++export type PropertyOwnerOneOfThreeScope =+ (typeof PropertyOwnerOneOfThreeScope)[keyof typeof PropertyOwnerOneOfThreeScope];++// eslint-disable-next-line @typescript-eslint/no-redeclare+export const PropertyOwnerOneOfThreeScope = {+ organization: 'organization',+} as const;diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/propertyValue.ts b/js/app/packages/service-clients/service-storage/generated/schemas/propertyValue.tsnew file mode 100644index 0000000000..308142613b--- /dev/null+++ b/js/app/packages/service-clients/service-storage/generated/schemas/propertyValue.ts@@ -0,0 +1,28 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * document_storage_service+ * OpenAPI spec version: 0.1.0+ */+import type { PropertyValueOneOf } from './propertyValueOneOf';+import type { PropertyValueOneOfFive } from './propertyValueOneOfFive';+import type { PropertyValueOneOfNine } from './propertyValueOneOfNine';+import type { PropertyValueOneOfOneone } from './propertyValueOneOfOneone';+import type { PropertyValueOneOfOnethree } from './propertyValueOneOfOnethree';+import type { PropertyValueOneOfSeven } from './propertyValueOneOfSeven';+import type { PropertyValueOneOfThree } from './propertyValueOneOfThree';++/**+ * Property value (service representation).++Represents the actual value stored for an entity property.+This is serialized to/from JSONB in the database.+ */+export type PropertyValue =+ | PropertyValueOneOf+ | PropertyValueOneOfThree+ | PropertyValueOneOfFive+ | PropertyValueOneOfSeven+ | PropertyValueOneOfNine+ | PropertyValueOneOfOneone+ | PropertyValueOneOfOnethree;diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/propertyValueOneOf.ts b/js/app/packages/service-clients/service-storage/generated/schemas/propertyValueOneOf.tsnew file mode 100644index 0000000000..16e34b6b9b--- /dev/null+++ b/js/app/packages/service-clients/service-storage/generated/schemas/propertyValueOneOf.ts@@ -0,0 +1,18 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * document_storage_service+ * OpenAPI spec version: 0.1.0+ */+import type { PropertyValueOneOfType } from './propertyValueOneOfType';++/**+ * Boolean value+Serializes as: {"type": "Boolean", "value": true}+ */+export type PropertyValueOneOf = {+ type: PropertyValueOneOfType;+ /** Boolean value+Serializes as: {"type": "Boolean", "value": true} */+ value: boolean;+};diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/propertyValueOneOfFive.ts b/js/app/packages/service-clients/service-storage/generated/schemas/propertyValueOneOfFive.tsnew file mode 100644index 0000000000..4ed9950fc6--- /dev/null+++ b/js/app/packages/service-clients/service-storage/generated/schemas/propertyValueOneOfFive.ts@@ -0,0 +1,18 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * document_storage_service+ * OpenAPI spec version: 0.1.0+ */+import type { PropertyValueOneOfFiveType } from './propertyValueOneOfFiveType';++/**+ * String value+Serializes as: {"type": "String", "value": "text"}+ */+export type PropertyValueOneOfFive = {+ type: PropertyValueOneOfFiveType;+ /** String value+Serializes as: {"type": "String", "value": "text"} */+ value: string;+};diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/propertyValueOneOfFiveType.ts b/js/app/packages/service-clients/service-storage/generated/schemas/propertyValueOneOfFiveType.tsnew file mode 100644index 0000000000..653ee8e494--- /dev/null+++ b/js/app/packages/service-clients/service-storage/generated/schemas/propertyValueOneOfFiveType.ts@@ -0,0 +1,14 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * document_storage_service+ * OpenAPI spec version: 0.1.0+ */++export type PropertyValueOneOfFiveType =+ (typeof PropertyValueOneOfFiveType)[keyof typeof PropertyValueOneOfFiveType];++// eslint-disable-next-line @typescript-eslint/no-redeclare+export const PropertyValueOneOfFiveType = {+ String: 'String',+} as const;diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/propertyValueOneOfNine.ts b/js/app/packages/service-clients/service-storage/generated/schemas/propertyValueOneOfNine.tsnew file mode 100644index 0000000000..f42a6cbaaa--- /dev/null+++ b/js/app/packages/service-clients/service-storage/generated/schemas/propertyValueOneOfNine.ts@@ -0,0 +1,20 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * document_storage_service+ * OpenAPI spec version: 0.1.0+ */+import type { PropertyValueOneOfNineType } from './propertyValueOneOfNineType';++/**+ * Select option(s) - always an array (check is_multi_select to determine if single or multi)+Single-select: {"type": "SelectOption", "value": ["uuid"]} (length 0 or 1)+Multi-select: {"type": "SelectOption", "value": ["uuid1", "uuid2", ...]} (length 0+)+ */+export type PropertyValueOneOfNine = {+ type: PropertyValueOneOfNineType;+ /** Select option(s) - always an array (check is_multi_select to determine if single or multi)+Single-select: {"type": "SelectOption", "value": ["uuid"]} (length 0 or 1)+Multi-select: {"type": "SelectOption", "value": ["uuid1", "uuid2", ...]} (length 0+) */+ value: string[];+};diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/propertyValueOneOfNineType.ts b/js/app/packages/service-clients/service-storage/generated/schemas/propertyValueOneOfNineType.tsnew file mode 100644index 0000000000..0b7356d22a--- /dev/null+++ b/js/app/packages/service-clients/service-storage/generated/schemas/propertyValueOneOfNineType.ts@@ -0,0 +1,14 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * document_storage_service+ * OpenAPI spec version: 0.1.0+ */++export type PropertyValueOneOfNineType =+ (typeof PropertyValueOneOfNineType)[keyof typeof PropertyValueOneOfNineType];++// eslint-disable-next-line @typescript-eslint/no-redeclare+export const PropertyValueOneOfNineType = {+ SelectOption: 'SelectOption',+} as const;diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/propertyValueOneOfOneone.ts b/js/app/packages/service-clients/service-storage/generated/schemas/propertyValueOneOfOneone.tsnew file mode 100644index 0000000000..369cd310da--- /dev/null+++ b/js/app/packages/service-clients/service-storage/generated/schemas/propertyValueOneOfOneone.ts@@ -0,0 +1,22 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * document_storage_service+ * OpenAPI spec version: 0.1.0+ */++import type { EntityReference } from './entityReference';+import type { PropertyValueOneOfOneoneType } from './propertyValueOneOfOneoneType';++/**+ * Entity reference(s) - always an array (check is_multi_select to determine if single or multi)+Single-select: {"type": "EntityReference", "value": [{...}]} (length 0 or 1)+Multi-select: {"type": "EntityReference", "value": [{...}, {...}, ...]} (length 0+)+ */+export type PropertyValueOneOfOneone = {+ type: PropertyValueOneOfOneoneType;+ /** Entity reference(s) - always an array (check is_multi_select to determine if single or multi)+Single-select: {"type": "EntityReference", "value": [{...}]} (length 0 or 1)+Multi-select: {"type": "EntityReference", "value": [{...}, {...}, ...]} (length 0+) */+ value: EntityReference[];+};diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/propertyValueOneOfOneoneType.ts b/js/app/packages/service-clients/service-storage/generated/schemas/propertyValueOneOfOneoneType.tsnew file mode 100644index 0000000000..48c0faec4b--- /dev/null+++ b/js/app/packages/service-clients/service-storage/generated/schemas/propertyValueOneOfOneoneType.ts@@ -0,0 +1,14 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * document_storage_service+ * OpenAPI spec version: 0.1.0+ */++export type PropertyValueOneOfOneoneType =+ (typeof PropertyValueOneOfOneoneType)[keyof typeof PropertyValueOneOfOneoneType];++// eslint-disable-next-line @typescript-eslint/no-redeclare+export const PropertyValueOneOfOneoneType = {+ EntityReference: 'EntityReference',+} as const;diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/propertyValueOneOfOnethree.ts b/js/app/packages/service-clients/service-storage/generated/schemas/propertyValueOneOfOnethree.tsnew file mode 100644index 0000000000..34752d9648--- /dev/null+++ b/js/app/packages/service-clients/service-storage/generated/schemas/propertyValueOneOfOnethree.ts@@ -0,0 +1,20 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * document_storage_service+ * OpenAPI spec version: 0.1.0+ */+import type { PropertyValueOneOfOnethreeType } from './propertyValueOneOfOnethreeType';++/**+ * Link value(s) - always an array (check is_multi_select to determine if single or multi)+Single-select: {"type": "Link", "value": ["https://example.com"]} (length 0 or 1)+Multi-select: {"type": "Link", "value": ["https://example.com", "https://other.com"]} (length 0+)+ */+export type PropertyValueOneOfOnethree = {+ type: PropertyValueOneOfOnethreeType;+ /** Link value(s) - always an array (check is_multi_select to determine if single or multi)+Single-select: {"type": "Link", "value": ["https://example.com"]} (length 0 or 1)+Multi-select: {"type": "Link", "value": ["https://example.com", "https://other.com"]} (length 0+) */+ value: string[];+};diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/propertyValueOneOfOnethreeType.ts b/js/app/packages/service-clients/service-storage/generated/schemas/propertyValueOneOfOnethreeType.tsnew file mode 100644index 0000000000..45e13187e4--- /dev/null+++ b/js/app/packages/service-clients/service-storage/generated/schemas/propertyValueOneOfOnethreeType.ts@@ -0,0 +1,14 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * document_storage_service+ * OpenAPI spec version: 0.1.0+ */++export type PropertyValueOneOfOnethreeType =+ (typeof PropertyValueOneOfOnethreeType)[keyof typeof PropertyValueOneOfOnethreeType];++// eslint-disable-next-line @typescript-eslint/no-redeclare+export const PropertyValueOneOfOnethreeType = {+ Link: 'Link',+} as const;diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/propertyValueOneOfSeven.ts b/js/app/packages/service-clients/service-storage/generated/schemas/propertyValueOneOfSeven.tsnew file mode 100644index 0000000000..cd974e7080--- /dev/null+++ b/js/app/packages/service-clients/service-storage/generated/schemas/propertyValueOneOfSeven.ts@@ -0,0 +1,18 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * document_storage_service+ * OpenAPI spec version: 0.1.0+ */+import type { PropertyValueOneOfSevenType } from './propertyValueOneOfSevenType';++/**+ * Date/timestamp value+Serializes as: {"type": "Date", "value": "2025-01-01T00:00:00Z"}+ */+export type PropertyValueOneOfSeven = {+ type: PropertyValueOneOfSevenType;+ /** Date/timestamp value+Serializes as: {"type": "Date", "value": "2025-01-01T00:00:00Z"} */+ value: string;+};diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/propertyValueOneOfSevenType.ts b/js/app/packages/service-clients/service-storage/generated/schemas/propertyValueOneOfSevenType.tsnew file mode 100644index 0000000000..1c7903d21f--- /dev/null+++ b/js/app/packages/service-clients/service-storage/generated/schemas/propertyValueOneOfSevenType.ts@@ -0,0 +1,14 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * document_storage_service+ * OpenAPI spec version: 0.1.0+ */++export type PropertyValueOneOfSevenType =+ (typeof PropertyValueOneOfSevenType)[keyof typeof PropertyValueOneOfSevenType];++// eslint-disable-next-line @typescript-eslint/no-redeclare+export const PropertyValueOneOfSevenType = {+ Date: 'Date',+} as const;diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/propertyValueOneOfThree.ts b/js/app/packages/service-clients/service-storage/generated/schemas/propertyValueOneOfThree.tsnew file mode 100644index 0000000000..07be3c0c55--- /dev/null+++ b/js/app/packages/service-clients/service-storage/generated/schemas/propertyValueOneOfThree.ts@@ -0,0 +1,18 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * document_storage_service+ * OpenAPI spec version: 0.1.0+ */+import type { PropertyValueOneOfThreeType } from './propertyValueOneOfThreeType';++/**+ * Numeric value+Serializes as: {"type": "Number", "value": 42.5}+ */+export type PropertyValueOneOfThree = {+ type: PropertyValueOneOfThreeType;+ /** Numeric value+Serializes as: {"type": "Number", "value": 42.5} */+ value: number;+};diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/propertyValueOneOfThreeType.ts b/js/app/packages/service-clients/service-storage/generated/schemas/propertyValueOneOfThreeType.tsnew file mode 100644index 0000000000..48f5c7d925--- /dev/null+++ b/js/app/packages/service-clients/service-storage/generated/schemas/propertyValueOneOfThreeType.ts@@ -0,0 +1,14 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * document_storage_service+ * OpenAPI spec version: 0.1.0+ */++export type PropertyValueOneOfThreeType =+ (typeof PropertyValueOneOfThreeType)[keyof typeof PropertyValueOneOfThreeType];++// eslint-disable-next-line @typescript-eslint/no-redeclare+export const PropertyValueOneOfThreeType = {+ Number: 'Number',+} as const;diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/propertyValueOneOfType.ts b/js/app/packages/service-clients/service-storage/generated/schemas/propertyValueOneOfType.tsnew file mode 100644index 0000000000..bd48287e53--- /dev/null+++ b/js/app/packages/service-clients/service-storage/generated/schemas/propertyValueOneOfType.ts@@ -0,0 +1,14 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * document_storage_service+ * OpenAPI spec version: 0.1.0+ */++export type PropertyValueOneOfType =+ (typeof PropertyValueOneOfType)[keyof typeof PropertyValueOneOfType];++// eslint-disable-next-line @typescript-eslint/no-redeclare+export const PropertyValueOneOfType = {+ Boolean: 'Boolean',+} as const;diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/soupChat.ts b/js/app/packages/service-clients/service-storage/generated/schemas/soupChat.tsindex 2a5734689c..4f95a431d9 100644--- a/js/app/packages/service-clients/service-storage/generated/schemas/soupChat.ts+++ b/js/app/packages/service-clients/service-storage/generated/schemas/soupChat.ts@@ -6,6 +6,7 @@*/import type { SoupChatProjectId } from './soupChatProjectId';import type { SoupChatViewedAt } from './soupChatViewedAt';+import type { SoupProperty } from './soupProperty';export interface SoupChat {/** The time the chat was created */@@ -20,6 +21,8 @@ export interface SoupChat {ownerId: string;/** The project id of the chat */projectId?: SoupChatProjectId;+ /** Properties */+ properties: SoupProperty[];/** The time the chat was last updated */updatedAt: number;/** The time the chat was last viewed */diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/soupDocument.ts b/js/app/packages/service-clients/service-storage/generated/schemas/soupDocument.tsindex 1123953299..846a5de150 100644--- a/js/app/packages/service-clients/service-storage/generated/schemas/soupDocument.ts+++ b/js/app/packages/service-clients/service-storage/generated/schemas/soupDocument.ts@@ -12,6 +12,7 @@ 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';export interface SoupDocument {/** The id of the document this document branched from */@@ -36,6 +37,8 @@ This could be the document_instance_id or document_bom_id depending on the fileownerId: 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 pdfIf the document is a DOCX, this will not be present */sha?: SoupDocumentSha;diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/soupEnrichedEmailThreadPreviewAllOf.ts b/js/app/packages/service-clients/service-storage/generated/schemas/soupEnrichedEmailThreadPreviewAllOf.tsindex 7a4208d2fa..b6fab11e83 100644--- a/js/app/packages/service-clients/service-storage/generated/schemas/soupEnrichedEmailThreadPreviewAllOf.ts+++ b/js/app/packages/service-clients/service-storage/generated/schemas/soupEnrichedEmailThreadPreviewAllOf.ts@@ -9,6 +9,7 @@ import type { SoupContact } from './soupContact';import type { SoupEmailThreadPreviewMetadata } from './soupEmailThreadPreviewMetadata';import type { SoupLabel } from './soupLabel';import type { SoupMacroAttachment } from './soupMacroAttachment';+import type { SoupProperty } from './soupProperty';export type SoupEnrichedEmailThreadPreviewAllOf = {attachments: SoupAttachment[];@@ -16,4 +17,5 @@ export type SoupEnrichedEmailThreadPreviewAllOf = {labels: SoupLabel[];metadata: SoupEmailThreadPreviewMetadata;participants: SoupContact[];+ properties: SoupProperty[];};diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/soupProject.ts b/js/app/packages/service-clients/service-storage/generated/schemas/soupProject.tsindex 2d21ab4a29..775d762895 100644--- a/js/app/packages/service-clients/service-storage/generated/schemas/soupProject.ts+++ b/js/app/packages/service-clients/service-storage/generated/schemas/soupProject.ts@@ -6,6 +6,7 @@*/import type { SoupProjectParentId } from './soupProjectParentId';import type { SoupProjectViewedAt } from './soupProjectViewedAt';+import type { SoupProperty } from './soupProperty';export interface SoupProject {/** The time the project was created */@@ -18,6 +19,8 @@ export interface SoupProject {ownerId: string;/** The parent project id */parentId?: SoupProjectParentId;+ /** Properties */+ properties: SoupProperty[];/** The time the project was updated */updatedAt: number;/** The time the document was last viewed */diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/soupProperty.ts b/js/app/packages/service-clients/service-storage/generated/schemas/soupProperty.tsnew file mode 100644index 0000000000..917e6fd1fb--- /dev/null+++ b/js/app/packages/service-clients/service-storage/generated/schemas/soupProperty.ts@@ -0,0 +1,20 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * document_storage_service+ * OpenAPI spec version: 0.1.0+ */+import type { PropertyDefinition } from './propertyDefinition';+import type { SoupPropertyValue } from './soupPropertyValue';++/**+ * A property attached to a Soup item.++This is a simplified representation that includes only the definition and value,+omitting the entity property assignment metadata and options.+ */+export interface SoupProperty {+ /** The property definition */+ definition: PropertyDefinition;+ value?: SoupPropertyValue;+}diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/soupPropertyValue.ts b/js/app/packages/service-clients/service-storage/generated/schemas/soupPropertyValue.tsnew file mode 100644index 0000000000..8cb00d7db7--- /dev/null+++ b/js/app/packages/service-clients/service-storage/generated/schemas/soupPropertyValue.ts@@ -0,0 +1,9 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * document_storage_service+ * OpenAPI spec version: 0.1.0+ */+import type { PropertyValue } from './propertyValue';++export type SoupPropertyValue = null | PropertyValue;diff --git a/js/app/packages/service-clients/service-storage/generated/zod.ts b/js/app/packages/service-clients/service-storage/generated/zod.tsindex 8e8f831cf6..a5ca4c5d7c 100644--- a/js/app/packages/service-clients/service-storage/generated/zod.ts+++ b/js/app/packages/service-clients/service-storage/generated/zod.ts@@ -2357,6 +2357,227 @@ export const getItemsSoupResponse = zod.object({.uuid().nullish().describe('The id of the project that this document belongs to'),+ properties: zod+ .array(+ zod+ .object({+ definition: zod+ .object({+ created_at: zod.string().datetime({}),+ data_type: zod+ .enum([+ 'BOOLEAN',+ 'DATE',+ 'NUMBER',+ 'STRING',+ 'SELECT_NUMBER',+ 'SELECT_STRING',+ 'ENTITY',+ 'LINK',+ ])+ .describe(+ 'Data type for property values, determining storage and validation.'+ ),+ display_name: zod.string(),+ id: zod.string().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 only'),+ zod+ .object({+ organization_id: zod.number(),+ scope: zod.enum(['organization']),+ })+ .describe('Organization-scoped property only'),+ zod+ .object({+ organization_id: zod.number(),+ scope: zod.enum(['user_and_organization']),+ user_id: zod.string(),+ })+ .describe('Both user and organization-scoped'),+ zod+ .object({+ scope: zod.enum(['system']),+ })+ .describe(+ 'System-owned property (no user or org owner)'+ ),+ ])+ .describe(+ 'Defines who owns a property - user-scoped, org-scoped, system, or both user and org.'+ ),+ specific_entity_type: zod+ .union([+ zod.null(),+ zod+ .enum([+ 'CHANNEL',+ 'CHAT',+ 'COMPANY',+ 'DOCUMENT',+ 'PROJECT',+ 'TASK',+ 'THREAD',+ 'USER',+ ])+ .describe(+ 'Type of entity that can be referenced by entity properties.'+ ),+ ])+ .optional(),+ updated_at: zod.string().datetime({}),+ })+ .describe(+ 'Property definition model (service representation).'+ ),+ 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+ .string()+ .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.string().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([+ 'CHANNEL',+ 'CHAT',+ 'COMPANY',+ 'DOCUMENT',+ 'PROJECT',+ 'TASK',+ 'THREAD',+ 'USER',+ ])+ .describe(+ 'Type of entity that can be referenced by entity properties.'+ ),+ specific_message_id: zod+ .string()+ .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'),sha: zod.string().nullish()@@ -2407,6 +2628,227 @@ export const getItemsSoupResponse = zod.object({.uuid().nullish().describe('The project id of the chat'),+ properties: zod+ .array(+ zod+ .object({+ definition: zod+ .object({+ created_at: zod.string().datetime({}),+ data_type: zod+ .enum([+ 'BOOLEAN',+ 'DATE',+ 'NUMBER',+ 'STRING',+ 'SELECT_NUMBER',+ 'SELECT_STRING',+ 'ENTITY',+ 'LINK',+ ])+ .describe(+ 'Data type for property values, determining storage and validation.'+ ),+ display_name: zod.string(),+ id: zod.string().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 only'),+ zod+ .object({+ organization_id: zod.number(),+ scope: zod.enum(['organization']),+ })+ .describe('Organization-scoped property only'),+ zod+ .object({+ organization_id: zod.number(),+ scope: zod.enum(['user_and_organization']),+ user_id: zod.string(),+ })+ .describe('Both user and organization-scoped'),+ zod+ .object({+ scope: zod.enum(['system']),+ })+ .describe(+ 'System-owned property (no user or org owner)'+ ),+ ])+ .describe(+ 'Defines who owns a property - user-scoped, org-scoped, system, or both user and org.'+ ),+ specific_entity_type: zod+ .union([+ zod.null(),+ zod+ .enum([+ 'CHANNEL',+ 'CHAT',+ 'COMPANY',+ 'DOCUMENT',+ 'PROJECT',+ 'TASK',+ 'THREAD',+ 'USER',+ ])+ .describe(+ 'Type of entity that can be referenced by entity properties.'+ ),+ ])+ .optional(),+ updated_at: zod.string().datetime({}),+ })+ .describe(+ 'Property definition model (service representation).'+ ),+ 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+ .string()+ .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.string().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([+ 'CHANNEL',+ 'CHAT',+ 'COMPANY',+ 'DOCUMENT',+ 'PROJECT',+ 'TASK',+ 'THREAD',+ 'USER',+ ])+ .describe(+ 'Type of entity that can be referenced by entity properties.'+ ),+ specific_message_id: zod+ .string()+ .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'),updatedAt: zod.number().describe('The time the chat was last updated'),@@ -2432,6 +2874,227 @@ export const getItemsSoupResponse = zod.object({.uuid().nullish().describe('The parent project id'),+ properties: zod+ .array(+ zod+ .object({+ definition: zod+ .object({+ created_at: zod.string().datetime({}),+ data_type: zod+ .enum([+ 'BOOLEAN',+ 'DATE',+ 'NUMBER',+ 'STRING',+ 'SELECT_NUMBER',+ 'SELECT_STRING',+ 'ENTITY',+ 'LINK',+ ])+ .describe(+ 'Data type for property values, determining storage and validation.'+ ),+ display_name: zod.string(),+ id: zod.string().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 only'),+ zod+ .object({+ organization_id: zod.number(),+ scope: zod.enum(['organization']),+ })+ .describe('Organization-scoped property only'),+ zod+ .object({+ organization_id: zod.number(),+ scope: zod.enum(['user_and_organization']),+ user_id: zod.string(),+ })+ .describe('Both user and organization-scoped'),+ zod+ .object({+ scope: zod.enum(['system']),+ })+ .describe(+ 'System-owned property (no user or org owner)'+ ),+ ])+ .describe(+ 'Defines who owns a property - user-scoped, org-scoped, system, or both user and org.'+ ),+ specific_entity_type: zod+ .union([+ zod.null(),+ zod+ .enum([+ 'CHANNEL',+ 'CHAT',+ 'COMPANY',+ 'DOCUMENT',+ 'PROJECT',+ 'TASK',+ 'THREAD',+ 'USER',+ ])+ .describe(+ 'Type of entity that can be referenced by entity properties.'+ ),+ ])+ .optional(),+ updated_at: zod.string().datetime({}),+ })+ .describe(+ 'Property definition model (service representation).'+ ),+ 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+ .string()+ .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.string().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([+ 'CHANNEL',+ 'CHAT',+ 'COMPANY',+ 'DOCUMENT',+ 'PROJECT',+ 'TASK',+ 'THREAD',+ 'USER',+ ])+ .describe(+ 'Type of entity that can be referenced by entity properties.'+ ),+ specific_message_id: zod+ .string()+ .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'),updatedAt: zod.number().describe('The time the project was updated'),@@ -2524,6 +3187,225 @@ export const getItemsSoupResponse = zod.object({sfsPhotoUrl: zod.string().nullish(),})),+ properties: zod.array(+ zod+ .object({+ definition: zod+ .object({+ created_at: zod.string().datetime({}),+ data_type: zod+ .enum([+ 'BOOLEAN',+ 'DATE',+ 'NUMBER',+ 'STRING',+ 'SELECT_NUMBER',+ 'SELECT_STRING',+ 'ENTITY',+ 'LINK',+ ])+ .describe(+ 'Data type for property values, determining storage and validation.'+ ),+ display_name: zod.string(),+ id: zod.string().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 only'),+ zod+ .object({+ organization_id: zod.number(),+ scope: zod.enum(['organization']),+ })+ .describe('Organization-scoped property only'),+ zod+ .object({+ organization_id: zod.number(),+ scope: zod.enum(['user_and_organization']),+ user_id: zod.string(),+ })+ .describe('Both user and organization-scoped'),+ zod+ .object({+ scope: zod.enum(['system']),+ })+ .describe(+ 'System-owned property (no user or org owner)'+ ),+ ])+ .describe(+ 'Defines who owns a property - user-scoped, org-scoped, system, or both user and org.'+ ),+ specific_entity_type: zod+ .union([+ zod.null(),+ zod+ .enum([+ 'CHANNEL',+ 'CHAT',+ 'COMPANY',+ 'DOCUMENT',+ 'PROJECT',+ 'TASK',+ 'THREAD',+ 'USER',+ ])+ .describe(+ 'Type of entity that can be referenced by entity properties.'+ ),+ ])+ .optional(),+ updated_at: zod.string().datetime({}),+ })+ .describe(+ 'Property definition model (service representation).'+ ),+ 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+ .string()+ .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.string().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([+ 'CHANNEL',+ 'CHAT',+ 'COMPANY',+ 'DOCUMENT',+ 'PROJECT',+ 'TASK',+ 'THREAD',+ 'USER',+ ])+ .describe(+ 'Type of entity that can be referenced by entity properties.'+ ),+ specific_message_id: zod+ .string()+ .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.'+ )+ ),})),tag: zod.enum(['emailThread']),@@ -2861,6 +3743,227 @@ export const postItemsSoupResponse = zod.object({.uuid().nullish().describe('The id of the project that this document belongs to'),+ properties: zod+ .array(+ zod+ .object({+ definition: zod+ .object({+ created_at: zod.string().datetime({}),+ data_type: zod+ .enum([+ 'BOOLEAN',+ 'DATE',+ 'NUMBER',+ 'STRING',+ 'SELECT_NUMBER',+ 'SELECT_STRING',+ 'ENTITY',+ 'LINK',+ ])+ .describe(+ 'Data type for property values, determining storage and validation.'+ ),+ display_name: zod.string(),+ id: zod.string().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 only'),+ zod+ .object({+ organization_id: zod.number(),+ scope: zod.enum(['organization']),+ })+ .describe('Organization-scoped property only'),+ zod+ .object({+ organization_id: zod.number(),+ scope: zod.enum(['user_and_organization']),+ user_id: zod.string(),+ })+ .describe('Both user and organization-scoped'),+ zod+ .object({+ scope: zod.enum(['system']),+ })+ .describe(+ 'System-owned property (no user or org owner)'+ ),+ ])+ .describe(+ 'Defines who owns a property - user-scoped, org-scoped, system, or both user and org.'+ ),+ specific_entity_type: zod+ .union([+ zod.null(),+ zod+ .enum([+ 'CHANNEL',+ 'CHAT',+ 'COMPANY',+ 'DOCUMENT',+ 'PROJECT',+ 'TASK',+ 'THREAD',+ 'USER',+ ])+ .describe(+ 'Type of entity that can be referenced by entity properties.'+ ),+ ])+ .optional(),+ updated_at: zod.string().datetime({}),+ })+ .describe(+ 'Property definition model (service representation).'+ ),+ 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+ .string()+ .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.string().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([+ 'CHANNEL',+ 'CHAT',+ 'COMPANY',+ 'DOCUMENT',+ 'PROJECT',+ 'TASK',+ 'THREAD',+ 'USER',+ ])+ .describe(+ 'Type of entity that can be referenced by entity properties.'+ ),+ specific_message_id: zod+ .string()+ .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'),sha: zod.string().nullish()@@ -2911,6 +4014,227 @@ export const postItemsSoupResponse = zod.object({.uuid().nullish().describe('The project id of the chat'),+ properties: zod+ .array(+ zod+ .object({+ definition: zod+ .object({+ created_at: zod.string().datetime({}),+ data_type: zod+ .enum([+ 'BOOLEAN',+ 'DATE',+ 'NUMBER',+ 'STRING',+ 'SELECT_NUMBER',+ 'SELECT_STRING',+ 'ENTITY',+ 'LINK',+ ])+ .describe(+ 'Data type for property values, determining storage and validation.'+ ),+ display_name: zod.string(),+ id: zod.string().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 only'),+ zod+ .object({+ organization_id: zod.number(),+ scope: zod.enum(['organization']),+ })+ .describe('Organization-scoped property only'),+ zod+ .object({+ organization_id: zod.number(),+ scope: zod.enum(['user_and_organization']),+ user_id: zod.string(),+ })+ .describe('Both user and organization-scoped'),+ zod+ .object({+ scope: zod.enum(['system']),+ })+ .describe(+ 'System-owned property (no user or org owner)'+ ),+ ])+ .describe(+ 'Defines who owns a property - user-scoped, org-scoped, system, or both user and org.'+ ),+ specific_entity_type: zod+ .union([+ zod.null(),+ zod+ .enum([+ 'CHANNEL',+ 'CHAT',+ 'COMPANY',+ 'DOCUMENT',+ 'PROJECT',+ 'TASK',+ 'THREAD',+ 'USER',+ ])+ .describe(+ 'Type of entity that can be referenced by entity properties.'+ ),+ ])+ .optional(),+ updated_at: zod.string().datetime({}),+ })+ .describe(+ 'Property definition model (service representation).'+ ),+ 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+ .string()+ .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.string().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([+ 'CHANNEL',+ 'CHAT',+ 'COMPANY',+ 'DOCUMENT',+ 'PROJECT',+ 'TASK',+ 'THREAD',+ 'USER',+ ])+ .describe(+ 'Type of entity that can be referenced by entity properties.'+ ),+ specific_message_id: zod+ .string()+ .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'),updatedAt: zod.number().describe('The time the chat was last updated'),@@ -2936,6 +4260,227 @@ export const postItemsSoupResponse = zod.object({.uuid().nullish().describe('The parent project id'),+ properties: zod+ .array(+ zod+ .object({+ definition: zod+ .object({+ created_at: zod.string().datetime({}),+ data_type: zod+ .enum([+ 'BOOLEAN',+ 'DATE',+ 'NUMBER',+ 'STRING',+ 'SELECT_NUMBER',+ 'SELECT_STRING',+ 'ENTITY',+ 'LINK',+ ])+ .describe(+ 'Data type for property values, determining storage and validation.'+ ),+ display_name: zod.string(),+ id: zod.string().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 only'),+ zod+ .object({+ organization_id: zod.number(),+ scope: zod.enum(['organization']),+ })+ .describe('Organization-scoped property only'),+ zod+ .object({+ organization_id: zod.number(),+ scope: zod.enum(['user_and_organization']),+ user_id: zod.string(),+ })+ .describe('Both user and organization-scoped'),+ zod+ .object({+ scope: zod.enum(['system']),+ })+ .describe(+ 'System-owned property (no user or org owner)'+ ),+ ])+ .describe(+ 'Defines who owns a property - user-scoped, org-scoped, system, or both user and org.'+ ),+ specific_entity_type: zod+ .union([+ zod.null(),+ zod+ .enum([+ 'CHANNEL',+ 'CHAT',+ 'COMPANY',+ 'DOCUMENT',+ 'PROJECT',+ 'TASK',+ 'THREAD',+ 'USER',+ ])+ .describe(+ 'Type of entity that can be referenced by entity properties.'+ ),+ ])+ .optional(),+ updated_at: zod.string().datetime({}),+ })+ .describe(+ 'Property definition model (service representation).'+ ),+ 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+ .string()+ .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.string().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([+ 'CHANNEL',+ 'CHAT',+ 'COMPANY',+ 'DOCUMENT',+ 'PROJECT',+ 'TASK',+ 'THREAD',+ 'USER',+ ])+ .describe(+ 'Type of entity that can be referenced by entity properties.'+ ),+ specific_message_id: zod+ .string()+ .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'),updatedAt: zod.number().describe('The time the project was updated'),@@ -3028,6 +4573,225 @@ export const postItemsSoupResponse = zod.object({sfsPhotoUrl: zod.string().nullish(),})),+ properties: zod.array(+ zod+ .object({+ definition: zod+ .object({+ created_at: zod.string().datetime({}),+ data_type: zod+ .enum([+ 'BOOLEAN',+ 'DATE',+ 'NUMBER',+ 'STRING',+ 'SELECT_NUMBER',+ 'SELECT_STRING',+ 'ENTITY',+ 'LINK',+ ])+ .describe(+ 'Data type for property values, determining storage and validation.'+ ),+ display_name: zod.string(),+ id: zod.string().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 only'),+ zod+ .object({+ organization_id: zod.number(),+ scope: zod.enum(['organization']),+ })+ .describe('Organization-scoped property only'),+ zod+ .object({+ organization_id: zod.number(),+ scope: zod.enum(['user_and_organization']),+ user_id: zod.string(),+ })+ .describe('Both user and organization-scoped'),+ zod+ .object({+ scope: zod.enum(['system']),+ })+ .describe(+ 'System-owned property (no user or org owner)'+ ),+ ])+ .describe(+ 'Defines who owns a property - user-scoped, org-scoped, system, or both user and org.'+ ),+ specific_entity_type: zod+ .union([+ zod.null(),+ zod+ .enum([+ 'CHANNEL',+ 'CHAT',+ 'COMPANY',+ 'DOCUMENT',+ 'PROJECT',+ 'TASK',+ 'THREAD',+ 'USER',+ ])+ .describe(+ 'Type of entity that can be referenced by entity properties.'+ ),+ ])+ .optional(),+ updated_at: zod.string().datetime({}),+ })+ .describe(+ 'Property definition model (service representation).'+ ),+ 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+ .string()+ .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.string().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([+ 'CHANNEL',+ 'CHAT',+ 'COMPANY',+ 'DOCUMENT',+ 'PROJECT',+ 'TASK',+ 'THREAD',+ 'USER',+ ])+ .describe(+ 'Type of entity that can be referenced by entity properties.'+ ),+ specific_message_id: zod+ .string()+ .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.'+ )+ ),})),tag: zod.enum(['emailThread']),diff --git a/js/app/packages/service-clients/service-storage/openapi.json b/js/app/packages/service-clients/service-storage/openapi.jsonindex f6b8729f0e..e8afecdf85 100644--- a/js/app/packages/service-clients/service-storage/openapi.json+++ b/js/app/packages/service-clients/service-storage/openapi.json@@ -5290,6 +5290,20 @@}}},+ "DataType": {+ "type": "string",+ "description": "Data type for property values, determining storage and validation.",+ "enum": [+ "BOOLEAN",+ "DATE",+ "NUMBER",+ "STRING",+ "SELECT_NUMBER",+ "SELECT_STRING",+ "ENTITY",+ "LINK"+ ]+ },"DeleteAnchorInfo": {"allOf": [{@@ -7646,6 +7660,65 @@}}},+ "PropertyDefinition": {+ "type": "object",+ "description": "Property definition model (service representation).",+ "required": [+ "id",+ "owner",+ "display_name",+ "data_type",+ "is_multi_select",+ "created_at",+ "updated_at",+ "is_system",+ "is_metadata"+ ],+ "properties": {+ "created_at": {+ "type": "string",+ "format": "date-time"+ },+ "data_type": {+ "$ref": "#/components/schemas/DataType"+ },+ "display_name": {+ "type": "string"+ },+ "id": {+ "type": "string",+ "format": "uuid"+ },+ "is_metadata": {+ "type": "boolean",+ "description": "Flag to indicate if this is a system-generated metadata property.\nNot stored in database - computed at service layer."+ },+ "is_multi_select": {+ "type": "boolean"+ },+ "is_system": {+ "type": "boolean",+ "description": "Flag to indicate if this is a system property (stored in DB)."+ },+ "owner": {+ "$ref": "#/components/schemas/PropertyOwner"+ },+ "specific_entity_type": {+ "oneOf": [+ {+ "type": "null"+ },+ {+ "$ref": "#/components/schemas/EntityType"+ }+ ]+ },+ "updated_at": {+ "type": "string",+ "format": "date-time"+ }+ }+ },"PropertyInput": {"type": "object","description": "Property input for setting a property value on the task",@@ -7661,6 +7734,191 @@}}},+ "PropertyOwner": {+ "oneOf": [+ {+ "type": "object",+ "description": "User-scoped property only",+ "required": ["user_id", "scope"],+ "properties": {+ "scope": {+ "type": "string",+ "enum": ["user"]+ },+ "user_id": {+ "type": "string"+ }+ }+ },+ {+ "type": "object",+ "description": "Organization-scoped property only",+ "required": ["organization_id", "scope"],+ "properties": {+ "organization_id": {+ "type": "integer",+ "format": "int32"+ },+ "scope": {+ "type": "string",+ "enum": ["organization"]+ }+ }+ },+ {+ "type": "object",+ "description": "Both user and organization-scoped",+ "required": ["user_id", "organization_id", "scope"],+ "properties": {+ "organization_id": {+ "type": "integer",+ "format": "int32"+ },+ "scope": {+ "type": "string",+ "enum": ["user_and_organization"]+ },+ "user_id": {+ "type": "string"+ }+ }+ },+ {+ "type": "object",+ "description": "System-owned property (no user or org owner)",+ "required": ["scope"],+ "properties": {+ "scope": {+ "type": "string",+ "enum": ["system"]+ }+ }+ }+ ],+ "description": "Defines who owns a property - user-scoped, org-scoped, system, or both user and org."+ },+ "PropertyValue": {+ "oneOf": [+ {+ "type": "object",+ "description": "Boolean value\nSerializes as: {\"type\": \"Boolean\", \"value\": true}",+ "required": ["value", "type"],+ "properties": {+ "type": {+ "type": "string",+ "enum": ["Boolean"]+ },+ "value": {+ "type": "boolean",+ "description": "Boolean value\nSerializes as: {\"type\": \"Boolean\", \"value\": true}"+ }+ }+ },+ {+ "type": "object",+ "description": "Numeric value\nSerializes as: {\"type\": \"Number\", \"value\": 42.5}",+ "required": ["value", "type"],+ "properties": {+ "type": {+ "type": "string",+ "enum": ["Number"]+ },+ "value": {+ "type": "number",+ "format": "double",+ "description": "Numeric value\nSerializes as: {\"type\": \"Number\", \"value\": 42.5}"+ }+ }+ },+ {+ "type": "object",+ "description": "String value\nSerializes as: {\"type\": \"String\", \"value\": \"text\"}",+ "required": ["value", "type"],+ "properties": {+ "type": {+ "type": "string",+ "enum": ["String"]+ },+ "value": {+ "type": "string",+ "description": "String value\nSerializes as: {\"type\": \"String\", \"value\": \"text\"}"+ }+ }+ },+ {+ "type": "object",+ "description": "Date/timestamp value\nSerializes as: {\"type\": \"Date\", \"value\": \"2025-01-01T00:00:00Z\"}",+ "required": ["value", "type"],+ "properties": {+ "type": {+ "type": "string",+ "enum": ["Date"]+ },+ "value": {+ "type": "string",+ "format": "date-time",+ "description": "Date/timestamp value\nSerializes as: {\"type\": \"Date\", \"value\": \"2025-01-01T00:00:00Z\"}"+ }+ }+ },+ {+ "type": "object",+ "description": "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+)",+ "required": ["value", "type"],+ "properties": {+ "type": {+ "type": "string",+ "enum": ["SelectOption"]+ },+ "value": {+ "type": "array",+ "items": {+ "type": "string",+ "format": "uuid"+ },+ "description": "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+)"+ }+ }+ },+ {+ "type": "object",+ "description": "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+)",+ "required": ["value", "type"],+ "properties": {+ "type": {+ "type": "string",+ "enum": ["EntityReference"]+ },+ "value": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/EntityReference"+ },+ "description": "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+)"+ }+ }+ },+ {+ "type": "object",+ "description": "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+)",+ "required": ["value", "type"],+ "properties": {+ "type": {+ "type": "string",+ "enum": ["Link"]+ },+ "value": {+ "type": "array",+ "items": {+ "type": "string"+ },+ "description": "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+)"+ }+ }+ }+ ],+ "description": "Property value (service representation).\n\nRepresents the actual value stored for an entity property.\nThis is serialized to/from JSONB in the database."+ },"RecentlyDeletedResponseData": {"type": "object","required": ["items"],@@ -8053,7 +8311,8 @@"isPersistent","createdAt","updatedAt",- "viewedAt"+ "viewedAt",+ "properties"],"properties": {"createdAt": {@@ -8083,6 +8342,13 @@"format": "uuid","description": "The project id of the chat"},+ "properties": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/SoupProperty"+ },+ "description": "Properties"+ },"updatedAt": {"type": "integer","format": "int64",@@ -8127,7 +8393,8 @@"name","createdAt","updatedAt",- "viewedAt"+ "viewedAt",+ "properties"],"properties": {"branchedFromId": {@@ -8177,6 +8444,13 @@"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"@@ -8333,7 +8607,8 @@"attachmentsMacro","participants","metadata",- "labels"+ "labels",+ "properties"],"properties": {"attachments": {@@ -8362,6 +8637,12 @@"items": {"$ref": "#/components/schemas/SoupContact"}+ },+ "properties": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/SoupProperty"+ }}}}@@ -8538,7 +8819,8 @@"ownerId","createdAt","updatedAt",- "viewedAt"+ "viewedAt",+ "properties"],"properties": {"createdAt": {@@ -8564,6 +8846,13 @@"format": "uuid","description": "The parent project id"},+ "properties": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/SoupProperty"+ },+ "description": "Properties"+ },"updatedAt": {"type": "integer","format": "int64",@@ -8576,6 +8865,28 @@}}},+ "SoupProperty": {+ "type": "object",+ "description": "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.",+ "required": ["definition"],+ "properties": {+ "definition": {+ "$ref": "#/components/schemas/PropertyDefinition",+ "description": "The property definition"+ },+ "value": {+ "oneOf": [+ {+ "type": "null"+ },+ {+ "$ref": "#/components/schemas/PropertyValue",+ "description": "The property value, if set"+ }+ ]+ }+ }+ },"SuccessResponse": {"type": "object","required": ["error", "data"],diff --git a/rust/cloud-storage/.sqlx/query-495c575d60a26b458bc7c94a66e10634fd02cbd23eecc083108ab8326b73b38f.json b/rust/cloud-storage/.sqlx/query-495c575d60a26b458bc7c94a66e10634fd02cbd23eecc083108ab8326b73b38f.jsondeleted file mode 100644index c44322c582..0000000000--- a/rust/cloud-storage/.sqlx/query-495c575d60a26b458bc7c94a66e10634fd02cbd23eecc083108ab8326b73b38f.json+++ /dev/null@@ -1,115 +0,0 @@-{- "db_name": "PostgreSQL",- "query": "\n WITH UserAccessibleItems AS (\n SELECT DISTINCT ON (\"item_id\", \"item_type\")\n \"item_id\",\n \"item_type\"\n FROM \"UserItemAccess\" \n WHERE \"user_id\" = $1\n ORDER BY \"item_id\", \"item_type\", \n CASE \"access_level\"\n WHEN 'owner' THEN 4\n WHEN 'edit' THEN 3 \n WHEN 'comment' THEN 2\n WHEN 'view' THEN 1\n ELSE 0\n END DESC\n ),\n Combined AS (\n SELECT\n 'document' as \"item_type!\",\n d.id as \"id!\",\n CAST(COALESCE(di.id, db.id) as TEXT) as \"document_version_id\",\n d.owner as \"user_id!\",\n d.name as \"name!\",\n d.\"branchedFromId\" as \"branched_from_id\",\n d.\"branchedFromVersionId\" as \"branched_from_version_id\", \n d.\"documentFamilyId\" as \"document_family_id\",\n d.\"fileType\" as \"file_type\",\n d.\"createdAt\"::timestamptz as \"created_at!\",\n d.\"updatedAt\"::timestamptz as \"updated_at!\",\n d.\"projectId\" as \"project_id\",\n NULL as \"is_persistent\",\n di.sha as \"sha\",\n uh.\"updatedAt\"::timestamptz as \"viewed_at\",\n d.\"updatedAt\"::timestamptz as \"sort_ts!\"\n FROM \"Document\" d\n INNER JOIN UserAccessibleItems uai \n ON uai.item_id = d.id \n AND uai.item_type = 'document'\n LEFT JOIN \"UserHistory\" uh \n ON uh.\"itemId\" = d.id \n AND uh.\"itemType\" = 'document' \n AND uh.\"userId\" = $1\n LEFT JOIN LATERAL (\n SELECT b.id \n FROM \"DocumentBom\" b \n WHERE b.\"documentId\" = d.id \n ORDER BY b.\"createdAt\" DESC \n LIMIT 1\n ) db ON true\n LEFT JOIN LATERAL (\n SELECT i.id, i.sha \n FROM \"DocumentInstance\" i \n WHERE i.\"documentId\" = d.id \n ORDER BY i.\"updatedAt\" DESC \n LIMIT 1\n ) di ON true\n WHERE d.\"deletedAt\" IS NULL\n AND d.id = ANY($2::text[])\n\n UNION ALL\n \n SELECT\n 'chat' as \"item_type!\",\n c.id as \"id!\",\n NULL as \"document_version_id\",\n c.\"userId\" as \"user_id!\",\n c.name as \"name!\",\n NULL as \"branched_from_id\",\n NULL as \"branched_from_version_id\",\n NULL as \"document_family_id\",\n NULL as \"file_type\",\n c.\"createdAt\"::timestamptz as \"created_at!\",\n c.\"updatedAt\"::timestamptz as \"updated_at!\",\n c.\"projectId\" as \"project_id\",\n c.\"isPersistent\" as \"is_persistent\",\n NULL as \"sha\",\n uh.\"updatedAt\"::timestamptz as \"viewed_at\",\n c.\"updatedAt\"::timestamptz as \"sort_ts!\"\n FROM \"Chat\" c\n INNER JOIN UserAccessibleItems uai \n ON uai.item_id = c.id \n AND uai.item_type = 'chat'\n LEFT JOIN \"UserHistory\" uh \n ON uh.\"itemId\" = c.id \n AND uh.\"itemType\" = 'chat' \n AND uh.\"userId\" = $1\n WHERE c.\"deletedAt\" IS NULL\n AND c.id = ANY($3::text[])\n \n UNION ALL\n \n SELECT\n 'project' as \"item_type!\",\n p.id as \"id!\",\n NULL as \"document_version_id\",\n p.\"userId\" as \"user_id!\",\n p.name as \"name!\",\n NULL as \"branched_from_id\",\n NULL as \"branched_from_version_id\",\n NULL as \"document_family_id\",\n NULL as \"file_type\",\n p.\"createdAt\"::timestamptz as \"created_at!\",\n p.\"updatedAt\"::timestamptz as \"updated_at!\",\n p.\"parentId\" as \"project_id\",\n NULL as \"is_persistent\",\n NULL as \"sha\",\n uh.\"updatedAt\"::timestamptz as \"viewed_at\",\n p.\"updatedAt\"::timestamptz as \"sort_ts!\"\n FROM \"Project\" p\n INNER JOIN UserAccessibleItems uai \n ON uai.item_id = p.id \n AND uai.item_type = 'project'\n LEFT JOIN \"UserHistory\" uh \n ON uh.\"itemId\" = p.id \n AND uh.\"itemType\" = 'project' \n AND uh.\"userId\" = $1\n WHERE p.\"deletedAt\" IS NULL\n AND p.id = ANY($4::text[])\n )\n SELECT * \n FROM Combined\n ",- "describe": {- "columns": [- {- "ordinal": 0,- "name": "item_type!",- "type_info": "Text"- },- {- "ordinal": 1,- "name": "id!",- "type_info": "Text"- },- {- "ordinal": 2,- "name": "document_version_id",- "type_info": "Text"- },- {- "ordinal": 3,- "name": "user_id!",- "type_info": "Text"- },- {- "ordinal": 4,- "name": "name!",- "type_info": "Text"- },- {- "ordinal": 5,- "name": "branched_from_id",- "type_info": "Text"- },- {- "ordinal": 6,- "name": "branched_from_version_id",- "type_info": "Int8"- },- {- "ordinal": 7,- "name": "document_family_id",- "type_info": "Int8"- },- {- "ordinal": 8,- "name": "file_type",- "type_info": "Text"- },- {- "ordinal": 9,- "name": "created_at!",- "type_info": "Timestamptz"- },- {- "ordinal": 10,- "name": "updated_at!",- "type_info": "Timestamptz"- },- {- "ordinal": 11,- "name": "project_id",- "type_info": "Text"- },- {- "ordinal": 12,- "name": "is_persistent",- "type_info": "Bool"- },- {- "ordinal": 13,- "name": "sha",- "type_info": "Text"- },- {- "ordinal": 14,- "name": "viewed_at",- "type_info": "Timestamptz"- },- {- "ordinal": 15,- "name": "sort_ts!",- "type_info": "Timestamptz"- }- ],- "parameters": {- "Left": [- "Text",- "TextArray",- "TextArray",- "TextArray"- ]- },- "nullable": [- null,- null,- null,- null,- null,- null,- null,- null,- null,- null,- null,- null,- null,- null,- null,- null- ]- },- "hash": "495c575d60a26b458bc7c94a66e10634fd02cbd23eecc083108ab8326b73b38f"-}diff --git a/rust/cloud-storage/.sqlx/query-75bdff1c596b09d3937d4915ee3f3e733bbae5308e62b5fe952c5c02e0f03a78.json b/rust/cloud-storage/.sqlx/query-75bdff1c596b09d3937d4915ee3f3e733bbae5308e62b5fe952c5c02e0f03a78.jsondeleted file mode 100644index a8b662fe8f..0000000000--- a/rust/cloud-storage/.sqlx/query-75bdff1c596b09d3937d4915ee3f3e733bbae5308e62b5fe952c5c02e0f03a78.json+++ /dev/null@@ -1,116 +0,0 @@-{- "db_name": "PostgreSQL",- "query": "\n WITH UserAccessibleItems AS (\n SELECT DISTINCT ON (\"item_id\", \"item_type\")\n \"item_id\",\n \"item_type\"\n FROM \"UserItemAccess\" \n WHERE \"user_id\" = $1\n ORDER BY \"item_id\", \"item_type\", \n CASE \"access_level\"\n WHEN 'owner' THEN 4\n WHEN 'edit' THEN 3 \n WHEN 'comment' THEN 2\n WHEN 'view' THEN 1\n ELSE 0\n END DESC\n ),\n Combined AS (\n SELECT\n 'document' as \"item_type!\",\n d.id as \"id!\",\n CAST(COALESCE(di.id, db.id) as TEXT) as \"document_version_id\",\n d.owner as \"user_id!\",\n d.name as \"name!\",\n d.\"branchedFromId\" as \"branched_from_id\",\n d.\"branchedFromVersionId\" as \"branched_from_version_id\", \n d.\"documentFamilyId\" as \"document_family_id\",\n d.\"fileType\" as \"file_type\",\n d.\"createdAt\"::timestamptz as \"created_at!\",\n d.\"updatedAt\"::timestamptz as \"updated_at!\",\n d.\"projectId\" as \"project_id\",\n NULL as \"is_persistent\",\n di.sha as \"sha\",\n uh.\"updatedAt\"::timestamptz as \"viewed_at\",\n CASE $2\n WHEN 'viewed_updated' THEN COALESCE(uh.\"updatedAt\", d.\"updatedAt\")\n WHEN 'viewed_at' THEN COALESCE(uh.\"updatedAt\", '1970-01-01 00:00:00+00')\n WHEN 'created_at' THEN d.\"createdAt\"\n ELSE d.\"updatedAt\"\n END::timestamptz as \"sort_ts!\"\n FROM \"Document\" d\n INNER JOIN UserAccessibleItems uai \n ON uai.item_id = d.id \n AND uai.item_type = 'document'\n LEFT JOIN \"UserHistory\" uh \n ON uh.\"itemId\" = d.id \n AND uh.\"itemType\" = 'document' \n AND uh.\"userId\" = $1\n LEFT JOIN LATERAL (\n SELECT b.id \n FROM \"DocumentBom\" b \n WHERE b.\"documentId\" = d.id \n ORDER BY b.\"createdAt\" DESC \n LIMIT 1\n ) db ON true\n LEFT JOIN LATERAL (\n SELECT i.id, i.sha \n FROM \"DocumentInstance\" i \n WHERE i.\"documentId\" = d.id \n ORDER BY i.\"updatedAt\" DESC \n LIMIT 1\n ) di ON true\n WHERE d.\"deletedAt\" IS NULL\n\n UNION ALL\n \n SELECT\n 'chat' as \"item_type!\",\n c.id as \"id!\",\n NULL as \"document_version_id\",\n c.\"userId\" as \"user_id!\",\n c.name as \"name!\",\n NULL as \"branched_from_id\",\n NULL as \"branched_from_version_id\",\n NULL as \"document_family_id\",\n NULL as \"file_type\",\n c.\"createdAt\"::timestamptz as \"created_at!\",\n c.\"updatedAt\"::timestamptz as \"updated_at!\",\n c.\"projectId\" as \"project_id\",\n c.\"isPersistent\" as \"is_persistent\",\n NULL as \"sha\",\n uh.\"updatedAt\"::timestamptz as \"viewed_at\",\n CASE $2\n WHEN 'viewed_updated' THEN COALESCE(uh.\"updatedAt\", c.\"updatedAt\")\n WHEN 'viewed_at' THEN COALESCE(uh.\"updatedAt\", '1970-01-01 00:00:00+00')\n WHEN 'created_at' THEN c.\"createdAt\"\n ELSE c.\"updatedAt\"\n END::timestamptz as \"sort_ts!\"\n FROM \"Chat\" c\n INNER JOIN UserAccessibleItems uai \n ON uai.item_id = c.id \n AND uai.item_type = 'chat'\n LEFT JOIN \"UserHistory\" uh \n ON uh.\"itemId\" = c.id \n AND uh.\"itemType\" = 'chat' \n AND uh.\"userId\" = $1\n WHERE c.\"deletedAt\" IS NULL\n \n UNION ALL\n \n SELECT\n 'project' as \"item_type!\",\n p.id as \"id!\",\n NULL as \"document_version_id\",\n p.\"userId\" as \"user_id!\",\n p.name as \"name!\",\n NULL as \"branched_from_id\",\n NULL as \"branched_from_version_id\",\n NULL as \"document_family_id\",\n NULL as \"file_type\",\n p.\"createdAt\"::timestamptz as \"created_at!\",\n p.\"updatedAt\"::timestamptz as \"updated_at!\",\n p.\"parentId\" as \"project_id\",\n NULL as \"is_persistent\",\n NULL as \"sha\",\n uh.\"updatedAt\"::timestamptz as \"viewed_at\",\n CASE $2\n WHEN 'viewed_updated' THEN COALESCE(uh.\"updatedAt\", p.\"updatedAt\")\n WHEN 'viewed_at' THEN COALESCE(uh.\"updatedAt\", '1970-01-01 00:00:00+00')\n WHEN 'created_at' THEN p.\"createdAt\"\n ELSE p.\"updatedAt\"\n END::timestamptz as \"sort_ts!\"\n FROM \"Project\" p\n INNER JOIN UserAccessibleItems uai \n ON uai.item_id = p.id \n AND uai.item_type = 'project'\n LEFT JOIN \"UserHistory\" uh \n ON uh.\"itemId\" = p.id \n AND uh.\"itemType\" = 'project' \n AND uh.\"userId\" = $1\n WHERE p.\"deletedAt\" IS NULL\n )\n SELECT * \n FROM Combined\n WHERE ($4::timestamptz IS NULL)\n OR (\"sort_ts!\", \"id!\") < ($4, $5)\n ORDER BY \"sort_ts!\" DESC, \"updated_at!\" DESC\n LIMIT $3\n ",- "describe": {- "columns": [- {- "ordinal": 0,- "name": "item_type!",- "type_info": "Text"- },- {- "ordinal": 1,- "name": "id!",- "type_info": "Text"- },- {- "ordinal": 2,- "name": "document_version_id",- "type_info": "Text"- },- {- "ordinal": 3,- "name": "user_id!",- "type_info": "Text"- },- {- "ordinal": 4,- "name": "name!",- "type_info": "Text"- },- {- "ordinal": 5,- "name": "branched_from_id",- "type_info": "Text"- },- {- "ordinal": 6,- "name": "branched_from_version_id",- "type_info": "Int8"- },- {- "ordinal": 7,- "name": "document_family_id",- "type_info": "Int8"- },- {- "ordinal": 8,- "name": "file_type",- "type_info": "Text"- },- {- "ordinal": 9,- "name": "created_at!",- "type_info": "Timestamptz"- },- {- "ordinal": 10,- "name": "updated_at!",- "type_info": "Timestamptz"- },- {- "ordinal": 11,- "name": "project_id",- "type_info": "Text"- },- {- "ordinal": 12,- "name": "is_persistent",- "type_info": "Bool"- },- {- "ordinal": 13,- "name": "sha",- "type_info": "Text"- },- {- "ordinal": 14,- "name": "viewed_at",- "type_info": "Timestamptz"- },- {- "ordinal": 15,- "name": "sort_ts!",- "type_info": "Timestamptz"- }- ],- "parameters": {- "Left": [- "Text",- "Text",- "Int8",- "Timestamptz",- "Text"- ]- },- "nullable": [- null,- null,- null,- null,- null,- null,- null,- null,- null,- null,- null,- null,- null,- null,- null,- null- ]- },- "hash": "75bdff1c596b09d3937d4915ee3f3e733bbae5308e62b5fe952c5c02e0f03a78"-}diff --git a/rust/cloud-storage/.sqlx/query-a6198b47dbcefc6582b70d02b4fc53980b4443badf42c79682da07e39c81f78d.json b/rust/cloud-storage/.sqlx/query-a6198b47dbcefc6582b70d02b4fc53980b4443badf42c79682da07e39c81f78d.jsondeleted file mode 100644index 0cec289a41..0000000000--- a/rust/cloud-storage/.sqlx/query-a6198b47dbcefc6582b70d02b4fc53980b4443badf42c79682da07e39c81f78d.json+++ /dev/null@@ -1,116 +0,0 @@-{- "db_name": "PostgreSQL",- "query": " \n WITH RECURSIVE ProjectHierarchy AS (\n SELECT p.id, uia.access_level \n FROM \"Project\" p\n JOIN \"UserItemAccess\" uia ON p.id = uia.item_id AND uia.item_type = 'project'\n WHERE uia.user_id = $1 AND p.\"deletedAt\" IS NULL\n UNION ALL\n SELECT p.id, ph.access_level\n FROM \"Project\" p \n JOIN ProjectHierarchy ph ON p.\"parentId\" = ph.id\n WHERE p.\"deletedAt\" IS NULL\n ),\n AllAccessGrants AS (\n SELECT item_id, item_type, access_level \n FROM \"UserItemAccess\" \n WHERE user_id = $1\n UNION ALL\n SELECT d.id AS item_id, 'document' AS item_type, ph.access_level\n FROM \"Document\" d \n JOIN ProjectHierarchy ph ON d.\"projectId\" = ph.id\n WHERE d.\"projectId\" IS NOT NULL AND d.\"deletedAt\" IS NULL\n UNION ALL\n SELECT c.id AS item_id, 'chat' AS item_type, ph.access_level\n FROM \"Chat\" c \n JOIN ProjectHierarchy ph ON c.\"projectId\" = ph.id\n WHERE c.\"projectId\" IS NOT NULL AND c.\"deletedAt\" IS NULL\n UNION ALL\n SELECT ph.id AS item_id, 'project' AS item_type, ph.access_level \n FROM ProjectHierarchy ph\n ),\n UserAccessibleItems AS (\n SELECT DISTINCT ON (item_id, item_type) item_id, item_type\n FROM AllAccessGrants\n ORDER BY item_id, item_type, \n CASE access_level\n WHEN 'owner' THEN 4\n WHEN 'edit' THEN 3 \n WHEN 'comment' THEN 2\n WHEN 'view' THEN 1\n ELSE 0\n END DESC\n ),\n Combined AS (\n SELECT\n 'document' as \"item_type!\",\n d.id as \"id!\",\n CAST(COALESCE(di.id, db.id) as TEXT) as \"document_version_id\",\n d.owner as \"user_id!\",\n d.name as \"name!\",\n d.\"branchedFromId\" as \"branched_from_id\",\n d.\"branchedFromVersionId\" as \"branched_from_version_id\",\n d.\"documentFamilyId\" as \"document_family_id\",\n d.\"fileType\" as \"file_type\",\n d.\"createdAt\"::timestamptz as \"created_at!\",\n d.\"updatedAt\"::timestamptz as \"updated_at!\",\n d.\"projectId\" as \"project_id\",\n NULL as \"is_persistent\",\n di.sha as \"sha\",\n uh.\"updatedAt\"::timestamptz as \"viewed_at\",\n CASE $2\n WHEN 'viewed_updated' THEN COALESCE(uh.\"updatedAt\", d.\"updatedAt\")\n WHEN 'viewed_at' THEN COALESCE(uh.\"updatedAt\", '1970-01-01 00:00:00+00')\n WHEN 'created_at' THEN d.\"createdAt\"\n ELSE d.\"updatedAt\"\n END::timestamptz as \"sort_ts!\"\n FROM \"Document\" d\n INNER JOIN UserAccessibleItems uai ON uai.item_id = d.id AND uai.item_type = 'document'\n -- This MUST be a LEFT JOIN to support all three sort methods\n LEFT JOIN \"UserHistory\" uh ON uh.\"itemId\" = d.id AND uh.\"itemType\" = 'document' AND uh.\"userId\" = $1\n LEFT JOIN LATERAL (\n SELECT b.id \n FROM \"DocumentBom\" b \n WHERE b.\"documentId\" = d.id \n ORDER BY b.\"createdAt\" DESC \n LIMIT 1\n ) db ON true\n LEFT JOIN LATERAL (\n SELECT i.id, i.sha \n FROM \"DocumentInstance\" i \n WHERE i.\"documentId\" = d.id \n ORDER BY i.\"updatedAt\" DESC \n LIMIT 1\n ) di ON true\n WHERE d.\"deletedAt\" IS NULL\n\n UNION ALL\n \n SELECT\n 'chat' as \"item_type!\",\n c.id as \"id!\",\n NULL as \"document_version_id\",\n c.\"userId\" as \"user_id!\",\n c.name as \"name!\",\n NULL as \"branched_from_id\",\n NULL as \"branched_from_version_id\",\n NULL as \"document_family_id\",\n NULL as \"file_type\",\n c.\"createdAt\"::timestamptz as \"created_at!\",\n c.\"updatedAt\"::timestamptz as \"updated_at!\",\n c.\"projectId\" as \"project_id\",\n c.\"isPersistent\" as \"is_persistent\",\n NULL as \"sha\",\n uh.\"updatedAt\"::timestamptz as \"viewed_at\",\n CASE $2\n WHEN 'viewed_updated' THEN COALESCE(uh.\"updatedAt\", c.\"updatedAt\")\n WHEN 'viewed_at' THEN COALESCE(uh.\"updatedAt\", '1970-01-01 00:00:00+00')\n WHEN 'created_at' THEN c.\"createdAt\"\n ELSE c.\"updatedAt\"\n END::timestamptz as \"sort_ts!\"\n FROM \"Chat\" c\n INNER JOIN UserAccessibleItems uai ON uai.item_id = c.id AND uai.item_type = 'chat'\n LEFT JOIN \"UserHistory\" uh ON uh.\"itemId\" = c.id AND uh.\"itemType\" = 'chat' AND uh.\"userId\" = $1\n WHERE c.\"deletedAt\" IS NULL\n )\n SELECT * FROM Combined\n WHERE\n ($4::timestamptz IS NULL)\n OR\n (\"sort_ts!\", \"id!\") < ($4, $5)\n ORDER BY \"sort_ts!\" DESC, \"updated_at!\" DESC\n LIMIT $3\n",- "describe": {- "columns": [- {- "ordinal": 0,- "name": "item_type!",- "type_info": "Text"- },- {- "ordinal": 1,- "name": "id!",- "type_info": "Text"- },- {- "ordinal": 2,- "name": "document_version_id",- "type_info": "Text"- },- {- "ordinal": 3,- "name": "user_id!",- "type_info": "Text"- },- {- "ordinal": 4,- "name": "name!",- "type_info": "Text"- },- {- "ordinal": 5,- "name": "branched_from_id",- "type_info": "Text"- },- {- "ordinal": 6,- "name": "branched_from_version_id",- "type_info": "Int8"- },- {- "ordinal": 7,- "name": "document_family_id",- "type_info": "Int8"- },- {- "ordinal": 8,- "name": "file_type",- "type_info": "Text"- },- {- "ordinal": 9,- "name": "created_at!",- "type_info": "Timestamptz"- },- {- "ordinal": 10,- "name": "updated_at!",- "type_info": "Timestamptz"- },- {- "ordinal": 11,- "name": "project_id",- "type_info": "Text"- },- {- "ordinal": 12,- "name": "is_persistent",- "type_info": "Bool"- },- {- "ordinal": 13,- "name": "sha",- "type_info": "Text"- },- {- "ordinal": 14,- "name": "viewed_at",- "type_info": "Timestamptz"- },- {- "ordinal": 15,- "name": "sort_ts!",- "type_info": "Timestamptz"- }- ],- "parameters": {- "Left": [- "Text",- "Text",- "Int8",- "Timestamptz",- "Text"- ]- },- "nullable": [- null,- null,- null,- null,- null,- null,- null,- null,- null,- null,- null,- null,- null,- null,- null,- null- ]- },- "hash": "a6198b47dbcefc6582b70d02b4fc53980b4443badf42c79682da07e39c81f78d"-}diff --git a/rust/cloud-storage/.sqlx/query-c208856e2f2bec2528358118007f6092a068983036fc0c668f477e02cea6f2df.json b/rust/cloud-storage/.sqlx/query-c208856e2f2bec2528358118007f6092a068983036fc0c668f477e02cea6f2df.jsondeleted file mode 100644index 09c1c893ec..0000000000--- a/rust/cloud-storage/.sqlx/query-c208856e2f2bec2528358118007f6092a068983036fc0c668f477e02cea6f2df.json+++ /dev/null@@ -1,108 +0,0 @@-{- "db_name": "PostgreSQL",- "query": "\n WITH RECURSIVE ProjectHierarchy AS (\n SELECT p.id, uia.access_level \n FROM \"Project\" p\n JOIN \"UserItemAccess\" uia ON p.id = uia.item_id AND uia.item_type = 'project'\n WHERE uia.user_id = $1 AND p.\"deletedAt\" IS NULL\n UNION ALL\n SELECT p.id, ph.access_level\n FROM \"Project\" p \n JOIN ProjectHierarchy ph ON p.\"parentId\" = ph.id\n WHERE p.\"deletedAt\" IS NULL\n ),\n AllAccessGrants AS (\n SELECT item_id, item_type, access_level \n FROM \"UserItemAccess\" \n WHERE user_id = $1\n UNION ALL\n SELECT d.id AS item_id, 'document' AS item_type, ph.access_level\n FROM \"Document\" d \n JOIN ProjectHierarchy ph ON d.\"projectId\" = ph.id\n WHERE d.\"projectId\" IS NOT NULL AND d.\"deletedAt\" IS NULL\n UNION ALL\n SELECT c.id AS item_id, 'chat' AS item_type, ph.access_level\n FROM \"Chat\" c \n JOIN ProjectHierarchy ph ON c.\"projectId\" = ph.id\n WHERE c.\"projectId\" IS NOT NULL AND c.\"deletedAt\" IS NULL\n UNION ALL\n SELECT ph.id AS item_id, 'project' AS item_type, ph.access_level \n FROM ProjectHierarchy ph\n ),\n UserAccessibleItems AS (\n SELECT DISTINCT ON (item_id, item_type) item_id, item_type\n FROM AllAccessGrants\n ORDER BY item_id, item_type, \n CASE access_level\n WHEN 'owner' THEN 4\n WHEN 'edit' THEN 3 \n WHEN 'comment' THEN 2\n WHEN 'view' THEN 1\n ELSE 0\n END DESC\n ),\n Combined AS (\n SELECT\n 'document' as \"item_type!\",\n d.id as \"id!\",\n CAST(COALESCE(di.id, db.id) as TEXT) as \"document_version_id\",\n d.owner as \"user_id!\",\n d.name as \"name!\",\n d.\"branchedFromId\" as \"branched_from_id\",\n d.\"branchedFromVersionId\" as \"branched_from_version_id\",\n d.\"documentFamilyId\" as \"document_family_id\",\n d.\"fileType\" as \"file_type\",\n d.\"createdAt\"::timestamptz as \"created_at!\",\n d.\"updatedAt\"::timestamptz as \"updated_at!\",\n d.\"projectId\" as \"project_id\",\n NULL as \"is_persistent\",\n di.sha as \"sha\",\n uh.\"updatedAt\"::timestamptz as \"viewed_at\"\n FROM \"Document\" d\n INNER JOIN UserAccessibleItems uai \n ON uai.item_id = d.id \n AND uai.item_type = 'document'\n LEFT JOIN \"UserHistory\" uh \n ON uh.\"itemId\" = d.id \n AND uh.\"itemType\" = 'document' \n AND uh.\"userId\" = $1\n LEFT JOIN LATERAL (\n SELECT b.id \n FROM \"DocumentBom\" b \n WHERE b.\"documentId\" = d.id \n ORDER BY b.\"createdAt\" DESC \n LIMIT 1\n ) db ON true\n LEFT JOIN LATERAL (\n SELECT i.id, i.sha \n FROM \"DocumentInstance\" i \n WHERE i.\"documentId\" = d.id \n ORDER BY i.\"updatedAt\" DESC \n LIMIT 1\n ) di ON true\n WHERE d.\"deletedAt\" IS NULL\n AND d.id = ANY($2::text[])\n\n UNION ALL\n \n SELECT\n 'chat' as \"item_type!\",\n c.id as \"id!\",\n NULL as \"document_version_id\",\n c.\"userId\" as \"user_id!\",\n c.name as \"name!\",\n NULL as \"branched_from_id\",\n NULL as \"branched_from_version_id\",\n NULL as \"document_family_id\",\n NULL as \"file_type\",\n c.\"createdAt\"::timestamptz as \"created_at!\",\n c.\"updatedAt\"::timestamptz as \"updated_at!\",\n c.\"projectId\" as \"project_id\",\n c.\"isPersistent\" as \"is_persistent\",\n NULL as \"sha\",\n uh.\"updatedAt\"::timestamptz as \"viewed_at\"\n FROM \"Chat\" c\n INNER JOIN UserAccessibleItems uai \n ON uai.item_id = c.id \n AND uai.item_type = 'chat'\n LEFT JOIN \"UserHistory\" uh \n ON uh.\"itemId\" = c.id \n AND uh.\"itemType\" = 'chat' \n AND uh.\"userId\" = $1\n WHERE c.\"deletedAt\" IS NULL\n AND c.id = ANY($3::text[])\n )\n SELECT * \n FROM Combined\n ",- "describe": {- "columns": [- {- "ordinal": 0,- "name": "item_type!",- "type_info": "Text"- },- {- "ordinal": 1,- "name": "id!",- "type_info": "Text"- },- {- "ordinal": 2,- "name": "document_version_id",- "type_info": "Text"- },- {- "ordinal": 3,- "name": "user_id!",- "type_info": "Text"- },- {- "ordinal": 4,- "name": "name!",- "type_info": "Text"- },- {- "ordinal": 5,- "name": "branched_from_id",- "type_info": "Text"- },- {- "ordinal": 6,- "name": "branched_from_version_id",- "type_info": "Int8"- },- {- "ordinal": 7,- "name": "document_family_id",- "type_info": "Int8"- },- {- "ordinal": 8,- "name": "file_type",- "type_info": "Text"- },- {- "ordinal": 9,- "name": "created_at!",- "type_info": "Timestamptz"- },- {- "ordinal": 10,- "name": "updated_at!",- "type_info": "Timestamptz"- },- {- "ordinal": 11,- "name": "project_id",- "type_info": "Text"- },- {- "ordinal": 12,- "name": "is_persistent",- "type_info": "Bool"- },- {- "ordinal": 13,- "name": "sha",- "type_info": "Text"- },- {- "ordinal": 14,- "name": "viewed_at",- "type_info": "Timestamptz"- }- ],- "parameters": {- "Left": [- "Text",- "TextArray",- "TextArray"- ]- },- "nullable": [- null,- null,- null,- null,- null,- null,- null,- null,- null,- null,- null,- null,- null,- null,- null- ]- },- "hash": "c208856e2f2bec2528358118007f6092a068983036fc0c668f477e02cea6f2df"-}diff --git a/rust/cloud-storage/.sqlx/query-c620bfe9a68fc36c22cd7f8d023b030f8088ee62691a0c8128608801ef20900c.json b/rust/cloud-storage/.sqlx/query-c620bfe9a68fc36c22cd7f8d023b030f8088ee62691a0c8128608801ef20900c.jsondeleted file mode 100644index 0c9f3544b2..0000000000--- a/rust/cloud-storage/.sqlx/query-c620bfe9a68fc36c22cd7f8d023b030f8088ee62691a0c8128608801ef20900c.json+++ /dev/null@@ -1,116 +0,0 @@-{- "db_name": "PostgreSQL",- "query": "\n WITH UserAccessibleItems AS (\n SELECT DISTINCT ON (\"item_id\", \"item_type\")\n \"item_id\",\n \"item_type\"\n FROM \"UserItemAccess\" \n WHERE \"user_id\" = $1\n ORDER BY \"item_id\", \"item_type\", \n CASE \"access_level\"\n WHEN 'owner' THEN 4\n WHEN 'edit' THEN 3 \n WHEN 'comment' THEN 2\n WHEN 'view' THEN 1\n ELSE 0\n END DESC\n ),\n Combined AS (\n SELECT\n 'document' as \"item_type!\",\n d.id as \"id!\",\n CAST(COALESCE(di.id, db.id) as TEXT) as \"document_version_id\",\n d.owner as \"user_id!\",\n d.name as \"name!\",\n d.\"branchedFromId\" as \"branched_from_id\",\n d.\"branchedFromVersionId\" as \"branched_from_version_id\", \n d.\"documentFamilyId\" as \"document_family_id\",\n d.\"fileType\" as \"file_type\",\n d.\"createdAt\"::timestamptz as \"created_at!\",\n d.\"updatedAt\"::timestamptz as \"updated_at!\",\n d.\"projectId\" as \"project_id\",\n NULL as \"is_persistent\",\n di.sha as \"sha\",\n uh.\"updatedAt\"::timestamptz as \"viewed_at\",\n CASE $2\n WHEN 'viewed_updated' THEN COALESCE(uh.\"updatedAt\", d.\"updatedAt\")\n WHEN 'viewed_at' THEN COALESCE(uh.\"updatedAt\", '1970-01-01 00:00:00+00')\n WHEN 'created_at' THEN d.\"createdAt\"\n ELSE d.\"updatedAt\"\n END::timestamptz as \"sort_ts!\"\n FROM \"Document\" d\n INNER JOIN UserAccessibleItems uai \n ON uai.item_id = d.id \n AND uai.item_type = 'document'\n LEFT JOIN \"UserHistory\" uh \n ON uh.\"itemId\" = d.id \n AND uh.\"itemType\" = 'document' \n AND uh.\"userId\" = $1\n LEFT JOIN LATERAL (\n SELECT b.id \n FROM \"DocumentBom\" b \n WHERE b.\"documentId\" = d.id \n ORDER BY b.\"createdAt\" DESC \n LIMIT 1\n ) db ON true\n LEFT JOIN LATERAL (\n SELECT i.id, i.sha \n FROM \"DocumentInstance\" i \n WHERE i.\"documentId\" = d.id \n ORDER BY i.\"updatedAt\" DESC \n LIMIT 1\n ) di ON true\n WHERE d.\"deletedAt\" IS NULL\n\n UNION ALL\n \n SELECT\n 'chat' as \"item_type!\",\n c.id as \"id!\",\n NULL as \"document_version_id\",\n c.\"userId\" as \"user_id!\",\n c.name as \"name!\",\n NULL as \"branched_from_id\",\n NULL as \"branched_from_version_id\",\n NULL as \"document_family_id\",\n NULL as \"file_type\",\n c.\"createdAt\"::timestamptz as \"created_at!\",\n c.\"updatedAt\"::timestamptz as \"updated_at!\",\n c.\"projectId\" as \"project_id\",\n c.\"isPersistent\" as \"is_persistent\",\n NULL as \"sha\",\n uh.\"updatedAt\"::timestamptz as \"viewed_at\",\n CASE $2\n WHEN 'viewed_updated' THEN COALESCE(uh.\"updatedAt\", c.\"updatedAt\")\n WHEN 'viewed_at' THEN COALESCE(uh.\"updatedAt\", '1970-01-01 00:00:00+00')\n WHEN 'created_at' THEN c.\"createdAt\"\n ELSE c.\"updatedAt\"\n END::timestamptz as \"sort_ts!\"\n FROM \"Chat\" c\n INNER JOIN UserAccessibleItems uai \n ON uai.item_id = c.id \n AND uai.item_type = 'chat'\n LEFT JOIN \"UserHistory\" uh \n ON uh.\"itemId\" = c.id \n AND uh.\"itemType\" = 'chat' \n AND uh.\"userId\" = $1\n WHERE c.\"deletedAt\" IS NULL\n \n UNION ALL\n \n SELECT\n 'project' as \"item_type!\",\n p.id as \"id!\",\n NULL as \"document_version_id\",\n p.\"userId\" as \"user_id!\",\n p.name as \"name!\",\n NULL as \"branched_from_id\",\n NULL as \"branched_from_version_id\",\n NULL as \"document_family_id\",\n NULL as \"file_type\",\n p.\"createdAt\"::timestamptz as \"created_at!\",\n p.\"updatedAt\"::timestamptz as \"updated_at!\",\n p.\"parentId\" as \"project_id\",\n NULL as \"is_persistent\",\n NULL as \"sha\",\n uh.\"updatedAt\"::timestamptz as \"viewed_at\",\n CASE $2\n WHEN 'viewed_updated' THEN COALESCE(uh.\"updatedAt\", p.\"updatedAt\")\n WHEN 'viewed_at' THEN COALESCE(uh.\"updatedAt\", '1970-01-01 00:00:00+00')\n WHEN 'created_at' THEN p.\"createdAt\"\n ELSE p.\"updatedAt\"\n END::timestamptz as \"sort_ts!\"\n FROM \"Project\" p\n INNER JOIN UserAccessibleItems uai \n ON uai.item_id = p.id \n AND uai.item_type = 'project'\n LEFT JOIN \"UserHistory\" uh \n ON uh.\"itemId\" = p.id \n AND uh.\"itemType\" = 'project' \n AND uh.\"userId\" = $1\n WHERE p.\"deletedAt\" IS NULL\n )\n SELECT Combined.* FROM Combined\n LEFT JOIN frecency_aggregates fa\n ON fa.entity_id = Combined.\"id!\"\n AND fa.entity_type = Combined.\"item_type!\"\n AND fa.user_id = $1\n WHERE fa.id IS NULL\n AND (\n ($4::timestamptz IS NULL)\n OR\n (Combined.\"sort_ts!\", Combined.\"id!\") < ($4, $5)\n )\n ORDER BY Combined.\"sort_ts!\" DESC, Combined.\"updated_at!\" DESC\n LIMIT $3\n ",- "describe": {- "columns": [- {- "ordinal": 0,- "name": "item_type!",- "type_info": "Text"- },- {- "ordinal": 1,- "name": "id!",- "type_info": "Text"- },- {- "ordinal": 2,- "name": "document_version_id",- "type_info": "Text"- },- {- "ordinal": 3,- "name": "user_id!",- "type_info": "Text"- },- {- "ordinal": 4,- "name": "name!",- "type_info": "Text"- },- {- "ordinal": 5,- "name": "branched_from_id",- "type_info": "Text"- },- {- "ordinal": 6,- "name": "branched_from_version_id",- "type_info": "Int8"- },- {- "ordinal": 7,- "name": "document_family_id",- "type_info": "Int8"- },- {- "ordinal": 8,- "name": "file_type",- "type_info": "Text"- },- {- "ordinal": 9,- "name": "created_at!",- "type_info": "Timestamptz"- },- {- "ordinal": 10,- "name": "updated_at!",- "type_info": "Timestamptz"- },- {- "ordinal": 11,- "name": "project_id",- "type_info": "Text"- },- {- "ordinal": 12,- "name": "is_persistent",- "type_info": "Bool"- },- {- "ordinal": 13,- "name": "sha",- "type_info": "Text"- },- {- "ordinal": 14,- "name": "viewed_at",- "type_info": "Timestamptz"- },- {- "ordinal": 15,- "name": "sort_ts!",- "type_info": "Timestamptz"- }- ],- "parameters": {- "Left": [- "Text",- "Text",- "Int8",- "Timestamptz",- "Text"- ]- },- "nullable": [- null,- null,- null,- null,- null,- null,- null,- null,- null,- null,- null,- null,- null,- null,- null,- null- ]- },- "hash": "c620bfe9a68fc36c22cd7f8d023b030f8088ee62691a0c8128608801ef20900c"-}diff --git a/rust/cloud-storage/.sqlx/query-d8b00829790cb1d1e0e6597d3ddd5a3d36782651b3e7786473e63fee507c7794.json b/rust/cloud-storage/.sqlx/query-d8b00829790cb1d1e0e6597d3ddd5a3d36782651b3e7786473e63fee507c7794.jsondeleted file mode 100644index 292bea3da3..0000000000--- a/rust/cloud-storage/.sqlx/query-d8b00829790cb1d1e0e6597d3ddd5a3d36782651b3e7786473e63fee507c7794.json+++ /dev/null@@ -1,116 +0,0 @@-{- "db_name": "PostgreSQL",- "query": " \n WITH RECURSIVE ProjectHierarchy AS (\n SELECT p.id, uia.access_level \n FROM \"Project\" p\n JOIN \"UserItemAccess\" uia ON p.id = uia.item_id AND uia.item_type = 'project'\n WHERE uia.user_id = $1 AND p.\"deletedAt\" IS NULL\n UNION ALL\n SELECT p.id, ph.access_level\n FROM \"Project\" p \n JOIN ProjectHierarchy ph ON p.\"parentId\" = ph.id\n WHERE p.\"deletedAt\" IS NULL\n ),\n AllAccessGrants AS (\n SELECT item_id, item_type, access_level \n FROM \"UserItemAccess\" \n WHERE user_id = $1\n UNION ALL\n SELECT d.id AS item_id, 'document' AS item_type, ph.access_level\n FROM \"Document\" d \n JOIN ProjectHierarchy ph ON d.\"projectId\" = ph.id\n WHERE d.\"projectId\" IS NOT NULL AND d.\"deletedAt\" IS NULL\n UNION ALL\n SELECT c.id AS item_id, 'chat' AS item_type, ph.access_level\n FROM \"Chat\" c \n JOIN ProjectHierarchy ph ON c.\"projectId\" = ph.id\n WHERE c.\"projectId\" IS NOT NULL AND c.\"deletedAt\" IS NULL\n UNION ALL\n SELECT ph.id AS item_id, 'project' AS item_type, ph.access_level \n FROM ProjectHierarchy ph\n ),\n UserAccessibleItems AS (\n SELECT DISTINCT ON (item_id, item_type) item_id, item_type\n FROM AllAccessGrants\n ORDER BY item_id, item_type, \n CASE access_level\n WHEN 'owner' THEN 4\n WHEN 'edit' THEN 3 \n WHEN 'comment' THEN 2\n WHEN 'view' THEN 1\n ELSE 0\n END DESC\n ),\n Combined AS (\n SELECT\n 'document' as \"item_type!\",\n d.id as \"id!\",\n CAST(COALESCE(di.id, db.id) as TEXT) as \"document_version_id\",\n d.owner as \"user_id!\",\n d.name as \"name!\",\n d.\"branchedFromId\" as \"branched_from_id\",\n d.\"branchedFromVersionId\" as \"branched_from_version_id\",\n d.\"documentFamilyId\" as \"document_family_id\",\n d.\"fileType\" as \"file_type\",\n d.\"createdAt\"::timestamptz as \"created_at!\",\n d.\"updatedAt\"::timestamptz as \"updated_at!\",\n d.\"projectId\" as \"project_id\",\n NULL as \"is_persistent\",\n di.sha as \"sha\",\n uh.\"updatedAt\"::timestamptz as \"viewed_at\",\n CASE $2\n WHEN 'viewed_updated' THEN COALESCE(uh.\"updatedAt\", d.\"updatedAt\")\n WHEN 'viewed_at' THEN COALESCE(uh.\"updatedAt\", '1970-01-01 00:00:00+00')\n WHEN 'created_at' THEN d.\"createdAt\"\n ELSE d.\"updatedAt\"\n END::timestamptz as \"sort_ts!\"\n FROM \"Document\" d\n INNER JOIN UserAccessibleItems uai ON uai.item_id = d.id AND uai.item_type = 'document'\n -- This MUST be a LEFT JOIN to support all three sort methods\n LEFT JOIN \"UserHistory\" uh ON uh.\"itemId\" = d.id AND uh.\"itemType\" = 'document' AND uh.\"userId\" = $1\n LEFT JOIN LATERAL (\n SELECT b.id \n FROM \"DocumentBom\" b \n WHERE b.\"documentId\" = d.id \n ORDER BY b.\"createdAt\" DESC \n LIMIT 1\n ) db ON true\n LEFT JOIN LATERAL (\n SELECT i.id, i.sha \n FROM \"DocumentInstance\" i \n WHERE i.\"documentId\" = d.id \n ORDER BY i.\"updatedAt\" DESC \n LIMIT 1\n ) di ON true\n WHERE d.\"deletedAt\" IS NULL\n\n UNION ALL\n \n SELECT\n 'chat' as \"item_type!\",\n c.id as \"id!\",\n NULL as \"document_version_id\",\n c.\"userId\" as \"user_id!\",\n c.name as \"name!\",\n NULL as \"branched_from_id\",\n NULL as \"branched_from_version_id\",\n NULL as \"document_family_id\",\n NULL as \"file_type\",\n c.\"createdAt\"::timestamptz as \"created_at!\",\n c.\"updatedAt\"::timestamptz as \"updated_at!\",\n c.\"projectId\" as \"project_id\",\n c.\"isPersistent\" as \"is_persistent\",\n NULL as \"sha\",\n uh.\"updatedAt\"::timestamptz as \"viewed_at\",\n CASE $2\n WHEN 'viewed_updated' THEN COALESCE(uh.\"updatedAt\", c.\"updatedAt\")\n WHEN 'viewed_at' THEN COALESCE(uh.\"updatedAt\", '1970-01-01 00:00:00+00')\n WHEN 'created_at' THEN c.\"createdAt\"\n ELSE c.\"updatedAt\"\n END::timestamptz as \"sort_ts!\"\n FROM \"Chat\" c\n INNER JOIN UserAccessibleItems uai ON uai.item_id = c.id AND uai.item_type = 'chat'\n LEFT JOIN \"UserHistory\" uh ON uh.\"itemId\" = c.id AND uh.\"itemType\" = 'chat' AND uh.\"userId\" = $1\n WHERE c.\"deletedAt\" IS NULL\n )\n SELECT Combined.* FROM Combined\n LEFT JOIN frecency_aggregates fa\n ON fa.entity_id = Combined.\"id!\"\n AND fa.entity_type = Combined.\"item_type!\"\n AND fa.user_id = $1\n WHERE fa.id IS NULL\n AND (\n ($4::timestamptz IS NULL)\n OR\n (Combined.\"sort_ts!\", Combined.\"id!\") < ($4, $5)\n )\n ORDER BY Combined.\"sort_ts!\" DESC, Combined.\"updated_at!\" DESC\n LIMIT $3\n ",- "describe": {- "columns": [- {- "ordinal": 0,- "name": "item_type!",- "type_info": "Text"- },- {- "ordinal": 1,- "name": "id!",- "type_info": "Text"- },- {- "ordinal": 2,- "name": "document_version_id",- "type_info": "Text"- },- {- "ordinal": 3,- "name": "user_id!",- "type_info": "Text"- },- {- "ordinal": 4,- "name": "name!",- "type_info": "Text"- },- {- "ordinal": 5,- "name": "branched_from_id",- "type_info": "Text"- },- {- "ordinal": 6,- "name": "branched_from_version_id",- "type_info": "Int8"- },- {- "ordinal": 7,- "name": "document_family_id",- "type_info": "Int8"- },- {- "ordinal": 8,- "name": "file_type",- "type_info": "Text"- },- {- "ordinal": 9,- "name": "created_at!",- "type_info": "Timestamptz"- },- {- "ordinal": 10,- "name": "updated_at!",- "type_info": "Timestamptz"- },- {- "ordinal": 11,- "name": "project_id",- "type_info": "Text"- },- {- "ordinal": 12,- "name": "is_persistent",- "type_info": "Bool"- },- {- "ordinal": 13,- "name": "sha",- "type_info": "Text"- },- {- "ordinal": 14,- "name": "viewed_at",- "type_info": "Timestamptz"- },- {- "ordinal": 15,- "name": "sort_ts!",- "type_info": "Timestamptz"- }- ],- "parameters": {- "Left": [- "Text",- "Text",- "Int8",- "Timestamptz",- "Text"- ]- },- "nullable": [- null,- null,- null,- null,- null,- null,- null,- null,- null,- null,- null,- null,- null,- null,- null,- null- ]- },- "hash": "d8b00829790cb1d1e0e6597d3ddd5a3d36782651b3e7786473e63fee507c7794"-}diff --git a/rust/cloud-storage/Cargo.lock b/rust/cloud-storage/Cargo.lockindex cda74e7493..7ec3ad0439 100644--- a/rust/cloud-storage/Cargo.lock+++ b/rust/cloud-storage/Cargo.lock@@ -5712,6 +5712,7 @@ dependencies = ["macro_user_id","model-entity","models_pagination",+ "models_properties","serde","strum","utoipa",@@ -8275,9 +8276,11 @@ dependencies = ["model-error-response","model_user","models_pagination",+ "models_properties","models_soup","non_empty","ordered-float",+ "properties_db_client","recursion","rootcause","schemars",diff --git a/rust/cloud-storage/README.md b/rust/cloud-storage/README.mdindex 2851f9ddd3..e75fda3b91 100644--- a/rust/cloud-storage/README.md+++ b/rust/cloud-storage/README.md@@ -19,9 +19,13 @@ docker volume create macro_db_volumedocker-compose up -d macrodbjust setup_test_envsjust initialize_dbs-just test+cargo test # NB: SQLX_OFFLINE should NOT be set```+## clean up++To start with a fresh database in docker clear it with: `docker-compose down && docker rm $(docker ps -qa) && docker volume rm macro_db_volume`. Then run the setup above.+## DeploymentTo learn more read the [infra](./infra/README.md) documentation.diff --git a/rust/cloud-storage/macro_db_client/fixtures/soup_items_with_properties.sql b/rust/cloud-storage/macro_db_client/fixtures/soup_items_with_properties.sqlnew file mode 100644index 0000000000..e8f0e71054--- /dev/null+++ b/rust/cloud-storage/macro_db_client/fixtures/soup_items_with_properties.sql@@ -0,0 +1,86 @@+-- This fixture builds on mixed_items_expanded to add system properties to documents and projects+-- Disable foreign key constraints temporarily for easier setup+SET session_replication_role = 'replica';++---------------------------------+-- BASE SETUP: USER & ORG+---------------------------------++-- Create Organization (needed for User foreign key)+INSERT INTO public."Organization" ("id", "name", "status")+VALUES (1, 'Test Organization', 'PILOT')+ON CONFLICT DO NOTHING;++-- Insert user+INSERT INTO public."User" ("id", "email", "stripeCustomerId", "organizationId")+VALUES ('macro|[email protected]', '[email protected]', 'stripe_id_1', 1)+ON CONFLICT DO NOTHING;++---------------------------------+-- PROJECT HIERARCHY SETUP+---------------------------------++INSERT INTO public."Project" ("id", "name", "userId", "parentId", "createdAt", "updatedAt")+VALUES ('aaaaaaaa-ffff-ffff-ffff-ffffffffffff', 'Project A (User has VIEW)', 'macro|[email protected]', NULL, '2023-01-01 10:00:00', '2023-01-01 10:00:00');++INSERT INTO public."Project" ("id", "name", "userId", "parentId", "createdAt", "updatedAt")+VALUES ('bbbbbbbb-ffff-ffff-ffff-ffffffffffff', 'Project B (Child of A)', 'macro|[email protected]', 'aaaaaaaa-ffff-ffff-ffff-ffffffffffff', '2023-01-01 11:00:00', '2023-01-01 11:00:00');++---------------------------------------------------+-- DOCUMENTS AND THEIR DEPENDENCIES+---------------------------------------------------++INSERT INTO public."DocumentFamily" ("id", "rootDocumentId")+VALUES (1, '11111111-aaaa-aaaa-aaaa-aaaaaaaaaaaa'),+ (2, '11111111-bbbb-bbbb-bbbb-bbbbbbbbbbbb');++INSERT INTO public."Document" ("id", "name", "owner", "projectId", "documentFamilyId", "fileType", "createdAt", "updatedAt")+VALUES ('11111111-aaaa-aaaa-aaaa-aaaaaaaaaaaa', 'Document in A', 'macro|[email protected]', 'aaaaaaaa-ffff-ffff-ffff-ffffffffffff', 1, 'pdf', '2023-01-05 10:00:00', '2023-01-05 10:00:00'),+ ('11111111-bbbb-bbbb-bbbb-bbbbbbbbbbbb', 'Document in B', 'macro|[email protected]', 'bbbbbbbb-ffff-ffff-ffff-ffffffffffff', 2, 'pdf', '2023-01-05 11:00:00', '2023-01-05 11:00:00');++INSERT INTO public."DocumentInstance" ("id", "documentId", "sha", "createdAt", "updatedAt")+VALUES (1, '11111111-aaaa-aaaa-aaaa-aaaaaaaaaaaa', 'sha_A', '2023-01-05 10:00:00', '2023-01-05 10:00:00'),+ (2, '11111111-bbbb-bbbb-bbbb-bbbbbbbbbbbb', 'sha_B', '2023-01-05 11:00:00', '2023-01-05 11:00:00');++---------------------------------------------------+-- USER ACCESS PERMISSIONS (UserItemAccess)+---------------------------------------------------++INSERT INTO public."UserItemAccess" ("id", "user_id", "item_id", "item_type", "access_level")+VALUES+(gen_random_uuid(), 'macro|[email protected]', 'aaaaaaaa-ffff-ffff-ffff-ffffffffffff', 'project', 'view'),+(gen_random_uuid(), 'macro|[email protected]', '11111111-bbbb-bbbb-bbbb-bbbbbbbbbbbb', 'document', 'edit');++---------------------------------------------------+-- ENTITY PROPERTIES FOR DOCUMENTS AND PROJECTS+---------------------------------------------------++INSERT INTO entity_properties (id, entity_id, entity_type, property_definition_id, values)+VALUES+ -- Document in A: Priority = Low, Status = In Progress+ (+ 'e1111111-aaaa-aaaa-aaaa-aaaaaaaaaaaa', -- id of this thing?+ '11111111-aaaa-aaaa-aaaa-aaaaaaaaaaaa', -- doc a id+ 'DOCUMENT', -- entity_type+ '00000001-0000-0000-0000-000000000003', -- property_def_id Priority+ '{"type": "SelectOption", "value": ["00000001-0000-0000-0003-000000000001"]}' -- values. id of "Low" in property_options+ ),+ (+ 'e2222222-aaaa-aaaa-aaaa-aaaaaaaaaaaa',+ '11111111-aaaa-aaaa-aaaa-aaaaaaaaaaaa',+ 'DOCUMENT',+ '00000001-0000-0000-0000-000000000002',+ '{"type": "SelectOption",+ "value": ["00000001-0000-0000-0002-000000000004"]}'+ ),++ -- Document in B: Priority = Low, Due Date set+ ('e1111111-bbbb-bbbb-bbbb-bbbbbbbbbbbb', '11111111-bbbb-bbbb-bbbb-bbbbbbbbbbbb', 'DOCUMENT', '00000001-0000-0000-0000-000000000003', '{"type": "SelectOption", "value": ["00000001-0000-0000-0003-000000000001"]}'),+ ('e2222222-bbbb-bbbb-bbbb-bbbbbbbbbbbb', '11111111-bbbb-bbbb-bbbb-bbbbbbbbbbbb', 'DOCUMENT', '00000001-0000-0000-0000-000000000004', '{"type": "Date", "value": "2025-12-31T23:59:59Z"}'),++ -- Project A: Priority = Medium+ ('e1111111-ffff-ffff-ffff-ffffffffffff', 'aaaaaaaa-ffff-ffff-ffff-ffffffffffff', 'PROJECT', '00000001-0000-0000-0000-000000000003', '{"type": "SelectOption", "value": ["00000001-0000-0000-0003-000000000002"]}')+ON CONFLICT (id) DO NOTHING;++-- Re-enable foreign key constraints+SET session_replication_role = 'origin';diff --git a/rust/cloud-storage/models_soup/Cargo.toml b/rust/cloud-storage/models_soup/Cargo.tomlindex 44b43b8d73..f517c4ffd5 100644--- a/rust/cloud-storage/models_soup/Cargo.toml+++ b/rust/cloud-storage/models_soup/Cargo.toml@@ -18,6 +18,7 @@ email = { path = "../email" }macro_user_id = { path = "../macro_user_id" }model-entity = { path = "../model-entity" }models_pagination = { path = "../models_pagination" }+models_properties = { path = "../models_properties/" }serde = { workspace = true }strum = { workspace = true }utoipa = { workspace = true, optional = true }diff --git a/rust/cloud-storage/models_soup/src/chat.rs b/rust/cloud-storage/models_soup/src/chat.rsindex bfb868446c..55b57a84c1 100644--- a/rust/cloud-storage/models_soup/src/chat.rs+++ b/rust/cloud-storage/models_soup/src/chat.rs@@ -3,8 +3,9 @@ use macro_user_id::user_id::MacroUserIdStr;use serde::{Deserialize, Serialize};use uuid::Uuid;+use crate::SoupProperty;+#[derive(Serialize, Clone, Deserialize, Debug)]-#[cfg_attr(feature = "mock", derive(PartialEq, Eq))]#[serde(rename_all = "camelCase")]#[cfg_attr(feature = "schema", derive(utoipa::ToSchema))]pub struct SoupChat {@@ -39,4 +40,7 @@ pub struct SoupChat {#[serde(with = "chrono::serde::ts_milliseconds_option")]#[cfg_attr(feature = "schema", schema(value_type = i64, nullable = true))]pub viewed_at: Option<chrono::DateTime<Utc>>,++ /// Properties+ pub properties: Vec<SoupProperty>,}diff --git a/rust/cloud-storage/models_soup/src/document.rs b/rust/cloud-storage/models_soup/src/document.rsindex eef115942c..dcb8bdf0ee 100644--- a/rust/cloud-storage/models_soup/src/document.rs+++ b/rust/cloud-storage/models_soup/src/document.rs@@ -1,8 +1,11 @@use chrono::Utc;use document_sub_type::DocumentSubType;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)]@@ -38,7 +41,6 @@ impl SoupDocumentSubType {}#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)]-#[cfg_attr(feature = "mock", derive(PartialEq, Eq))]#[serde(rename_all = "camelCase")]#[cfg_attr(feature = "schema", derive(utoipa::ToSchema))]pub struct SoupDocument {@@ -101,4 +103,20 @@ pub struct SoupDocument {/// Task-related properties are encoded within the variant.#[serde(skip_serializing_if = "Option::is_none")]pub sub_type: Option<SoupDocumentSubType>,++ /// Properties+ pub properties: Vec<SoupProperty>,+}++impl SoupDocument {+ /// Returns the entity type for this document.+ ///+ /// Documents with a `sub_type` of `Task` return `EntityType::Task`,+ /// otherwise they return `EntityType::Document`.+ pub fn entity_type(&self) -> EntityType {+ match &self.sub_type {+ Some(SoupDocumentSubType::Task { .. }) => EntityType::Task,+ None => EntityType::Document,+ }+ }}diff --git a/rust/cloud-storage/models_soup/src/email_thread.rs b/rust/cloud-storage/models_soup/src/email_thread.rsindex 25b6c6d657..6d156e5a74 100644--- a/rust/cloud-storage/models_soup/src/email_thread.rs+++ b/rust/cloud-storage/models_soup/src/email_thread.rs@@ -4,6 +4,8 @@ use macro_user_id::user_id::MacroUserIdStr;use serde::{Deserialize, Serialize};use uuid::Uuid;+use crate::SoupProperty;+#[derive(Debug, Doppleganger, Serialize, Deserialize)]#[cfg_attr(feature = "schema", derive(utoipa::ToSchema))]#[cfg_attr(feature = "mock", derive(PartialEq, Eq))]@@ -144,10 +146,8 @@ pub struct SoupEmailThreadPreview {pub viewed_at: Option<DateTime<Utc>>,}-#[derive(Debug, Doppleganger, Serialize, Deserialize)]+#[derive(Debug, Serialize, Deserialize)]#[cfg_attr(feature = "schema", derive(utoipa::ToSchema))]-#[cfg_attr(feature = "mock", derive(PartialEq, Eq))]-#[dg(backward = email::domain::models::EnrichedEmailThreadPreview)]#[serde(rename_all = "camelCase")]pub struct SoupEnrichedEmailThreadPreview {#[serde(flatten)]@@ -157,4 +157,5 @@ pub struct SoupEnrichedEmailThreadPreview {pub participants: Vec<SoupContact>,pub metadata: SoupEmailThreadPreviewMetadata,pub labels: Vec<SoupLabel>,+ pub properties: Vec<SoupProperty>,}diff --git a/rust/cloud-storage/models_soup/src/item.rs b/rust/cloud-storage/models_soup/src/item.rsindex a161f8ce22..a587499745 100644--- a/rust/cloud-storage/models_soup/src/item.rs+++ b/rust/cloud-storage/models_soup/src/item.rs@@ -5,6 +5,7 @@ use crate::{chat::SoupChat, comms::SoupChannel};use chrono::{DateTime, Utc};use model_entity::{Entity, EntityType};use models_pagination::{Identify, SimpleSortMethod, SortOn};+use models_properties::{EntityReference, EntityType as PropertiesEntityType};use serde::{Deserialize, Serialize};use uuid::Uuid;@@ -142,3 +143,29 @@ impl SortOn<SimpleSortMethod> for SoupItem {}}}++impl SoupItem {+ /// Converts this item to an [`EntityReference`] for property lookups.+ ///+ /// Returns `None` for item types that don't support properties (e.g., channels).+ pub fn to_entity_reference(&self) -> Option<EntityReference> {+ match self {+ SoupItem::Document(doc) => {+ Some(EntityReference::new(doc.id.to_string(), doc.entity_type()))+ }+ SoupItem::Project(p) => Some(EntityReference::new(+ p.id.to_string(),+ PropertiesEntityType::Project,+ )),+ SoupItem::EmailThread(e) => Some(EntityReference::new(+ e.thread.id.to_string(),+ PropertiesEntityType::Thread,+ )),+ SoupItem::Chat(c) => Some(EntityReference::new(+ c.id.to_string(),+ PropertiesEntityType::Chat,+ )),+ SoupItem::Channel(_) => None,+ }+ }+}diff --git a/rust/cloud-storage/models_soup/src/lib.rs b/rust/cloud-storage/models_soup/src/lib.rsindex bb92c464d3..adcc6c2fbf 100644--- a/rust/cloud-storage/models_soup/src/lib.rs+++ b/rust/cloud-storage/models_soup/src/lib.rs@@ -4,3 +4,6 @@ pub mod document;pub mod email_thread;pub mod item;pub mod project;+pub mod properties;++pub use properties::SoupProperty;diff --git a/rust/cloud-storage/models_soup/src/project.rs b/rust/cloud-storage/models_soup/src/project.rsindex 87a64aefc8..9d8ceb5df7 100644--- a/rust/cloud-storage/models_soup/src/project.rs+++ b/rust/cloud-storage/models_soup/src/project.rs@@ -3,8 +3,9 @@ use macro_user_id::user_id::MacroUserIdStr;use serde::{Deserialize, Serialize};use uuid::Uuid;+use crate::SoupProperty;+#[derive(Serialize, Clone, Deserialize, Debug)]-#[cfg_attr(feature = "mock", derive(PartialEq, Eq))]#[serde(rename_all = "camelCase")]#[cfg_attr(feature = "schema", derive(utoipa::ToSchema))]pub struct SoupProject {@@ -36,4 +37,7 @@ pub struct SoupProject {#[serde(with = "chrono::serde::ts_milliseconds_option")]#[cfg_attr(feature = "schema", schema(value_type = i64, nullable = true))]pub viewed_at: Option<chrono::DateTime<Utc>>,++ /// Properties+ pub properties: Vec<SoupProperty>,}diff --git a/rust/cloud-storage/models_soup/src/properties.rs b/rust/cloud-storage/models_soup/src/properties.rsnew file mode 100644index 0000000000..7f0878c121--- /dev/null+++ b/rust/cloud-storage/models_soup/src/properties.rs@@ -0,0 +1,37 @@+//! Soup property model - simplified property representation for the Soup API.++use models_properties::service::{+ entity_property_with_definition::EntityPropertyWithDefinition,+ property_definition::PropertyDefinition, property_value::PropertyValue,+};+use serde::{Deserialize, Serialize};++/// A property attached to a Soup item.+///+/// This is a simplified representation that includes only the definition and value,+/// omitting the entity property assignment metadata and options.+#[derive(Debug, Clone, Serialize, Deserialize)]+#[cfg_attr(feature = "schema", derive(utoipa::ToSchema))]+#[serde(rename_all = "camelCase")]+pub struct SoupProperty {+ /// The property definition+ pub definition: PropertyDefinition,++ /// The property value, if set+ #[serde(skip_serializing_if = "Option::is_none")]+ pub value: Option<PropertyValue>,+}++impl From<EntityPropertyWithDefinition> for SoupProperty {+ /// Converts from the full entity property representation.+ ///+ /// Note: The `options` field from `EntityPropertyWithDefinition` is intentionally+ /// omitted as Soup items only need the definition and current value. Select options+ /// should be fetched separately when needed for editing UI.+ fn from(prop: EntityPropertyWithDefinition) -> Self {+ Self {+ definition: prop.definition,+ value: prop.value,+ }+ }+}diff --git a/rust/cloud-storage/properties_db_client/.sqlx/query-9eae6bc7ff21a0c2f6f7aea33188ba4097305e77f341ac67c7d9779889ed7434.json b/rust/cloud-storage/properties_db_client/.sqlx/query-1b324f7419bf6620c5eae611b237ee202fb2b3b011422dc27f351a2c3d10813c.jsonsimilarity index 76%rename from rust/cloud-storage/properties_db_client/.sqlx/query-9eae6bc7ff21a0c2f6f7aea33188ba4097305e77f341ac67c7d9779889ed7434.jsonrename to rust/cloud-storage/properties_db_client/.sqlx/query-1b324f7419bf6620c5eae611b237ee202fb2b3b011422dc27f351a2c3d10813c.jsonindex d1ba0f0a0b..8257f56f38 100644--- a/rust/cloud-storage/properties_db_client/.sqlx/query-9eae6bc7ff21a0c2f6f7aea33188ba4097305e77f341ac67c7d9779889ed7434.json+++ b/rust/cloud-storage/properties_db_client/.sqlx/query-1b324f7419bf6620c5eae611b237ee202fb2b3b011422dc27f351a2c3d10813c.json@@ -1,6 +1,6 @@{"db_name": "PostgreSQL",- "query": "\n SELECT \n ep.id as entity_property_id,\n ep.entity_id,\n ep.entity_type as \"entity_type: EntityType\",\n ep.property_definition_id,\n ep.values as \"values: sqlx::types::JsonValue\",\n ep.created_at as entity_property_created_at,\n ep.updated_at as entity_property_updated_at,\n pd.organization_id as definition_organization_id,\n pd.user_id as definition_user_id,\n pd.display_name,\n pd.data_type as \"data_type: DataType\",\n pd.is_multi_select,\n pd.specific_entity_type as \"specific_entity_type: Option<EntityType>\",\n pd.created_at as definition_created_at,\n pd.updated_at as definition_updated_at,\n pd.is_system as definition_is_system\n FROM entity_properties ep\n INNER JOIN property_definitions pd ON ep.property_definition_id = pd.id\n WHERE (ep.entity_id, ep.entity_type) IN (\n SELECT * FROM UNNEST($1::TEXT[], $2::property_entity_type[])\n )\n ",+ "query": "\nSELECT\n ep.id as entity_property_id,\n ep.entity_id,\n ep.entity_type as \"entity_type: EntityType\",\n ep.property_definition_id,\n ep.values as \"values: sqlx::types::JsonValue\",\n ep.created_at as entity_property_created_at,\n ep.updated_at as entity_property_updated_at,\n pd.organization_id as definition_organization_id,\n pd.user_id as definition_user_id,\n pd.display_name,\n pd.data_type as \"data_type: DataType\",\n pd.is_multi_select,\n pd.specific_entity_type as \"specific_entity_type: Option<EntityType>\",\n pd.created_at as definition_created_at,\n pd.updated_at as definition_updated_at,\n pd.is_system as definition_is_system\nFROM entity_properties ep\nINNER JOIN property_definitions pd ON ep.property_definition_id = pd.id\nWHERE (ep.entity_id, ep.entity_type) IN (\n SELECT * FROM UNNEST($1::TEXT[], $2::property_entity_type[])\n)\n","describe": {"columns": [{@@ -180,5 +180,5 @@false]},- "hash": "9eae6bc7ff21a0c2f6f7aea33188ba4097305e77f341ac67c7d9779889ed7434"+ "hash": "1b324f7419bf6620c5eae611b237ee202fb2b3b011422dc27f351a2c3d10813c"}diff --git a/rust/cloud-storage/properties_db_client/.sqlx/query-3413f40533fe26ef9d719996855f91926f21273aeb1dc34489925ebcd39829b6.json b/rust/cloud-storage/properties_db_client/.sqlx/query-35aa1ada3371fd09902d19b1218c2034a348d30889a11f28b98a9e4a0daf4525.jsonsimilarity index 76%rename from rust/cloud-storage/properties_db_client/.sqlx/query-3413f40533fe26ef9d719996855f91926f21273aeb1dc34489925ebcd39829b6.jsonrename to rust/cloud-storage/properties_db_client/.sqlx/query-35aa1ada3371fd09902d19b1218c2034a348d30889a11f28b98a9e4a0daf4525.jsonindex b0ab4cd82e..0bc29e54eb 100644--- a/rust/cloud-storage/properties_db_client/.sqlx/query-3413f40533fe26ef9d719996855f91926f21273aeb1dc34489925ebcd39829b6.json+++ b/rust/cloud-storage/properties_db_client/.sqlx/query-35aa1ada3371fd09902d19b1218c2034a348d30889a11f28b98a9e4a0daf4525.json@@ -1,6 +1,6 @@{"db_name": "PostgreSQL",- "query": "\n SELECT \n ep.id as entity_property_id,\n ep.entity_id,\n ep.entity_type as \"entity_type: EntityType\",\n ep.property_definition_id,\n ep.values as \"values: sqlx::types::JsonValue\",\n ep.created_at as entity_property_created_at,\n ep.updated_at as entity_property_updated_at,\n pd.organization_id as definition_organization_id,\n pd.user_id as definition_user_id,\n pd.display_name,\n pd.data_type as \"data_type: DataType\",\n pd.is_multi_select,\n pd.specific_entity_type as \"specific_entity_type: Option<EntityType>\",\n pd.created_at as definition_created_at,\n pd.updated_at as definition_updated_at,\n pd.is_system as definition_is_system\n FROM entity_properties ep\n INNER JOIN property_definitions pd ON ep.property_definition_id = pd.id\n WHERE ep.entity_id = $1 AND ep.entity_type = $2\n ",+ "query": "\nSELECT\n ep.id as entity_property_id,\n ep.entity_id,\n ep.entity_type as \"entity_type: EntityType\",\n ep.property_definition_id,\n ep.values as \"values: sqlx::types::JsonValue\",\n ep.created_at as entity_property_created_at,\n ep.updated_at as entity_property_updated_at,\n pd.organization_id as definition_organization_id,\n pd.user_id as definition_user_id,\n pd.display_name,\n pd.data_type as \"data_type: DataType\",\n pd.is_multi_select,\n pd.specific_entity_type as \"specific_entity_type: Option<EntityType>\",\n pd.created_at as definition_created_at,\n pd.updated_at as definition_updated_at,\n pd.is_system as definition_is_system\nFROM entity_properties ep\nINNER JOIN property_definitions pd ON ep.property_definition_id = pd.id\nWHERE ep.entity_id = $1 AND ep.entity_type = $2\n ","describe": {"columns": [{@@ -173,5 +173,5 @@false]},- "hash": "3413f40533fe26ef9d719996855f91926f21273aeb1dc34489925ebcd39829b6"+ "hash": "35aa1ada3371fd09902d19b1218c2034a348d30889a11f28b98a9e4a0daf4525"}diff --git a/rust/cloud-storage/properties_db_client/.sqlx/query-d7b0cf2d0add26c4c959e055b70f8ee8faf694757d7187135602b7508f0b0eca.json b/rust/cloud-storage/properties_db_client/.sqlx/query-3f3b5a5d8734e3748d4e29d64cfa89baff99dae621e7cbd7a10017beec9485c8.jsonsimilarity index 74%rename from rust/cloud-storage/properties_db_client/.sqlx/query-d7b0cf2d0add26c4c959e055b70f8ee8faf694757d7187135602b7508f0b0eca.jsonrename to rust/cloud-storage/properties_db_client/.sqlx/query-3f3b5a5d8734e3748d4e29d64cfa89baff99dae621e7cbd7a10017beec9485c8.jsonindex ce40e97428..5c152ecd5e 100644--- a/rust/cloud-storage/properties_db_client/.sqlx/query-d7b0cf2d0add26c4c959e055b70f8ee8faf694757d7187135602b7508f0b0eca.json+++ b/rust/cloud-storage/properties_db_client/.sqlx/query-3f3b5a5d8734e3748d4e29d64cfa89baff99dae621e7cbd7a10017beec9485c8.json@@ -1,6 +1,6 @@{"db_name": "PostgreSQL",- "query": "\n SELECT \n ep.entity_id,\n ep.entity_type as \"entity_type: EntityType\",\n ep.property_definition_id\n FROM entity_properties ep\n WHERE ep.id = $1\n ",+ "query": "\nSELECT\n ep.entity_id,\n ep.entity_type as \"entity_type: EntityType\",\n ep.property_definition_id\nFROM entity_properties ep\nWHERE ep.id = $1\n ","describe": {"columns": [{@@ -46,5 +46,5 @@false]},- "hash": "d7b0cf2d0add26c4c959e055b70f8ee8faf694757d7187135602b7508f0b0eca"+ "hash": "3f3b5a5d8734e3748d4e29d64cfa89baff99dae621e7cbd7a10017beec9485c8"}diff --git a/rust/cloud-storage/properties_db_client/.sqlx/query-e004bed4c36a09e5b178eae38953fe204bea43e98071e554aea716d18538dc66.json b/rust/cloud-storage/properties_db_client/.sqlx/query-edce1ca1979c9bd7c42f7e89d80a8d25037d25951b1f406dddb8d62cc13f74f0.jsonsimilarity index 76%rename from rust/cloud-storage/properties_db_client/.sqlx/query-e004bed4c36a09e5b178eae38953fe204bea43e98071e554aea716d18538dc66.jsonrename to rust/cloud-storage/properties_db_client/.sqlx/query-edce1ca1979c9bd7c42f7e89d80a8d25037d25951b1f406dddb8d62cc13f74f0.jsonindex 2715715799..13653d45bf 100644--- a/rust/cloud-storage/properties_db_client/.sqlx/query-e004bed4c36a09e5b178eae38953fe204bea43e98071e554aea716d18538dc66.json+++ b/rust/cloud-storage/properties_db_client/.sqlx/query-edce1ca1979c9bd7c42f7e89d80a8d25037d25951b1f406dddb8d62cc13f74f0.json@@ -1,6 +1,6 @@{"db_name": "PostgreSQL",- "query": "\n SELECT \n ep.id as entity_property_id,\n ep.entity_id,\n ep.entity_type as \"entity_type: EntityType\",\n ep.property_definition_id,\n ep.values as \"values: sqlx::types::JsonValue\",\n ep.created_at as entity_property_created_at,\n ep.updated_at as entity_property_updated_at,\n pd.organization_id as definition_organization_id,\n pd.user_id as definition_user_id,\n pd.display_name,\n pd.data_type as \"data_type: DataType\",\n pd.is_multi_select,\n pd.specific_entity_type as \"specific_entity_type: Option<EntityType>\",\n pd.created_at as definition_created_at,\n pd.updated_at as definition_updated_at,\n pd.is_system as definition_is_system\n FROM entity_properties ep\n INNER JOIN property_definitions pd ON ep.property_definition_id = pd.id\n WHERE (ep.entity_id, ep.entity_type) IN (\n SELECT * FROM UNNEST($1::TEXT[], $2::property_entity_type[])\n )\n AND pd.id = ANY($3::UUID[])\n ",+ "query": "\nSELECT\n ep.id as entity_property_id,\n ep.entity_id,\n ep.entity_type as \"entity_type: EntityType\",\n ep.property_definition_id,\n ep.values as \"values: sqlx::types::JsonValue\",\n ep.created_at as entity_property_created_at,\n ep.updated_at as entity_property_updated_at,\n pd.organization_id as definition_organization_id,\n pd.user_id as definition_user_id,\n pd.display_name,\n pd.data_type as \"data_type: DataType\",\n pd.is_multi_select,\n pd.specific_entity_type as \"specific_entity_type: Option<EntityType>\",\n pd.created_at as definition_created_at,\n pd.updated_at as definition_updated_at,\n pd.is_system as definition_is_system\nFROM entity_properties ep\nINNER JOIN property_definitions pd ON ep.property_definition_id = pd.id\nWHERE (ep.entity_id, ep.entity_type) IN (\n SELECT * FROM UNNEST($1::TEXT[], $2::property_entity_type[])\n)\nAND pd.id = ANY($3::UUID[])\n ","describe": {"columns": [{@@ -181,5 +181,5 @@false]},- "hash": "e004bed4c36a09e5b178eae38953fe204bea43e98071e554aea716d18538dc66"+ "hash": "edce1ca1979c9bd7c42f7e89d80a8d25037d25951b1f406dddb8d62cc13f74f0"}diff --git a/rust/cloud-storage/properties_db_client/src/entity_properties/get.rs b/rust/cloud-storage/properties_db_client/src/entity_properties/get.rsindex b832ac8ac4..54bf1309bf 100644--- a/rust/cloud-storage/properties_db_client/src/entity_properties/get.rs+++ b/rust/cloud-storage/properties_db_client/src/entity_properties/get.rs@@ -228,6 +228,54 @@ async fn attach_property_options(Ok(())}+/// Fetch and attach property options to properties across multiple entities in ONE query.+/// Optimized for bulk operations - collects all unique select-type property IDs across all entities,+/// fetches options once, then distributes to each property.+async fn attach_property_options_bulk(+ db: &Pool<Postgres>,+ entity_properties_map: &mut HashMap<String, Vec<EntityPropertyWithDefinition>>,+) -> Result<()> {+ let property_ids_needing_options: HashSet<Uuid> = entity_properties_map+ .values()+ .flatten()+ .filter(|p| {+ matches!(+ p.definition.data_type,+ DataType::SelectString | DataType::SelectNumber+ )+ })+ .map(|p| p.definition.id)+ .collect();++ let options_map = if !property_ids_needing_options.is_empty() {+ let property_ids_vec: Vec<Uuid> = property_ids_needing_options.into_iter().collect();+ crate::property_options::get::get_property_options_batch(db, &property_ids_vec).await?+ } else {+ HashMap::new()+ };++ for properties in entity_properties_map.values_mut() {+ for property in properties.iter_mut() {+ let is_select_type = matches!(+ property.definition.data_type,+ DataType::SelectString | DataType::SelectNumber+ );+ if is_select_type {+ let options = options_map+ .get(&property.definition.id)+ .cloned()+ .unwrap_or_default();+ validate_and_clean_select_option_value(property, &options);+ property.options = Some(options);+ } else {+ clear_stale_select_data(property);+ }+ }+ }++ Ok(())+}+/// Looks up an entity property by its ID./// Returns entity reference (for permissions) and definition ID (for required property check).#[tracing::instrument(skip(db))]@@ -237,12 +285,12 @@ pub async fn lookup_entity_property() -> Result<Option<EntityPropertyReference>> {let row = sqlx::query!(r#"- SELECT- ep.entity_id,- ep.entity_type as "entity_type: EntityType",- ep.property_definition_id- FROM entity_properties ep- WHERE ep.id = $1+SELECT+ ep.entity_id,+ ep.entity_type as "entity_type: EntityType",+ ep.property_definition_id+FROM entity_properties ep+WHERE ep.id = $1"#,entity_property_id)@@ -266,26 +314,26 @@ pub async fn get_entity_properties_values() -> Result<Vec<EntityPropertyWithDefinition>> {let rows = sqlx::query!(r#"- SELECT- ep.id as entity_property_id,- ep.entity_id,- ep.entity_type as "entity_type: EntityType",- ep.property_definition_id,- ep.values as "values: sqlx::types::JsonValue",- ep.created_at as entity_property_created_at,- ep.updated_at as entity_property_updated_at,- pd.organization_id as definition_organization_id,- pd.user_id as definition_user_id,- pd.display_name,- pd.data_type as "data_type: DataType",- pd.is_multi_select,- pd.specific_entity_type as "specific_entity_type: Option<EntityType>",- pd.created_at as definition_created_at,- pd.updated_at as definition_updated_at,- pd.is_system as definition_is_system- FROM entity_properties ep- INNER JOIN property_definitions pd ON ep.property_definition_id = pd.id- WHERE ep.entity_id = $1 AND ep.entity_type = $2+SELECT+ ep.id as entity_property_id,+ ep.entity_id,+ ep.entity_type as "entity_type: EntityType",+ ep.property_definition_id,+ ep.values as "values: sqlx::types::JsonValue",+ ep.created_at as entity_property_created_at,+ ep.updated_at as entity_property_updated_at,+ pd.organization_id as definition_organization_id,+ pd.user_id as definition_user_id,+ pd.display_name,+ pd.data_type as "data_type: DataType",+ pd.is_multi_select,+ pd.specific_entity_type as "specific_entity_type: Option<EntityType>",+ pd.created_at as definition_created_at,+ pd.updated_at as definition_updated_at,+ pd.is_system as definition_is_system+FROM entity_properties ep+INNER JOIN property_definitions pd ON ep.property_definition_id = pd.id+WHERE ep.entity_id = $1 AND ep.entity_type = $2"#,entity_id,entity_type as EntityType@@ -344,29 +392,29 @@ pub async fn get_bulk_entity_properties_values(let rows = sqlx::query!(r#"- SELECT- ep.id as entity_property_id,- ep.entity_id,- ep.entity_type as "entity_type: EntityType",- ep.property_definition_id,- ep.values as "values: sqlx::types::JsonValue",- ep.created_at as entity_property_created_at,- ep.updated_at as entity_property_updated_at,- pd.organization_id as definition_organization_id,- pd.user_id as definition_user_id,- pd.display_name,- pd.data_type as "data_type: DataType",- pd.is_multi_select,- pd.specific_entity_type as "specific_entity_type: Option<EntityType>",- pd.created_at as definition_created_at,- pd.updated_at as definition_updated_at,- pd.is_system as definition_is_system- FROM entity_properties ep- INNER JOIN property_definitions pd ON ep.property_definition_id = pd.id- WHERE (ep.entity_id, ep.entity_type) IN (- SELECT * FROM UNNEST($1::TEXT[], $2::property_entity_type[])- )- "#,+SELECT+ ep.id as entity_property_id,+ ep.entity_id,+ ep.entity_type as "entity_type: EntityType",+ ep.property_definition_id,+ ep.values as "values: sqlx::types::JsonValue",+ ep.created_at as entity_property_created_at,+ ep.updated_at as entity_property_updated_at,+ pd.organization_id as definition_organization_id,+ pd.user_id as definition_user_id,+ pd.display_name,+ pd.data_type as "data_type: DataType",+ pd.is_multi_select,+ pd.specific_entity_type as "specific_entity_type: Option<EntityType>",+ pd.created_at as definition_created_at,+ pd.updated_at as definition_updated_at,+ pd.is_system as definition_is_system+FROM entity_properties ep+INNER JOIN property_definitions pd ON ep.property_definition_id = pd.id+WHERE (ep.entity_id, ep.entity_type) IN (+ SELECT * FROM UNNEST($1::TEXT[], $2::property_entity_type[])+)+"#,&entity_ids,&entity_types as &[EntityType])@@ -409,12 +457,7 @@ pub async fn get_bulk_entity_properties_values(sort_properties_by_display_name(properties);}- // Fetch and attach property options for all properties- // TODO @danielkweon - optimize by caching property options per property_definition_id- // to avoid redundant fetches when multiple entities share the same property definition- for properties in entity_properties_map.values_mut() {- attach_property_options(db, properties).await?;- }+ attach_property_options_bulk(db, &mut entity_properties_map).await?;// Ensure all requested entity_ids are present in the result, even if they have no propertiesfor entity_ref in entity_refs {@@ -433,7 +476,7 @@ pub async fn get_bulk_entity_properties_values(pub async fn get_bulk_entity_properties_values_filtered(db: &Pool<Postgres>,entity_refs: &[EntityReference],- property_ids: Vec<Uuid>,+ property_ids: &[Uuid],) -> Result<HashMap<String, Vec<EntityPropertyWithDefinition>>> {if entity_refs.is_empty() || property_ids.is_empty() {// If no property_ids specified, return empty map for each entity@@ -449,29 +492,29 @@ pub async fn get_bulk_entity_properties_values_filtered(let rows = sqlx::query!(r#"- SELECT- ep.id as entity_property_id,- ep.entity_id,- ep.entity_type as "entity_type: EntityType",- ep.property_definition_id,- ep.values as "values: sqlx::types::JsonValue",- ep.created_at as entity_property_created_at,- ep.updated_at as entity_property_updated_at,- pd.organization_id as definition_organization_id,- pd.user_id as definition_user_id,- pd.display_name,- pd.data_type as "data_type: DataType",- pd.is_multi_select,- pd.specific_entity_type as "specific_entity_type: Option<EntityType>",- pd.created_at as definition_created_at,- pd.updated_at as definition_updated_at,- pd.is_system as definition_is_system- FROM entity_properties ep- INNER JOIN property_definitions pd ON ep.property_definition_id = pd.id- WHERE (ep.entity_id, ep.entity_type) IN (- SELECT * FROM UNNEST($1::TEXT[], $2::property_entity_type[])- )- AND pd.id = ANY($3::UUID[])+SELECT+ ep.id as entity_property_id,+ ep.entity_id,+ ep.entity_type as "entity_type: EntityType",+ ep.property_definition_id,+ ep.values as "values: sqlx::types::JsonValue",+ ep.created_at as entity_property_created_at,+ ep.updated_at as entity_property_updated_at,+ pd.organization_id as definition_organization_id,+ pd.user_id as definition_user_id,+ pd.display_name,+ pd.data_type as "data_type: DataType",+ pd.is_multi_select,+ pd.specific_entity_type as "specific_entity_type: Option<EntityType>",+ pd.created_at as definition_created_at,+ pd.updated_at as definition_updated_at,+ pd.is_system as definition_is_system+FROM entity_properties ep+INNER JOIN property_definitions pd ON ep.property_definition_id = pd.id+WHERE (ep.entity_id, ep.entity_type) IN (+ SELECT * FROM UNNEST($1::TEXT[], $2::property_entity_type[])+)+AND pd.id = ANY($3::UUID[])"#,&entity_ids,&entity_types as &[EntityType],@@ -514,11 +557,8 @@ pub async fn get_bulk_entity_properties_values_filtered(sort_properties_by_display_name(properties);}- for properties in entity_properties_map.values_mut() {- attach_property_options(db, properties).await?;- }+ attach_property_options_bulk(db, &mut entity_properties_map).await?;- // Ensure all requested entity_ids are present in the resultfor entity_ref in entity_refs {entity_properties_map.entry(entity_ref.entity_id.clone())diff --git a/rust/cloud-storage/properties_service/src/api/properties/entities/get_bulk.rs b/rust/cloud-storage/properties_service/src/api/properties/entities/get_bulk.rsindex 6730d32dcf..1fa121bd2a 100644--- a/rust/cloud-storage/properties_service/src/api/properties/entities/get_bulk.rs+++ b/rust/cloud-storage/properties_service/src/api/properties/entities/get_bulk.rs@@ -71,7 +71,7 @@ async fn get_bulk_entity_properties_impl(entity_properties_get::get_bulk_entity_properties_values_filtered(&context.db,&request.entities,- request.property_ids,+ &request.property_ids,).await}diff --git a/rust/cloud-storage/soup/Cargo.toml b/rust/cloud-storage/soup/Cargo.tomlindex 5bb413e4b0..24489e9dc5 100644--- a/rust/cloud-storage/soup/Cargo.toml+++ b/rust/cloud-storage/soup/Cargo.toml@@ -48,6 +48,7 @@ model-entity = { path = "../model-entity" }model-error-response = { path = "../model-error-response", optional = true }model_user = { path = "../model_user", optional = true, features = ["axum"] }models_pagination = { path = "../models_pagination" }+models_properties = { path = "../models_properties" }models_soup = { path = "../models_soup" }non_empty = { path = "../non_empty" }recursion = { workspace = true }@@ -60,6 +61,7 @@ tracing = { workspace = true }utoipa = { workspace = true, optional = true }uuid = { workspace = true }system_properties = { path = "../system_properties" }+properties_db_client = { path = "../properties_db_client/" }[dev-dependencies]cool_asserts = "2"diff --git a/rust/cloud-storage/soup/src/domain/ports.rs b/rust/cloud-storage/soup/src/domain/ports.rsindex 8a77115e83..3c80fd8ee3 100644--- a/rust/cloud-storage/soup/src/domain/ports.rs+++ b/rust/cloud-storage/soup/src/domain/ports.rs@@ -28,6 +28,12 @@ pub trait SoupRepo: Send + Sync + 'static {&self,req: AdvancedSortParams<'a>,) -> impl Future<Output = Result<Vec<SoupItem>, Self::Err>> + Send;++ /// Populates properties for a slice of SoupItems.+ fn populate_properties(+ &self,+ items: &mut [SoupItem],+ ) -> impl Future<Output = Result<(), Self::Err>> + Send;}/// type alias which represents the posible outputs of soupdiff --git a/rust/cloud-storage/soup/src/domain/service.rs b/rust/cloud-storage/soup/src/domain/service.rsindex 9b928b8cc4..b98db307a4 100644--- a/rust/cloud-storage/soup/src/domain/service.rs+++ b/rust/cloud-storage/soup/src/domain/service.rs@@ -8,7 +8,10 @@ use crate::domain::{use comms::domain::{models::GetChannelsRequest, ports::ChannelsService};use doppleganger::Mirror;use either::Either;-use email::domain::{models::GetEmailsRequest, ports::EmailService};+use email::domain::{+ models::{EnrichedEmailThreadPreview, GetEmailsRequest},+ ports::EmailService,+};use frecency::domain::{models::{AggregateId, FrecencyPageRequest, JoinFrecency},ports::FrecencyQueryService,@@ -20,7 +23,12 @@ use models_pagination::{Cursor, CursorVal, Frecency, FrecencyValue, PaginateOn, Query, SimpleSortMethod,};use models_soup::{- comms::SoupChannel, email_thread::SoupEnrichedEmailThreadPreview, item::SoupItem,+ comms::SoupChannel,+ email_thread::{+ SoupAttachment, SoupContact, SoupEmailThreadPreview, SoupEmailThreadPreviewMetadata,+ SoupEnrichedEmailThreadPreview, SoupLabel, SoupMacroAttachment,+ },+ item::SoupItem,};use std::cmp::Ordering;use uuid::Uuid;@@ -249,25 +257,60 @@ where&self,req: Option<GetEmailsRequest>,) -> Result<impl Iterator<Item = FrecencySoupItem>, SoupErr> {+ use frecency::domain::models::AggregateFrecency;+let Some(req) = req else {return Ok(Either::Left(None.into_iter()));};- let emails = self- .email_service- .get_email_thread_previews(req)- .await?+ let email_response = self.email_service.get_email_thread_previews(req).await?;++ let mut frecency_scores: Vec<Option<AggregateFrecency>> =+ Vec::with_capacity(email_response.items.len());+ let mut items: Vec<SoupItem> = email_response.items.into_iter()- .map(|mut f| {- let frecency_score = f.frecency_score.take();- let soup_email = SoupEnrichedEmailThreadPreview::mirror(f);- FrecencySoupItem {- item: SoupItem::EmailThread(soup_email),- frecency_score,- }- });- Ok(Either::Right(emails))+ .map(+ |EnrichedEmailThreadPreview {+ thread,+ attachments,+ attachments_macro,+ labels,+ metadata,+ mut frecency_score,+ participants,+ ..+ }| {+ frecency_scores.push(frecency_score.take());+ let soup_email = SoupEnrichedEmailThreadPreview {+ thread: SoupEmailThreadPreview::mirror(thread),+ attachments: Vec::<SoupAttachment>::mirror(attachments),+ attachments_macro: Vec::<SoupMacroAttachment>::mirror(attachments_macro),+ participants: Vec::<SoupContact>::mirror(participants),+ metadata: SoupEmailThreadPreviewMetadata::mirror(metadata),+ labels: Vec::<SoupLabel>::mirror(labels),+ properties: Default::default(),+ };+ SoupItem::EmailThread(soup_email)+ },+ )+ .collect();++ self.soup_storage+ .populate_properties(&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 {+ item,+ frecency_score,+ })+ .collect();++ Ok(Either::Right(emails_with_props.into_iter()))}async fn handle_comms_request(diff --git a/rust/cloud-storage/soup/src/domain/service/tests.rs b/rust/cloud-storage/soup/src/domain/service/tests.rsindex 11cacfa2f3..f8b38f6f00 100644--- a/rust/cloud-storage/soup/src/domain/service/tests.rs+++ b/rust/cloud-storage/soup/src/domain/service/tests.rs@@ -50,7 +50,7 @@ struct NoopCommsService;impl ChannelsService for NoopCommsService {async fn get_channels(&self,- req: GetChannelsRequest,+ _req: GetChannelsRequest,) -> Result<Vec<comms::domain::models::channel::ChannelWithLatest>, Report> {Ok(Vec::new())}@@ -124,6 +124,7 @@ 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(),}}@@ -157,6 +158,9 @@ async fn it_should_not_query_frecency() {.collect())})});+ soup_mock+ .expect_populate_properties()+ .returning(|_| Box::pin(async { Ok(()) }));let res = SoupImpl::new(soup_mock,@@ -696,6 +700,9 @@ 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,@@ -807,6 +814,9 @@ 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,@@ -847,6 +857,9 @@ 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,@@ -887,6 +900,9 @@ 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,@@ -939,6 +955,9 @@ 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/rust/cloud-storage/soup/src/outbound/pg_soup_repo.rs b/rust/cloud-storage/soup/src/outbound/pg_soup_repo.rsindex 31bb8da529..3143809b5a 100644--- a/rust/cloud-storage/soup/src/outbound/pg_soup_repo.rs+++ b/rust/cloud-storage/soup/src/outbound/pg_soup_repo.rs@@ -6,8 +6,9 @@ use crate::{outbound::pg_soup_repo::expanded::dynamic::ExpandedDynamicCursorArgs,};use either::Either;-use models_soup::item::SoupItem;+use models_soup::{SoupProperty, item::SoupItem};use sqlx::PgPool;+use system_properties::SystemPropertyKey;mod expanded;mod unexpanded;@@ -115,6 +116,13 @@ impl SoupRepo for PgSoupRepo {) -> impl Future<Output = Result<Vec<SoupItem>, Self::Err>> + Send {unexpanded::by_ids::unexpanded_soup_by_ids(&self.inner, req.user_id, req.entities)}++ fn populate_properties(+ &self,+ items: &mut [SoupItem],+ ) -> impl Future<Output = Result<(), Self::Err>> + Send {+ populate_properties(&self.inner, items)+ }}#[tracing::instrument(err)]@@ -131,6 +139,57 @@ fn type_err<E: std::fmt::Display>(e: E) -> sqlx::Error {}}+/// Fetches and populates properties for a slice of SoupItems.+///+/// This helper collects entity references from items that support properties,+/// fetches their properties in bulk, and assigns them to each item.+/// Tasks use `EntityType::Task` while regular documents use `EntityType::Document`.+pub(crate) async fn populate_properties(+ db: &PgPool,+ items: &mut [SoupItem],+) -> Result<(), sqlx::Error> {+ let entity_refs = items+ .iter()+ .filter_map(|item| item.to_entity_reference())+ .collect::<Vec<_>>();++ if entity_refs.is_empty() {+ return Ok(());+ }++ let property_ids = SystemPropertyKey::all_system_property_keys();+ let mut properties_map =+ properties_db_client::entity_properties::get::get_bulk_entity_properties_values_filtered(+ db,+ &entity_refs,+ property_ids,+ )+ .await+ .map_err(|e| sqlx::Error::Decode(Box::new(e)))?;++ for item in items {+ let props = match item {+ SoupItem::Document(x) => properties_map.remove(&x.id.to_string()),+ SoupItem::Project(x) => properties_map.remove(&x.id.to_string()),+ SoupItem::EmailThread(x) => properties_map.remove(&x.thread.id.to_string()),+ SoupItem::Chat(x) => properties_map.remove(&x.id.to_string()),+ SoupItem::Channel(_) => None,+ };+ if let Some(props) = props {+ let soup_props: Vec<SoupProperty> = props.into_iter().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::Channel(_) => {}+ }+ }+ }++ Ok(())+}+/// this defines a macro which maps the soup query types for statically checked soup queries/// This must be a macro because compile time queries cannot have a named type so we can't use a function#[macro_export]@@ -171,6 +230,7 @@ macro_rules! map_soup_type {r.sub_type,r.is_completed,),+ properties: Default::default(),},)),"chat" => Ok(::models_soup::item::SoupItem::Chat(@@ -190,6 +250,7 @@ macro_rules! map_soup_type {created_at: r.created_at,updated_at: r.updated_at,viewed_at: r.viewed_at,+ properties: Default::default(),},)),"project" => Ok(::models_soup::item::SoupItem::Project(@@ -208,6 +269,7 @@ macro_rules! map_soup_type {created_at: r.created_at,updated_at: r.updated_at,viewed_at: r.viewed_at,+ properties: Default::default(),},)),_ => Err(sqlx::Error::TypeNotFound {diff --git a/rust/cloud-storage/soup/src/outbound/pg_soup_repo/expanded/by_cursor.rs b/rust/cloud-storage/soup/src/outbound/pg_soup_repo/expanded/by_cursor.rsindex 57631d2c40..b4e7eb96a7 100644--- a/rust/cloud-storage/soup/src/outbound/pg_soup_repo/expanded/by_cursor.rs+++ b/rust/cloud-storage/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::type_err;+use crate::outbound::pg_soup_repo::{populate_properties, type_err};use document_sub_type::DocumentSubType;use macro_user_id::cowlike::CowLike;use macro_user_id::user_id::MacroUserIdStr;@@ -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 items: Vec<SoupItem> = sqlx::query!(+ let mut items: Vec<SoupItem> = sqlx::query!(r#"WITH RECURSIVE ProjectHierarchy AS (SELECT p.id, uia.access_level@@ -220,6 +220,8 @@ r#".fetch_all(db).await?;+ populate_properties(db, &mut items).await?;+Ok(items)}@@ -240,7 +242,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 items: Vec<SoupItem> = sqlx::query!(+ let mut items: Vec<SoupItem> = sqlx::query!(r#"WITH RECURSIVE ProjectHierarchy AS (SELECT p.id, uia.access_level@@ -434,5 +436,7 @@ r#".fetch_all(db).await?;+ populate_properties(db, &mut items).await?;+Ok(items)}diff --git a/rust/cloud-storage/soup/src/outbound/pg_soup_repo/expanded/by_ids.rs b/rust/cloud-storage/soup/src/outbound/pg_soup_repo/expanded/by_ids.rsindex cffe691559..d1f0bf9b5d 100644--- a/rust/cloud-storage/soup/src/outbound/pg_soup_repo/expanded/by_ids.rs+++ b/rust/cloud-storage/soup/src/outbound/pg_soup_repo/expanded/by_ids.rs@@ -1,4 +1,7 @@-use crate::{map_soup_type, outbound::pg_soup_repo::type_err};+use crate::{+ map_soup_type,+ outbound::pg_soup_repo::{populate_properties, type_err},+};use document_sub_type::DocumentSubType;use macro_user_id::{cowlike::CowLike, user_id::MacroUserIdStr};use model_entity::{Entity, EntityType};@@ -37,7 +40,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 items: Vec<SoupItem> = sqlx::query!(+ let mut items: Vec<SoupItem> = sqlx::query!(r#"WITH RECURSIVE ProjectHierarchy AS (SELECT p.id, uia.access_level@@ -181,5 +184,7 @@ pub async fn expanded_soup_by_ids<'a>(.fetch_all(db).await?;+ populate_properties(db, &mut items).await?;+Ok(items)}diff --git a/rust/cloud-storage/soup/src/outbound/pg_soup_repo/expanded/dynamic.rs b/rust/cloud-storage/soup/src/outbound/pg_soup_repo/expanded/dynamic.rsindex 09c62071fe..f34992d030 100644--- a/rust/cloud-storage/soup/src/outbound/pg_soup_repo/expanded/dynamic.rs+++ b/rust/cloud-storage/soup/src/outbound/pg_soup_repo/expanded/dynamic.rs@@ -22,7 +22,7 @@ use sqlx::{PgPool, Postgres, QueryBuilder, Row, postgres::PgRow, prelude::FromRouse system_properties::{StatusOption, SystemPropertyKey};use uuid::Uuid;-use crate::outbound::pg_soup_repo::type_err;+use crate::outbound::pg_soup_repo::{populate_properties, type_err};static PREFIX: &str = r#"WITH RECURSIVE ProjectHierarchy AS (@@ -428,6 +428,7 @@ impl SoupRow {updated_at,viewed_at,sub_type: SoupDocumentSubType::from_db(sub_type, is_completed),+ properties: Default::default(),}),SoupRow::Chat(ChatRow {id,@@ -453,6 +454,7 @@ impl SoupRow {created_at,updated_at,viewed_at,+ properties: Default::default(),}),SoupRow::Project(ProjectRow {id,@@ -476,6 +478,7 @@ impl SoupRow {created_at,updated_at,viewed_at,+ properties: Default::default(),}),})}@@ -512,7 +515,7 @@ pub(crate) async fn expanded_dynamic_cursor_soup(let status_property_id = SystemPropertyKey::STATUS_UUID;let completed_option_id = StatusOption::COMPLETED_UUID.to_string();- build_query(cursor.filter(), exclude_frecency)+ let mut items = build_query(cursor.filter(), exclude_frecency).build().bind(user_id.as_ref()).bind(sort_method_str)@@ -523,5 +526,9 @@ pub(crate) async fn expanded_dynamic_cursor_soup(.bind(status_property_id).try_map(|row| SoupRow::from_row(&row)?.into_soup_item()).fetch_all(db)- .await+ .await?;++ populate_properties(db, &mut items).await?;++ Ok(items)}diff --git a/rust/cloud-storage/soup/src/outbound/pg_soup_repo/expanded/tests.rs b/rust/cloud-storage/soup/src/outbound/pg_soup_repo/expanded/tests.rsindex 9c32290eb7..4bec972343 100644--- a/rust/cloud-storage/soup/src/outbound/pg_soup_repo/expanded/tests.rs+++ b/rust/cloud-storage/soup/src/outbound/pg_soup_repo/expanded/tests.rs@@ -14,6 +14,29 @@ use sqlx::{PgPool, Pool, Postgres};use std::collections::HashSet;use uuid::Uuid;+macro_rules! unwrap_enum {+ // Base case: single variant+ ($value:expr, $variant:path) => {+ match $value {+ $variant(inner) => inner,+ _ => panic!(+ "called `unwrap_enum!` on variant that didn't match `{}`",+ stringify!($variant)+ ),+ }+ };++ // Recursive case: peel off first variant and recurse+ ($value:expr, $variant:path => $($rest:path)=>+) => {+ match $value {+ $variant(inner) => unwrap_enum!(inner, $($rest)=>+),+ _ => panic!(+ "called `unwrap_enum!` on nested variant that didn't match `{} => ...`",+ stringify!($variant)+ ),+ }+ };+}// 2 items have no viewing history, so they should be last in the response when sorting by viewed_at#[sqlx::test(fixtures(@@ -2080,3 +2103,83 @@ async fn test_dynamic_query_with_ast_and_frecency_exclusion(Ok(())}++/// Test that system properties are populated on SoupItems (Documents and Projects)+#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(+ path = "../../../../../macro_db_client/fixtures",+ scripts("soup_items_with_properties")+ )+)]+async fn test_expanded_dynamic_cursor_populates_properties(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ let user_id = MacroUserIdStr::parse_from_str("macro|[email protected]").unwrap();++ let items = expanded_dynamic_cursor_soup(+ &pool,+ ExpandedDynamicCursorArgs {+ user_id: user_id.copied(),+ limit: 20,+ cursor: Query::Sort(SimpleSortMethod::UpdatedAt, EntityFilterAst::mock_empty()),+ exclude_frecency: false,+ },+ )+ .await?;++ // Should get 2 documents and 2 projects (A and B)+ assert!(!items.is_empty(), "Should return some items");++ // Check that Document in A has properties populated+ let doc_a_uuid = Uuid::parse_str("11111111-aaaa-aaaa-aaaa-aaaaaaaaaaaa").unwrap();+ let doc_a = items+ .iter()+ .find(|item| item.id() == doc_a_uuid)+ .expect("doc a shoul exist");++ let doc = unwrap_enum!(doc_a, SoupItem::Document);+ assert_eq!(+ doc.properties.len(),+ 2,+ "Document in A should have 2 properties"+ );++ // Check that Document in B has properties populated+ let doc_b_uuid = Uuid::parse_str("11111111-bbbb-bbbb-bbbb-bbbbbbbbbbbb").unwrap();+ let doc_b = items.iter().find(|item| item.id() == doc_b_uuid);+ assert!(doc_b.is_some(), "Should find Document in B");++ let doc = unwrap_enum!(doc_b, Some => SoupItem::Document);+ // Document in B has Priority and Due Date properties+ assert_eq!(+ doc.properties.len(),+ 2,+ "Document in B should have 2 properties"+ );++ // Check that Project A has properties populated+ let proj_a_uuid = Uuid::parse_str("aaaaaaaa-ffff-ffff-ffff-ffffffffffff").unwrap();+ let proj_a = items.iter().find(|item| item.id() == proj_a_uuid);+ assert!(proj_a.is_some(), "Should find Project A");++ let proj = unwrap_enum!(proj_a, Some => SoupItem::Project);+ assert!(+ !proj.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");++ // 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();+ let proj_b = items.iter().find(|item| item.id() == proj_b_uuid);+ assert!(proj_b.is_some(), "Should find Project B");++ 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();+ assert_eq!(props_count, 0, "Project B should have 0 properties");++ Ok(())+}diff --git a/rust/cloud-storage/soup/src/outbound/pg_soup_repo/unexpanded/by_cursor.rs b/rust/cloud-storage/soup/src/outbound/pg_soup_repo/unexpanded/by_cursor.rsindex 6eec49eed5..1ffb55daf1 100644--- a/rust/cloud-storage/soup/src/outbound/pg_soup_repo/unexpanded/by_cursor.rs+++ b/rust/cloud-storage/soup/src/outbound/pg_soup_repo/unexpanded/by_cursor.rs@@ -1,4 +1,7 @@-use crate::{map_soup_type, outbound::pg_soup_repo::type_err};+use crate::{+ map_soup_type,+ outbound::pg_soup_repo::{populate_properties, type_err},+};use document_sub_type::DocumentSubType;use macro_user_id::{cowlike::CowLike, user_id::MacroUserIdStr};use models_pagination::{Query, SimpleSortMethod};@@ -30,7 +33,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 items: Vec<SoupItem> = sqlx::query!(+ let mut items: Vec<SoupItem> = sqlx::query!(r#"WITH UserAccessibleItems AS (SELECT DISTINCT ON ("item_id", "item_type")@@ -200,5 +203,7 @@ pub async fn unexpanded_generic_cursor_soup(.fetch_all(db).await?;+ populate_properties(db, &mut items).await?;+Ok(items)}diff --git a/rust/cloud-storage/soup/src/outbound/pg_soup_repo/unexpanded/by_ids.rs b/rust/cloud-storage/soup/src/outbound/pg_soup_repo/unexpanded/by_ids.rsindex 7668e2bec1..e2d2c2166f 100644--- a/rust/cloud-storage/soup/src/outbound/pg_soup_repo/unexpanded/by_ids.rs+++ b/rust/cloud-storage/soup/src/outbound/pg_soup_repo/unexpanded/by_ids.rs@@ -1,4 +1,7 @@-use crate::{map_soup_type, outbound::pg_soup_repo::type_err};+use crate::{+ map_soup_type,+ outbound::pg_soup_repo::{populate_properties, type_err},+};use document_sub_type::DocumentSubType;use macro_user_id::{cowlike::CowLike, user_id::MacroUserIdStr};use model_entity::{Entity, EntityType};@@ -38,7 +41,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 items: Vec<SoupItem> = sqlx::query!(+ let mut items: Vec<SoupItem> = sqlx::query!(r#"WITH UserAccessibleItems AS (SELECT DISTINCT ON ("item_id", "item_type")@@ -191,5 +194,7 @@ pub async fn unexpanded_soup_by_ids<'a>(.fetch_all(db).await?;+ populate_properties(db, &mut items).await?;+Ok(items)}diff --git a/rust/cloud-storage/system_properties/src/domain/model/constants/system_property_key.rs b/rust/cloud-storage/system_properties/src/domain/model/constants/system_property_key.rsindex 6cc0a768f0..90820a3ee7 100644--- a/rust/cloud-storage/system_properties/src/domain/model/constants/system_property_key.rs+++ b/rust/cloud-storage/system_properties/src/domain/model/constants/system_property_key.rs@@ -4,125 +4,105 @@ use models_properties::EntityType;use serde::{Deserialize, Serialize};use uuid::Uuid;-/// System property keys with stable UUIDs.+/// Macro to define system properties with all metadata in one place.///-/// These are predefined properties managed by the system.-/// Users cannot create or delete these, but can apply them to entities.-#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]-#[serde(rename_all = "snake_case")]-pub enum SystemPropertyKey {- // Tasks- Assignees,- Status,- Priority,- DueDate,- ParentTask,- Subtasks,- DependsOn,- Effort,- StoryPoints,- RelevantDocuments,+/// Each property is defined once with its variant name, const name, UUID suffix, and display name.+/// The macro generates:+/// - The enum variants+/// - UUID constants+/// - `uuid()` method+/// - `display_name()` method+/// - `from_uuid()` method+/// - `all()` iterator+macro_rules! define_system_properties {+ (+ $(+ $(#[$meta:meta])*+ $variant:ident, $const_name:ident, $uuid_suffix:expr, $display:literal+ );* $(;)?+ ) => {+ /// System property keys with stable UUIDs (macro-generated).+ #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]+ #[serde(rename_all = "snake_case")]+ pub enum SystemPropertyKey {+ $(+ $(#[$meta])*+ $variant+ ),*+ }- // Emails Attachments- Source,- Companies,- Sender,- Recipients,- Subject,-}+ impl SystemPropertyKey {+ const BASE_UUID: u128 = 0x00000001_0000_0000_0000_000000000000;-impl SystemPropertyKey {- pub const ASSIGNEES_UUID: Uuid = Uuid::from_u128(0x00000001_0000_0000_0000_000000000001);- pub const STATUS_UUID: Uuid = Uuid::from_u128(0x00000001_0000_0000_0000_000000000002);- pub const PRIORITY_UUID: Uuid = Uuid::from_u128(0x00000001_0000_0000_0000_000000000003);- pub const DUE_DATE_UUID: Uuid = Uuid::from_u128(0x00000001_0000_0000_0000_000000000004);- pub const PARENT_TASK_UUID: Uuid = Uuid::from_u128(0x00000001_0000_0000_0000_000000000005);- pub const SUBTASKS_UUID: Uuid = Uuid::from_u128(0x00000001_0000_0000_0000_000000000006);- pub const DEPENDS_ON_UUID: Uuid = Uuid::from_u128(0x00000001_0000_0000_0000_000000000007);- pub const EFFORT_UUID: Uuid = Uuid::from_u128(0x00000001_0000_0000_0000_000000000008);- pub const STORY_POINTS_UUID: Uuid = Uuid::from_u128(0x00000001_0000_0000_0000_000000000009);- pub const RELEVANT_DOCUMENTS_UUID: Uuid =- Uuid::from_u128(0x00000001_0000_0000_0000_00000000000a);- pub const SOURCE_UUID: Uuid = Uuid::from_u128(0x00000001_0000_0000_0000_00000000000b);- pub const COMPANIES_UUID: Uuid = Uuid::from_u128(0x00000001_0000_0000_0000_00000000000c);- pub const SENDER_UUID: Uuid = Uuid::from_u128(0x00000001_0000_0000_0000_00000000000d);- pub const RECIPIENTS_UUID: Uuid = Uuid::from_u128(0x00000001_0000_0000_0000_00000000000e);- pub const SUBJECT_UUID: Uuid = Uuid::from_u128(0x00000001_0000_0000_0000_00000000000f);-- /// Get the UUID for this system property.- pub const fn uuid(&self) -> Uuid {- match self {- Self::Assignees => Self::ASSIGNEES_UUID,- Self::Status => Self::STATUS_UUID,- Self::Priority => Self::PRIORITY_UUID,- Self::DueDate => Self::DUE_DATE_UUID,- Self::ParentTask => Self::PARENT_TASK_UUID,- Self::Subtasks => Self::SUBTASKS_UUID,- Self::DependsOn => Self::DEPENDS_ON_UUID,- Self::Effort => Self::EFFORT_UUID,- Self::StoryPoints => Self::STORY_POINTS_UUID,- Self::RelevantDocuments => Self::RELEVANT_DOCUMENTS_UUID,- Self::Source => Self::SOURCE_UUID,- Self::Companies => Self::COMPANIES_UUID,- Self::Sender => Self::SENDER_UUID,- Self::Recipients => Self::RECIPIENTS_UUID,- Self::Subject => Self::SUBJECT_UUID,- }- }+ $(+ #[doc = concat!("UUID for ", stringify!($variant), " property")]+ pub const $const_name: Uuid = Uuid::from_u128(Self::BASE_UUID + $uuid_suffix);+ )*- /// Get the display name for this system property.- pub const fn display_name(&self) -> &'static str {- match self {- Self::Assignees => "Assignees",- Self::Status => "Status",- Self::Priority => "Priority",- Self::DueDate => "Due Date",- Self::ParentTask => "Parent Task",- Self::Subtasks => "Subtasks",- Self::DependsOn => "Depends On",- Self::Effort => "Effort",- Self::StoryPoints => "Story Points",- Self::RelevantDocuments => "Relevant Documents",- Self::Source => "Source",- Self::Companies => "Companies",- Self::Sender => "Sender",- Self::Recipients => "Recipients",- Self::Subject => "Subject",- }- }+ /// Get the UUID for this system property.+ pub const fn uuid(&self) -> Uuid {+ match self {+ $(Self::$variant => Self::$const_name),*+ }+ }++ /// Get the display name for this system property.+ pub const fn display_name(&self) -> &'static str {+ match self {+ $(Self::$variant => $display),*+ }+ }++ /// Try to get a SystemPropertyKey from a UUID.+ pub const fn from_uuid(uuid: Uuid) -> Option<Self> {+ $(+ if uuid.as_u128() == Self::$const_name.as_u128() {+ return Some(Self::$variant);+ }+ )*+ None+ }++ /// Check if a UUID is a system property UUID.+ pub const fn is_system_uuid(uuid: Uuid) -> bool {+ Self::from_uuid(uuid).is_some()+ }- /// Try to get a SystemPropertyKey from a UUID.- pub fn from_uuid(uuid: Uuid) -> Option<Self> {- match uuid {- u if u == Self::ASSIGNEES_UUID => Some(Self::Assignees),- u if u == Self::STATUS_UUID => Some(Self::Status),- u if u == Self::PRIORITY_UUID => Some(Self::Priority),- u if u == Self::DUE_DATE_UUID => Some(Self::DueDate),- u if u == Self::PARENT_TASK_UUID => Some(Self::ParentTask),- u if u == Self::SUBTASKS_UUID => Some(Self::Subtasks),- u if u == Self::DEPENDS_ON_UUID => Some(Self::DependsOn),- u if u == Self::EFFORT_UUID => Some(Self::Effort),- u if u == Self::STORY_POINTS_UUID => Some(Self::StoryPoints),- u if u == Self::RELEVANT_DOCUMENTS_UUID => Some(Self::RelevantDocuments),- u if u == Self::SOURCE_UUID => Some(Self::Source),- u if u == Self::COMPANIES_UUID => Some(Self::Companies),- u if u == Self::SENDER_UUID => Some(Self::Sender),- u if u == Self::RECIPIENTS_UUID => Some(Self::Recipients),- u if u == Self::SUBJECT_UUID => Some(Self::Subject),- _ => None,+ /// Returns all system property keys.+ pub const fn all_system_property_keys() -> &'static [Uuid] {+ &[$(Self::$const_name),*]+ }}- }+ };+}- /// Check if a UUID is a system property UUID.- pub fn is_system_uuid(uuid: Uuid) -> bool {- Self::from_uuid(uuid).is_some()- }+define_system_properties! {+ // Tasks+ Assignees, ASSIGNEES_UUID, 0x01, "Assignees";+ Status, STATUS_UUID, 0x02, "Status";+ Priority, PRIORITY_UUID, 0x03, "Priority";+ DueDate, DUE_DATE_UUID, 0x04, "Due Date";+ ParentTask, PARENT_TASK_UUID, 0x05, "Parent Task";+ Subtasks, SUBTASKS_UUID, 0x06, "Subtasks";+ DependsOn, DEPENDS_ON_UUID, 0x07, "Depends On";+ Effort, EFFORT_UUID, 0x08, "Effort";+ StoryPoints, STORY_POINTS_UUID, 0x09, "Story Points";+ RelevantDocuments, RELEVANT_DOCUMENTS_UUID, 0x0a, "Relevant Documents";++ // Emails Attachments+ Source, SOURCE_UUID, 0x0b, "Source";+ Companies, COMPANIES_UUID, 0x0c, "Companies";+ Sender, SENDER_UUID, 0x0d, "Sender";+ Recipients, RECIPIENTS_UUID, 0x0e, "Recipients";+ Subject, SUBJECT_UUID, 0x0f, "Subject";+}+impl SystemPropertyKey {/// Returns the property definition IDs that are required (cannot be removed) for a given entity type./// These are fundamental built-in properties that define the entity's core behavior.////// Extensible: Add new entity types and their required properties here as needed.- pub fn required_property_ids_for_entity(entity_type: EntityType) -> &'static [Uuid] {+ pub const fn required_property_ids_for_entity(entity_type: EntityType) -> &'static [Uuid] {match entity_type {EntityType::Task => &[Self::ASSIGNEES_UUID,@@ -148,3 +128,150 @@ impl SystemPropertyKey {Self::required_property_ids_for_entity(entity_type).contains(&property_definition_id)}}++#[cfg(test)]+mod tests {+ use super::*;++ #[test]+ fn test_from_uuid_returns_none_for_unknown_uuid() {+ let unknown_uuid = Uuid::from_u128(0xdeadbeef_dead_beef_dead_beefdeadbeef);+ assert_eq!(SystemPropertyKey::from_uuid(unknown_uuid), None);+ }++ #[test]+ fn test_is_system_uuid_returns_true_for_system_uuids() {+ assert!(SystemPropertyKey::is_system_uuid(+ SystemPropertyKey::ASSIGNEES_UUID+ ));+ assert!(SystemPropertyKey::is_system_uuid(+ SystemPropertyKey::STATUS_UUID+ ));+ assert!(SystemPropertyKey::is_system_uuid(+ SystemPropertyKey::SUBJECT_UUID+ ));+ }++ #[test]+ fn test_is_system_uuid_returns_false_for_unknown_uuid() {+ let unknown_uuid = Uuid::from_u128(0xdeadbeef_dead_beef_dead_beefdeadbeef);+ assert!(!SystemPropertyKey::is_system_uuid(unknown_uuid));+ }++ #[test]+ fn test_all_system_property_keys_returns_all_uuids() {+ let all_keys = SystemPropertyKey::all_system_property_keys();+ assert_eq!(all_keys.len(), 15);+ assert!(all_keys.contains(&SystemPropertyKey::ASSIGNEES_UUID));+ assert!(all_keys.contains(&SystemPropertyKey::STATUS_UUID));+ assert!(all_keys.contains(&SystemPropertyKey::PRIORITY_UUID));+ assert!(all_keys.contains(&SystemPropertyKey::DUE_DATE_UUID));+ assert!(all_keys.contains(&SystemPropertyKey::PARENT_TASK_UUID));+ assert!(all_keys.contains(&SystemPropertyKey::SUBTASKS_UUID));+ assert!(all_keys.contains(&SystemPropertyKey::DEPENDS_ON_UUID));+ assert!(all_keys.contains(&SystemPropertyKey::EFFORT_UUID));+ assert!(all_keys.contains(&SystemPropertyKey::STORY_POINTS_UUID));+ assert!(all_keys.contains(&SystemPropertyKey::RELEVANT_DOCUMENTS_UUID));+ assert!(all_keys.contains(&SystemPropertyKey::SOURCE_UUID));+ assert!(all_keys.contains(&SystemPropertyKey::COMPANIES_UUID));+ assert!(all_keys.contains(&SystemPropertyKey::SENDER_UUID));+ assert!(all_keys.contains(&SystemPropertyKey::RECIPIENTS_UUID));+ assert!(all_keys.contains(&SystemPropertyKey::SUBJECT_UUID));+ }++ #[test]+ fn test_required_property_ids_for_task() {+ let required = SystemPropertyKey::required_property_ids_for_entity(EntityType::Task);+ assert_eq!(required.len(), 10);+ assert!(required.contains(&SystemPropertyKey::ASSIGNEES_UUID));+ assert!(required.contains(&SystemPropertyKey::STATUS_UUID));+ assert!(required.contains(&SystemPropertyKey::PRIORITY_UUID));+ assert!(required.contains(&SystemPropertyKey::DUE_DATE_UUID));+ assert!(required.contains(&SystemPropertyKey::PARENT_TASK_UUID));+ assert!(required.contains(&SystemPropertyKey::SUBTASKS_UUID));+ assert!(required.contains(&SystemPropertyKey::DEPENDS_ON_UUID));+ assert!(required.contains(&SystemPropertyKey::EFFORT_UUID));+ assert!(required.contains(&SystemPropertyKey::STORY_POINTS_UUID));+ assert!(required.contains(&SystemPropertyKey::RELEVANT_DOCUMENTS_UUID));+ }++ #[test]+ fn test_required_property_ids_for_non_task_entity_returns_empty() {+ let required = SystemPropertyKey::required_property_ids_for_entity(EntityType::Document);+ assert!(required.is_empty());+ }++ #[test]+ fn test_is_required_for_entity_returns_true_for_task_properties() {+ assert!(SystemPropertyKey::is_required_for_entity(+ SystemPropertyKey::ASSIGNEES_UUID,+ EntityType::Task+ ));+ assert!(SystemPropertyKey::is_required_for_entity(+ SystemPropertyKey::STATUS_UUID,+ EntityType::Task+ ));+ }++ #[test]+ fn test_is_required_for_entity_returns_false_for_non_task_properties() {+ assert!(!SystemPropertyKey::is_required_for_entity(+ SystemPropertyKey::SOURCE_UUID,+ EntityType::Task+ ));+ assert!(!SystemPropertyKey::is_required_for_entity(+ SystemPropertyKey::SENDER_UUID,+ EntityType::Task+ ));+ }++ #[test]+ fn test_is_required_for_entity_returns_false_for_non_task_entity() {+ assert!(!SystemPropertyKey::is_required_for_entity(+ SystemPropertyKey::ASSIGNEES_UUID,+ EntityType::Document+ ));+ }++ #[test]+ fn test_uuids_are_unique() {+ let all_keys = SystemPropertyKey::all_system_property_keys();+ let mut seen = std::collections::HashSet::new();+ for uuid in all_keys {+ assert!(seen.insert(uuid), "Duplicate UUID found: {:?}", uuid);+ }+ }++ #[test]+ fn test_uuid_roundtrip() {+ // Test that uuid() -> from_uuid() roundtrips correctly for all variants+ let variants = [+ SystemPropertyKey::Assignees,+ SystemPropertyKey::Status,+ SystemPropertyKey::Priority,+ SystemPropertyKey::DueDate,+ SystemPropertyKey::ParentTask,+ SystemPropertyKey::Subtasks,+ SystemPropertyKey::DependsOn,+ SystemPropertyKey::Effort,+ SystemPropertyKey::StoryPoints,+ SystemPropertyKey::RelevantDocuments,+ SystemPropertyKey::Source,+ SystemPropertyKey::Companies,+ SystemPropertyKey::Sender,+ SystemPropertyKey::Recipients,+ SystemPropertyKey::Subject,+ ];++ for variant in variants {+ let uuid = variant.uuid();+ let recovered = SystemPropertyKey::from_uuid(uuid);+ assert_eq!(+ recovered,+ Some(variant),+ "Roundtrip failed for {:?}",+ variant+ );+ }+ }+}