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(search): filter by sub_type and enrich with properties (#2196)
gbirmanf54dac511577
diff --git a/js/app/packages/entity/src/types/entity.ts b/js/app/packages/entity/src/types/entity.tsindex 9351180c34..64a907e134 100644--- a/js/app/packages/entity/src/types/entity.ts+++ b/js/app/packages/entity/src/types/entity.ts@@ -53,6 +53,7 @@ export type BaseDocumentEntity = EntityBase & {fileType?: string;projectId?: string;subType?: SubType;+ properties?: SoupProperty[];};export type TaskEntity = EntityBase & {diff --git a/js/app/packages/queries/soup/transform-utils.ts b/js/app/packages/queries/soup/transform-utils.tsindex 23dee40e03..4195101a77 100644--- a/js/app/packages/queries/soup/transform-utils.ts+++ b/js/app/packages/queries/soup/transform-utils.ts@@ -200,6 +200,7 @@ export const useSearchResponseItemMapper = () => {results: result.document_search_results,});}+ const properties = result.properties ?? undefined;return {type: 'document',subType: result.sub_type === 'task' ? { type: 'task' } : null,@@ -210,6 +211,7 @@ export const useSearchResponseItemMapper = () => {updatedAt: result.metadata?.updated_at,fileType: result.file_type || undefined,projectId: result.metadata?.project_id ?? undefined,+ properties,search,};}diff --git a/js/app/packages/service-clients/service-search/generated/models/dataType.ts b/js/app/packages/service-clients/service-search/generated/models/dataType.tsnew file mode 100644index 0000000000..b1753c06f9--- /dev/null+++ b/js/app/packages/service-clients/service-search/generated/models/dataType.ts@@ -0,0 +1,23 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * search_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-search/generated/models/documentSearchResponseItemWithMetadataAllOf.ts b/js/app/packages/service-clients/service-search/generated/models/documentSearchResponseItemWithMetadataAllOf.tsindex 43e107f762..9dafef13ea 100644--- a/js/app/packages/service-clients/service-search/generated/models/documentSearchResponseItemWithMetadataAllOf.ts+++ b/js/app/packages/service-clients/service-search/generated/models/documentSearchResponseItemWithMetadataAllOf.ts@@ -5,7 +5,10 @@* OpenAPI spec version: 0.1.0*/import type { DocumentSearchResponseItemWithMetadataAllOfMetadata } from './documentSearchResponseItemWithMetadataAllOfMetadata';+import type { DocumentSearchResponseItemWithMetadataAllOfProperties } from './documentSearchResponseItemWithMetadataAllOfProperties';export type DocumentSearchResponseItemWithMetadataAllOf = {metadata?: DocumentSearchResponseItemWithMetadataAllOfMetadata;+ /** Entity properties (assignees, status, priority, etc.) for markdown documents. */+ properties?: DocumentSearchResponseItemWithMetadataAllOfProperties;};diff --git a/js/app/packages/service-clients/service-search/generated/models/documentSearchResponseItemWithMetadataAllOfProperties.ts b/js/app/packages/service-clients/service-search/generated/models/documentSearchResponseItemWithMetadataAllOfProperties.tsnew file mode 100644index 0000000000..7087049039--- /dev/null+++ b/js/app/packages/service-clients/service-search/generated/models/documentSearchResponseItemWithMetadataAllOfProperties.ts@@ -0,0 +1,14 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * search_service+ * OpenAPI spec version: 0.1.0+ */+import type { SoupProperty } from './soupProperty';++/**+ * Entity properties (assignees, status, priority, etc.) for markdown documents.+ */+export type DocumentSearchResponseItemWithMetadataAllOfProperties =+ | SoupProperty[]+ | null;diff --git a/js/app/packages/service-clients/service-search/generated/models/entityReference.ts b/js/app/packages/service-clients/service-search/generated/models/entityReference.tsnew file mode 100644index 0000000000..34438e8a67--- /dev/null+++ b/js/app/packages/service-clients/service-search/generated/models/entityReference.ts@@ -0,0 +1,20 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * search_service+ * OpenAPI spec version: 0.1.0+ */++import type { EntityReferenceSpecificMessageId } from './entityReferenceSpecificMessageId';+import type { EntityType } from './entityType';++/**+ * Entity reference for entity-type property values.+ */+export interface EntityReference {+ entity_id: string;+ entity_type: EntityType;+ /** For CHANNEL, CHAT, THREAD entity types - optional specific message ID.+This allows referencing a specific message within a thread/channel/chat. */+ specific_message_id?: EntityReferenceSpecificMessageId;+}diff --git a/js/app/packages/service-clients/service-search/generated/models/entityReferenceSpecificMessageId.ts b/js/app/packages/service-clients/service-search/generated/models/entityReferenceSpecificMessageId.tsnew file mode 100644index 0000000000..91e51653a5--- /dev/null+++ b/js/app/packages/service-clients/service-search/generated/models/entityReferenceSpecificMessageId.ts@@ -0,0 +1,12 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * search_service+ * OpenAPI spec version: 0.1.0+ */++/**+ * For CHANNEL, CHAT, THREAD entity types - optional specific message ID.+This allows referencing a specific message within a thread/channel/chat.+ */+export type EntityReferenceSpecificMessageId = string | null;diff --git a/js/app/packages/service-clients/service-search/generated/models/entityType.ts b/js/app/packages/service-clients/service-search/generated/models/entityType.tsnew file mode 100644index 0000000000..91740bbf50--- /dev/null+++ b/js/app/packages/service-clients/service-search/generated/models/entityType.ts@@ -0,0 +1,23 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * search_service+ * OpenAPI spec version: 0.1.0+ */++/**+ * Type of entity that can be referenced by entity properties.+ */+export type EntityType = (typeof EntityType)[keyof typeof EntityType];++// eslint-disable-next-line @typescript-eslint/no-redeclare+export const EntityType = {+ CHANNEL: 'CHANNEL',+ CHAT: 'CHAT',+ COMPANY: 'COMPANY',+ DOCUMENT: 'DOCUMENT',+ PROJECT: 'PROJECT',+ TASK: 'TASK',+ THREAD: 'THREAD',+ USER: 'USER',+} as const;diff --git a/js/app/packages/service-clients/service-search/generated/models/index.ts b/js/app/packages/service-clients/service-search/generated/models/index.tsindex 188b804750..7995c047eb 100644--- a/js/app/packages/service-clients/service-search/generated/models/index.ts+++ b/js/app/packages/service-clients/service-search/generated/models/index.ts@@ -52,6 +52,7 @@ export * from './chatSearchResponseItem';export * from './chatSearchResponseItemWithMetadata';export * from './chatSearchResponseItemWithMetadataAllOf';export * from './chatSearchResponseItemWithMetadataAllOfMetadata';+export * from './dataType';export * from './documentFilters';export * from './documentFiltersImportance';export * from './documentFiltersIsEmailAttachment';@@ -72,6 +73,7 @@ export * from './documentSearchResponseItemSubType';export * from './documentSearchResponseItemWithMetadata';export * from './documentSearchResponseItemWithMetadataAllOf';export * from './documentSearchResponseItemWithMetadataAllOfMetadata';+export * from './documentSearchResponseItemWithMetadataAllOfProperties';export * from './documentSearchResult';export * from './documentSearchResultNodeId';export * from './documentSearchResultRawContent';@@ -100,6 +102,9 @@ export * from './emailSearchResultMessageId';export * from './emailSearchResultScore';export * from './emailSearchResultSentAt';export * from './emptyResponse';+export * from './entityReference';+export * from './entityReferenceSpecificMessageId';+export * from './entityType';export * from './errorResponse';export * from './fileType';export * from './matchType';@@ -125,6 +130,32 @@ export * from './projectSearchResponseItemWithMetadataAllOf';export * from './projectSearchResponseItemWithMetadataAllOfMetadata';export * from './projectSearchResult';export * from './projectSearchResultScore';+export * from './propertyDefinition';+export * from './propertyDefinitionSpecificEntityType';+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 './searchHighlight';export * from './searchHighlightName';export * from './searchHighlightSender';@@ -191,6 +222,8 @@ export * from './simpleUnifiedSearchResponseBaseItemOneOfOnezeroAllOfType';export * from './simpleUnifiedSearchResponseBaseItemOneOfSeven';export * from './simpleUnifiedSearchResponseBaseItemOneOfSevenAllOf';export * from './simpleUnifiedSearchResponseBaseItemOneOfSevenAllOfType';+export * from './soupProperty';+export * from './soupPropertyValue';export * from './taskFilters';export * from './taskFiltersIncludeCbmAtmNc';export * from './unifiedSearchFilters';diff --git a/js/app/packages/service-clients/service-search/generated/models/propertyDefinition.ts b/js/app/packages/service-clients/service-search/generated/models/propertyDefinition.tsnew file mode 100644index 0000000000..e75f9b668c--- /dev/null+++ b/js/app/packages/service-clients/service-search/generated/models/propertyDefinition.ts@@ -0,0 +1,28 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * search_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-search/generated/models/propertyDefinitionSpecificEntityType.ts b/js/app/packages/service-clients/service-search/generated/models/propertyDefinitionSpecificEntityType.tsnew file mode 100644index 0000000000..e60d305d97--- /dev/null+++ b/js/app/packages/service-clients/service-search/generated/models/propertyDefinitionSpecificEntityType.ts@@ -0,0 +1,9 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * search_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-search/generated/models/propertyOwner.ts b/js/app/packages/service-clients/service-search/generated/models/propertyOwner.tsnew file mode 100644index 0000000000..7ca8efe26c--- /dev/null+++ b/js/app/packages/service-clients/service-search/generated/models/propertyOwner.ts@@ -0,0 +1,19 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * search_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-search/generated/models/propertyOwnerOneOf.ts b/js/app/packages/service-clients/service-search/generated/models/propertyOwnerOneOf.tsnew file mode 100644index 0000000000..fc5279046b--- /dev/null+++ b/js/app/packages/service-clients/service-search/generated/models/propertyOwnerOneOf.ts@@ -0,0 +1,15 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * search_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-search/generated/models/propertyOwnerOneOfFive.ts b/js/app/packages/service-clients/service-search/generated/models/propertyOwnerOneOfFive.tsnew file mode 100644index 0000000000..1836ad4793--- /dev/null+++ b/js/app/packages/service-clients/service-search/generated/models/propertyOwnerOneOfFive.ts@@ -0,0 +1,16 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * search_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-search/generated/models/propertyOwnerOneOfFiveScope.ts b/js/app/packages/service-clients/service-search/generated/models/propertyOwnerOneOfFiveScope.tsnew file mode 100644index 0000000000..694597bd1e--- /dev/null+++ b/js/app/packages/service-clients/service-search/generated/models/propertyOwnerOneOfFiveScope.ts@@ -0,0 +1,14 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * search_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-search/generated/models/propertyOwnerOneOfScope.ts b/js/app/packages/service-clients/service-search/generated/models/propertyOwnerOneOfScope.tsnew file mode 100644index 0000000000..3ef8283912--- /dev/null+++ b/js/app/packages/service-clients/service-search/generated/models/propertyOwnerOneOfScope.ts@@ -0,0 +1,14 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * search_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-search/generated/models/propertyOwnerOneOfSeven.ts b/js/app/packages/service-clients/service-search/generated/models/propertyOwnerOneOfSeven.tsnew file mode 100644index 0000000000..69e3a674ce--- /dev/null+++ b/js/app/packages/service-clients/service-search/generated/models/propertyOwnerOneOfSeven.ts@@ -0,0 +1,14 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * search_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-search/generated/models/propertyOwnerOneOfSevenScope.ts b/js/app/packages/service-clients/service-search/generated/models/propertyOwnerOneOfSevenScope.tsnew file mode 100644index 0000000000..fb57b087b2--- /dev/null+++ b/js/app/packages/service-clients/service-search/generated/models/propertyOwnerOneOfSevenScope.ts@@ -0,0 +1,14 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * search_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-search/generated/models/propertyOwnerOneOfThree.ts b/js/app/packages/service-clients/service-search/generated/models/propertyOwnerOneOfThree.tsnew file mode 100644index 0000000000..b249636db0--- /dev/null+++ b/js/app/packages/service-clients/service-search/generated/models/propertyOwnerOneOfThree.ts@@ -0,0 +1,15 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * search_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-search/generated/models/propertyOwnerOneOfThreeScope.ts b/js/app/packages/service-clients/service-search/generated/models/propertyOwnerOneOfThreeScope.tsnew file mode 100644index 0000000000..5b24511c3e--- /dev/null+++ b/js/app/packages/service-clients/service-search/generated/models/propertyOwnerOneOfThreeScope.ts@@ -0,0 +1,14 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * search_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-search/generated/models/propertyValue.ts b/js/app/packages/service-clients/service-search/generated/models/propertyValue.tsnew file mode 100644index 0000000000..42e726ab13--- /dev/null+++ b/js/app/packages/service-clients/service-search/generated/models/propertyValue.ts@@ -0,0 +1,28 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * search_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-search/generated/models/propertyValueOneOf.ts b/js/app/packages/service-clients/service-search/generated/models/propertyValueOneOf.tsnew file mode 100644index 0000000000..0e73c08632--- /dev/null+++ b/js/app/packages/service-clients/service-search/generated/models/propertyValueOneOf.ts@@ -0,0 +1,18 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * search_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-search/generated/models/propertyValueOneOfFive.ts b/js/app/packages/service-clients/service-search/generated/models/propertyValueOneOfFive.tsnew file mode 100644index 0000000000..bf53332c74--- /dev/null+++ b/js/app/packages/service-clients/service-search/generated/models/propertyValueOneOfFive.ts@@ -0,0 +1,18 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * search_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-search/generated/models/propertyValueOneOfFiveType.ts b/js/app/packages/service-clients/service-search/generated/models/propertyValueOneOfFiveType.tsnew file mode 100644index 0000000000..6dcb7dcbdb--- /dev/null+++ b/js/app/packages/service-clients/service-search/generated/models/propertyValueOneOfFiveType.ts@@ -0,0 +1,14 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * search_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-search/generated/models/propertyValueOneOfNine.ts b/js/app/packages/service-clients/service-search/generated/models/propertyValueOneOfNine.tsnew file mode 100644index 0000000000..068aab7017--- /dev/null+++ b/js/app/packages/service-clients/service-search/generated/models/propertyValueOneOfNine.ts@@ -0,0 +1,20 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * search_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-search/generated/models/propertyValueOneOfNineType.ts b/js/app/packages/service-clients/service-search/generated/models/propertyValueOneOfNineType.tsnew file mode 100644index 0000000000..94ecc3e5fe--- /dev/null+++ b/js/app/packages/service-clients/service-search/generated/models/propertyValueOneOfNineType.ts@@ -0,0 +1,14 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * search_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-search/generated/models/propertyValueOneOfOneone.ts b/js/app/packages/service-clients/service-search/generated/models/propertyValueOneOfOneone.tsnew file mode 100644index 0000000000..cf7b8a9ef3--- /dev/null+++ b/js/app/packages/service-clients/service-search/generated/models/propertyValueOneOfOneone.ts@@ -0,0 +1,22 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * search_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-search/generated/models/propertyValueOneOfOneoneType.ts b/js/app/packages/service-clients/service-search/generated/models/propertyValueOneOfOneoneType.tsnew file mode 100644index 0000000000..4ac4d4ee39--- /dev/null+++ b/js/app/packages/service-clients/service-search/generated/models/propertyValueOneOfOneoneType.ts@@ -0,0 +1,14 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * search_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-search/generated/models/propertyValueOneOfOnethree.ts b/js/app/packages/service-clients/service-search/generated/models/propertyValueOneOfOnethree.tsnew file mode 100644index 0000000000..91131f323b--- /dev/null+++ b/js/app/packages/service-clients/service-search/generated/models/propertyValueOneOfOnethree.ts@@ -0,0 +1,20 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * search_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-search/generated/models/propertyValueOneOfOnethreeType.ts b/js/app/packages/service-clients/service-search/generated/models/propertyValueOneOfOnethreeType.tsnew file mode 100644index 0000000000..9ee3addfac--- /dev/null+++ b/js/app/packages/service-clients/service-search/generated/models/propertyValueOneOfOnethreeType.ts@@ -0,0 +1,14 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * search_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-search/generated/models/propertyValueOneOfSeven.ts b/js/app/packages/service-clients/service-search/generated/models/propertyValueOneOfSeven.tsnew file mode 100644index 0000000000..79e44cbe9a--- /dev/null+++ b/js/app/packages/service-clients/service-search/generated/models/propertyValueOneOfSeven.ts@@ -0,0 +1,18 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * search_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-search/generated/models/propertyValueOneOfSevenType.ts b/js/app/packages/service-clients/service-search/generated/models/propertyValueOneOfSevenType.tsnew file mode 100644index 0000000000..b9deaafa2c--- /dev/null+++ b/js/app/packages/service-clients/service-search/generated/models/propertyValueOneOfSevenType.ts@@ -0,0 +1,14 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * search_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-search/generated/models/propertyValueOneOfThree.ts b/js/app/packages/service-clients/service-search/generated/models/propertyValueOneOfThree.tsnew file mode 100644index 0000000000..fe4ce3296c--- /dev/null+++ b/js/app/packages/service-clients/service-search/generated/models/propertyValueOneOfThree.ts@@ -0,0 +1,18 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * search_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-search/generated/models/propertyValueOneOfThreeType.ts b/js/app/packages/service-clients/service-search/generated/models/propertyValueOneOfThreeType.tsnew file mode 100644index 0000000000..1f016dbe53--- /dev/null+++ b/js/app/packages/service-clients/service-search/generated/models/propertyValueOneOfThreeType.ts@@ -0,0 +1,14 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * search_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-search/generated/models/propertyValueOneOfType.ts b/js/app/packages/service-clients/service-search/generated/models/propertyValueOneOfType.tsnew file mode 100644index 0000000000..f4b019592f--- /dev/null+++ b/js/app/packages/service-clients/service-search/generated/models/propertyValueOneOfType.ts@@ -0,0 +1,14 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * search_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-search/generated/models/soupProperty.ts b/js/app/packages/service-clients/service-search/generated/models/soupProperty.tsnew file mode 100644index 0000000000..5fcfaac1e9--- /dev/null+++ b/js/app/packages/service-clients/service-search/generated/models/soupProperty.ts@@ -0,0 +1,20 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * search_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-search/generated/models/soupPropertyValue.ts b/js/app/packages/service-clients/service-search/generated/models/soupPropertyValue.tsnew file mode 100644index 0000000000..d730fc0cd7--- /dev/null+++ b/js/app/packages/service-clients/service-search/generated/models/soupPropertyValue.ts@@ -0,0 +1,9 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * search_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-search/openapi.json b/js/app/packages/service-clients/service-search/openapi.jsonindex 1f84d2c289..3d62e97388 100644--- a/js/app/packages/service-clients/service-search/openapi.json+++ b/js/app/packages/service-clients/service-search/openapi.json@@ -629,6 +629,20 @@],"description": "ChatSearchResponse object with channel metadata we fetch from macrodb. we don't store these\ntimestamps in opensearch as they would require us to update each chat message record for the chat\nevery time the chat updates (specifically for updated_at and viewed_at)"},+ "DataType": {+ "type": "string",+ "description": "Data type for property values, determining storage and validation.",+ "enum": [+ "BOOLEAN",+ "DATE",+ "NUMBER",+ "STRING",+ "SELECT_NUMBER",+ "SELECT_STRING",+ "ENTITY",+ "LINK"+ ]+ },"DocumentFilters": {"type": "object","description": "The document filters used to filter down what documents you search over.",@@ -844,6 +858,13 @@"description": "Metadata from the database. None if the document doesn't exist in the database."}]+ },+ "properties": {+ "type": ["array", "null"],+ "items": {+ "$ref": "#/components/schemas/SoupProperty"+ },+ "description": "Entity properties (assignees, status, priority, etc.) for markdown documents."}}}@@ -1199,6 +1220,38 @@"type": "object","description": "Empty response is required due to custom fetch forcing `response.json()`"},+ "EntityReference": {+ "type": "object",+ "description": "Entity reference for entity-type property values.",+ "required": ["entity_id", "entity_type"],+ "properties": {+ "entity_id": {+ "type": "string"+ },+ "entity_type": {+ "$ref": "#/components/schemas/EntityType"+ },+ "specific_message_id": {+ "type": ["string", "null"],+ "format": "uuid",+ "description": "For CHANNEL, CHAT, THREAD entity types - optional specific message ID.\nThis allows referencing a specific message within a thread/channel/chat."+ }+ }+ },+ "EntityType": {+ "type": "string",+ "description": "Type of entity that can be referenced by entity properties.",+ "enum": [+ "CHANNEL",+ "CHAT",+ "COMPANY",+ "DOCUMENT",+ "PROJECT",+ "TASK",+ "THREAD",+ "USER"+ ]+ },"ErrorResponse": {"type": "object","description": "A plain old json error response for use with axum.\nyup, thats it.",@@ -1862,6 +1915,250 @@}}},+ "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"+ }+ }+ },+ "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."+ },"SearchHighlight": {"type": "object","properties": {@@ -2818,6 +3115,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"+ }+ ]+ }+ }+ },"TaskFilters": {"type": "object","description": "Task-only filters nested under document filters.",diff --git a/rust/cloud-storage/Cargo.lock b/rust/cloud-storage/Cargo.lockindex f7e8f40de4..1640383355 100644--- a/rust/cloud-storage/Cargo.lock+++ b/rust/cloud-storage/Cargo.lock@@ -6461,6 +6461,7 @@ dependencies = ["document_sub_type","item_filters","models_opensearch",+ "models_soup","opensearch_client","schemars","serde",@@ -8808,10 +8809,13 @@ dependencies = ["model","models_email","models_opensearch",+ "models_properties","models_search","models_search_cursor",+ "models_soup","name_search","opensearch_client",+ "properties_db_client","secretsmanager_client","serde","serde_json",diff --git a/rust/cloud-storage/models_search/Cargo.toml b/rust/cloud-storage/models_search/Cargo.tomlindex 9542d2c222..e4e02982ff 100644--- a/rust/cloud-storage/models_search/Cargo.toml+++ b/rust/cloud-storage/models_search/Cargo.toml@@ -15,4 +15,5 @@ serde_json = { workspace = true }strum = { workspace = true }utoipa = { workspace = true }document_sub_type = { path = "../document_sub_type" }+models_soup = { path = "../models_soup", features = ["schema"] }uuid = { workspace = true }diff --git a/rust/cloud-storage/models_search/src/document.rs b/rust/cloud-storage/models_search/src/document.rsindex 9ab4565642..ef8408916d 100644--- a/rust/cloud-storage/models_search/src/document.rs+++ b/rust/cloud-storage/models_search/src/document.rs@@ -1,6 +1,7 @@use chrono::{DateTime, Utc};use document_sub_type::DocumentSubType;use item_filters::DocumentFilters;+use models_soup::SoupProperty;use schemars::JsonSchema;use serde::{Deserialize, Serialize};use utoipa::ToSchema;@@ -63,6 +64,10 @@ pub struct DocumentMetadata {pub struct DocumentSearchResponseItemWithMetadata {/// Metadata from the database. None if the document doesn't exist in the database.pub metadata: Option<DocumentMetadata>,+ /// Entity properties (assignees, status, priority, etc.) for markdown documents.+ #[serde(skip_serializing_if = "Option::is_none")]+ #[schemars(skip)]+ pub properties: Option<Vec<SoupProperty>>,#[serde(flatten)]pub extra: DocumentSearchResponseItem,}diff --git a/rust/cloud-storage/opensearch_client/src/search/documents.rs b/rust/cloud-storage/opensearch_client/src/search/documents.rsindex c493c07687..0034058855 100644--- a/rust/cloud-storage/opensearch_client/src/search/documents.rs+++ b/rust/cloud-storage/opensearch_client/src/search/documents.rs@@ -4,7 +4,7 @@ use crate::{};use models_opensearch::SearchEntityType;-use opensearch_query_builder::BoolQueryBuilder;+use opensearch_query_builder::{BoolQueryBuilder, QueryType};#[derive(Clone)]pub(crate) struct DocumentSearchConfig;@@ -17,12 +17,14 @@ impl SearchQueryConfig for DocumentSearchConfig {pub(crate) struct DocumentQueryBuilder {inner: SearchQueryBuilder<DocumentSearchConfig>,+ sub_types: Vec<String>,}impl DocumentQueryBuilder {pub fn new(terms: Vec<String>) -> Self {Self {inner: SearchQueryBuilder::new(terms),+ sub_types: Vec::new(),}}@@ -37,8 +39,22 @@ impl DocumentQueryBuilder {fn ids_only(ids_only: bool) -> Self;}+ pub fn sub_types(mut self, sub_types: Vec<String>) -> Self {+ self.sub_types = sub_types;+ self+ }+pub fn build_bool_query<'a>(&'a self) -> Result<BoolQueryBuilder<'a>> {- self.inner.build_content_bool_query()+ let mut query = self.inner.build_content_bool_query()?;++ if !self.sub_types.is_empty() {+ query.filter(QueryType::terms(+ "sub_type".to_string(),+ self.sub_types.clone(),+ ));+ }++ Ok(query)}}@@ -63,6 +79,7 @@ pub struct DocumentSearchArgs {pub match_type: String,pub collapse: bool,pub ids_only: bool,+ pub sub_types: Vec<String>,}impl From<DocumentSearchArgs> for DocumentQueryBuilder {@@ -75,6 +92,7 @@ impl From<DocumentSearchArgs> for DocumentQueryBuilder {.ids(args.document_ids).collapse(args.collapse).ids_only(args.ids_only)+ .sub_types(args.sub_types)}}diff --git a/rust/cloud-storage/opensearch_client/src/search/unified.rs b/rust/cloud-storage/opensearch_client/src/search/unified.rsindex 47c10c0bab..a9533730cd 100644--- a/rust/cloud-storage/opensearch_client/src/search/unified.rs+++ b/rust/cloud-storage/opensearch_client/src/search/unified.rs@@ -71,6 +71,7 @@ impl From<UnifiedSearchArgs> for DocumentSearchArgs {collapse: args.collapse,ids_only: args.document_search_args.ids_only,document_ids: args.document_search_args.document_ids,+ sub_types: args.document_search_args.sub_types,}}}@@ -145,6 +146,7 @@ pub struct UnifiedDocumentSearchArgs {pub terms: Vec<String>,pub document_ids: Vec<String>,pub ids_only: bool,+ pub sub_types: Vec<String>,}#[derive(Debug, Default, Clone)]diff --git a/rust/cloud-storage/opensearch_client/src/search/unified/test.rs b/rust/cloud-storage/opensearch_client/src/search/unified/test.rsindex 4543004874..1008c16d4b 100644--- a/rust/cloud-storage/opensearch_client/src/search/unified/test.rs+++ b/rust/cloud-storage/opensearch_client/src/search/unified/test.rs@@ -425,6 +425,7 @@ fn test_build_unified_search_request_content() -> anyhow::Result<()> {terms: vec!["test".to_string()],document_ids: vec!["id1".to_string(), "id2".to_string()],ids_only: false,+ ..Default::default()},email_search_args: UnifiedEmailSearchArgs {terms: vec!["test".to_string()],@@ -797,6 +798,7 @@ fn test_build_unified_search_request_content() -> anyhow::Result<()> {terms: vec!["test".to_string()],document_ids: vec!["id1".to_string(), "id2".to_string()],ids_only: false,+ ..Default::default()},email_search_args: UnifiedEmailSearchArgs {terms: vec!["test".to_string()],@@ -848,6 +850,7 @@ fn test_build_unified_search_request_single_index() -> anyhow::Result<()> {terms: vec!["test".to_string()],document_ids: vec!["id1".to_string(), "id2".to_string()],ids_only: false,+ ..Default::default()},..Default::default()};diff --git a/rust/cloud-storage/search_service/Cargo.toml b/rust/cloud-storage/search_service/Cargo.tomlindex 3aa4c6ca01..73844af6ff 100644--- a/rust/cloud-storage/search_service/Cargo.toml+++ b/rust/cloud-storage/search_service/Cargo.toml@@ -29,6 +29,9 @@ item_filters = { path = "../item_filters" }macro_auth = { path = "../macro_auth" }macro_cors = { path = "../macro_cors" }macro_db_client = { path = "../macro_db_client" }+models_properties = { path = "../models_properties" }+models_soup = { path = "../models_soup" }+properties_db_client = { path = "../properties_db_client" }macro_entrypoint = { path = "../macro_entrypoint" }macro_env = { path = "../macro_env" }macro_middleware = { path = "../macro_middleware", default-features = false, features = [diff --git a/rust/cloud-storage/search_service/src/api/search/document.rs b/rust/cloud-storage/search_service/src/api/search/document.rsindex 76591258bd..844e2ed9fc 100644--- a/rust/cloud-storage/search_service/src/api/search/document.rs+++ b/rust/cloud-storage/search_service/src/api/search/document.rs@@ -1,9 +1,11 @@use crate::api::search::simple::SearchError;use indexmap::IndexMap;use models_opensearch::SearchEntityType;+use models_properties::{EntityReference, EntityType};use models_search::document::{DocumentSearchResponseItem, DocumentSearchResponseItemWithMetadata, DocumentSearchResult,};+use models_soup::SoupProperty;use opensearch_client::search::model::SearchGotoContent;use sqlx::types::Uuid;use std::collections::HashMap;@@ -38,9 +40,45 @@ pub(in crate::api::search) async fn enrich_documents(.await.map_err(SearchError::InternalError)?;+ // Fetch properties for markdown documents (tasks, etc.)+ let md_entity_refs: Vec<EntityReference> = document_histories+ .iter()+ .filter(|(_, info)| info.file_type.as_deref() == Some("md"))+ .map(|(id, info)| {+ let entity_type = match info.sub_type {+ Some(document_sub_type::DocumentSubType::Task) => EntityType::Task,+ _ => EntityType::Document,+ };+ EntityReference::new(id.clone(), entity_type)+ })+ .collect();++ let properties_map = if !md_entity_refs.is_empty() {+ properties_db_client::entity_properties::get::get_bulk_entity_properties_values(+ &ctx.db,+ &md_entity_refs,+ )+ .await+ .inspect_err(|e| tracing::error!(error=?e, "failed to fetch entity properties"))+ .unwrap_or_default()+ .into_iter()+ .map(|(id, props)| {+ (+ id,+ props+ .into_iter()+ .map(SoupProperty::from)+ .collect::<Vec<_>>(),+ )+ })+ .collect::<HashMap<_, _>>()+ } else {+ HashMap::new()+ };+// Construct enriched results- let enriched_results =- construct_search_result(results, document_histories).map_err(SearchError::InternalError)?;+ let enriched_results = construct_search_result(results, document_histories, properties_map)+ .map_err(SearchError::InternalError)?;Ok(enriched_results)}@@ -51,6 +89,7 @@ pub fn construct_search_result(String,macro_db_client::document::get_document_history::DocumentHistoryInfo,>,+ properties_map: HashMap<String, Vec<SoupProperty>>,) -> anyhow::Result<Vec<DocumentSearchResponseItemWithMetadata>> {// construct entity hit map of id -> vec<hits> using IndexMap to preserve insertion orderlet entity_id_hit_map: IndexMap<Uuid, Vec<DocumentSearchResult>> = search_results@@ -92,8 +131,13 @@ pub fn construct_search_result(project_id: info.project_id.clone(),deleted_at: info.deleted_at,};+ let properties = properties_map+ .get(&entity_id.to_string())+ .cloned()+ .filter(|p| !p.is_empty());Some(DocumentSearchResponseItemWithMetadata {metadata: Some(metadata),+ properties,extra: DocumentSearchResponseItem {id: entity_id,name: info.file_name.clone(),diff --git a/rust/cloud-storage/search_service/src/api/search/document/test.rs b/rust/cloud-storage/search_service/src/api/search/document/test.rsindex c7c26348a6..089eb1097e 100644--- a/rust/cloud-storage/search_service/src/api/search/document/test.rs+++ b/rust/cloud-storage/search_service/src/api/search/document/test.rs@@ -1,11 +1,15 @@use macro_db_client::document::get_document_history::DocumentHistoryInfo;+use models_properties::service::property_definition::PropertyDefinition;+use models_properties::service::property_value::PropertyValue;+use models_properties::{DataType, shared::PropertyOwner};+use models_soup::SoupProperty;use opensearch_client::search::model::Highlight;use super::*;#[test]fn test_construct_search_result_empty_input() {- let result = construct_search_result(vec![], HashMap::new());+ let result = construct_search_result(vec![], HashMap::new(), HashMap::new());assert!(result.is_ok());assert_eq!(result.unwrap().len(), 0);}@@ -50,7 +54,8 @@ fn test_construct_search_result_single_document() {},);- let result = construct_search_result(search_results, document_histories).unwrap();+ let result =+ construct_search_result(search_results, document_histories, HashMap::new()).unwrap();assert_eq!(result.len(), 1);assert_eq!(@@ -140,7 +145,8 @@ fn test_construct_search_result_multiple_nodes_same_document() {},);- let result = construct_search_result(search_results, document_histories).unwrap();+ let result =+ construct_search_result(search_results, document_histories, HashMap::new()).unwrap();assert_eq!(result.len(), 1);assert_eq!(@@ -216,7 +222,7 @@ fn test_document_history_timestamps() {document_histories.insert("11111111-1111-1111-1111-111111111111".to_string(), history);// Call the function under test- let result = construct_search_result(input, document_histories).unwrap();+ let result = construct_search_result(input, document_histories, HashMap::new()).unwrap();// Verify that timestamps were copied from the document historyassert_eq!(result.len(), 1);@@ -250,7 +256,7 @@ fn test_document_history_missing_entry() {document_histories.insert("22222222-2222-2222-2222-222222222222".to_string(), history);// Call the function under test- let result = construct_search_result(input, document_histories).unwrap();+ let result = construct_search_result(input, document_histories, HashMap::new()).unwrap();// Documents without history info should not returnassert_eq!(result.len(), 0);@@ -281,7 +287,7 @@ fn test_document_history_null_viewed_at() {document_histories.insert("11111111-1111-1111-1111-111111111111".to_string(), history);// Call the function under test- let result = construct_search_result(input, document_histories).unwrap();+ let result = construct_search_result(input, document_histories, HashMap::new()).unwrap();// Verify that timestamps were copied correctly and viewed_at is Noneassert_eq!(result.len(), 1);@@ -333,7 +339,7 @@ fn test_document_history_multiple_documents() {document_histories.insert("22222222-2222-2222-2222-222222222222".to_string(), history2);// Call the function under test- let result = construct_search_result(input, document_histories).unwrap();+ let result = construct_search_result(input, document_histories, HashMap::new()).unwrap();// Verify that timestamps were copied correctly for both documentsassert_eq!(result.len(), 2);@@ -391,7 +397,7 @@ fn test_document_history_partial_missing_entries() {document_histories.insert("11111111-1111-1111-1111-111111111111".to_string(), history);// Call the function under test- let result = construct_search_result(input, document_histories).unwrap();+ let result = construct_search_result(input, document_histories, HashMap::new()).unwrap();// We should have 2 results - one with real data, one not foundassert_eq!(result.len(), 1);@@ -436,7 +442,8 @@ fn test_document_history_deleted() {},);- let result = construct_search_result(input_deleted, document_histories).unwrap();+ let result =+ construct_search_result(input_deleted, document_histories, HashMap::new()).unwrap();// Deleted document should be returned with metadata including deleted_atassert_eq!(result.len(), 1);@@ -454,8 +461,12 @@ fn test_document_history_deleted() {let document_histories_not_found = HashMap::new(); // No entry = not found- let result_not_found =- construct_search_result(input_not_found, document_histories_not_found).unwrap();+ let result_not_found = construct_search_result(+ input_not_found,+ document_histories_not_found,+ HashMap::new(),+ )+ .unwrap();// Document not in DB should not be returnedassert_eq!(result_not_found.len(), 0);@@ -587,9 +598,12 @@ fn test_sort_stability() {);}- let result1 = construct_search_result(input.clone(), document_histories.clone()).unwrap();- let result2 = construct_search_result(input.clone(), document_histories.clone()).unwrap();- let result3 = construct_search_result(input.clone(), document_histories.clone()).unwrap();+ let result1 =+ construct_search_result(input.clone(), document_histories.clone(), HashMap::new()).unwrap();+ let result2 =+ construct_search_result(input.clone(), document_histories.clone(), HashMap::new()).unwrap();+ let result3 =+ construct_search_result(input.clone(), document_histories.clone(), HashMap::new()).unwrap();assert_eq!(result1.len(), 5);assert_eq!(result2.len(), 5);@@ -614,3 +628,90 @@ fn test_sort_stability() {"Results should preserve original search result order");}++fn make_test_soup_property(name: &str) -> SoupProperty {+ SoupProperty {+ definition: PropertyDefinition {+ id: Uuid::new_v4(),+ owner: PropertyOwner::System,+ display_name: name.to_string(),+ data_type: DataType::Entity,+ is_multi_select: true,+ specific_entity_type: None,+ created_at: chrono::Utc::now(),+ updated_at: chrono::Utc::now(),+ is_system: true,+ is_metadata: false,+ },+ value: Some(PropertyValue::EntityRef(vec![])),+ }+}++#[test]+fn test_properties_enrichment_with_properties() {+ let doc_id = "11111111-1111-1111-1111-111111111111";+ let input = vec![create_test_document_response(doc_id, "node_1", None)];++ let mut document_histories = HashMap::new();+ let now = chrono::Utc::now();+ document_histories.insert(+ doc_id.to_string(),+ DocumentHistoryInfo {+ item_id: doc_id.to_string(),+ created_at: now,+ updated_at: now,+ viewed_at: None,+ project_id: None,+ file_type: Some("md".to_string()),+ file_name: "Test Task".to_string(),+ owner: "user1".to_string(),+ deleted_at: None,+ sub_type: Some(document_sub_type::DocumentSubType::Task),+ },+ );++ let mut properties_map = HashMap::new();+ properties_map.insert(+ doc_id.to_string(),+ vec![make_test_soup_property("Assignees")],+ );++ let result = construct_search_result(input, document_histories, properties_map).unwrap();++ assert_eq!(result.len(), 1);+ let props = result[0]+ .properties+ .as_ref()+ .expect("properties should be Some");+ assert_eq!(props.len(), 1);+ assert_eq!(props[0].definition.display_name, "Assignees");+}++#[test]+fn test_properties_enrichment_empty_map() {+ let doc_id = "11111111-1111-1111-1111-111111111111";+ let input = vec![create_test_document_response(doc_id, "node_1", None)];++ let mut document_histories = HashMap::new();+ let now = chrono::Utc::now();+ document_histories.insert(+ doc_id.to_string(),+ DocumentHistoryInfo {+ item_id: doc_id.to_string(),+ created_at: now,+ updated_at: now,+ viewed_at: None,+ project_id: None,+ file_type: Some("md".to_string()),+ file_name: "Test Task".to_string(),+ owner: "user1".to_string(),+ deleted_at: None,+ sub_type: Some(document_sub_type::DocumentSubType::Task),+ },+ );++ let result = construct_search_result(input, document_histories, HashMap::new()).unwrap();++ assert_eq!(result.len(), 1);+ assert!(result[0].properties.is_none());+}diff --git a/rust/cloud-storage/search_service/src/api/search/simple/filter.rs b/rust/cloud-storage/search_service/src/api/search/simple/filter.rsindex 0c4a3d936f..158ca1039f 100644--- a/rust/cloud-storage/search_service/src/api/search/simple/filter.rs+++ b/rust/cloud-storage/search_service/src/api/search/simple/filter.rs@@ -51,6 +51,7 @@ impl FilterVariantToSearchArgs for item_filters::DocumentFilters {Ok(UnifiedDocumentSearchArgs {document_ids: filter_document_response.document_ids,ids_only: filter_document_response.ids_only,+ sub_types: self.sub_types.clone(),..Default::default()})}diff --git a/rust/cloud-storage/search_service/src/api/search/unified/test.rs b/rust/cloud-storage/search_service/src/api/search/unified/test.rsindex d92e57f3aa..38d10a409f 100644--- a/rust/cloud-storage/search_service/src/api/search/unified/test.rs+++ b/rust/cloud-storage/search_service/src/api/search/unified/test.rs@@ -29,6 +29,7 @@ fn test_sort_unified_search_results() {let results: Vec<UnifiedSearchResponseItem> = vec![// Document with updated_at = 1000 (oldest)UnifiedSearchResponseItem::Document(DocumentSearchResponseItemWithMetadata {+ properties: None,metadata: Some(DocumentMetadata {created_at: DateTime::from_timestamp(900, 0).unwrap(),updated_at: DateTime::from_timestamp(1000, 0).unwrap(),@@ -106,6 +107,7 @@ fn test_sort_unified_search_results() {}),// Another Document with updated_at = 2500 (second)UnifiedSearchResponseItem::Document(DocumentSearchResponseItemWithMetadata {+ properties: None,metadata: Some(DocumentMetadata {created_at: DateTime::from_timestamp(2400, 0).unwrap(),updated_at: DateTime::from_timestamp(2500, 0).unwrap(),@@ -283,6 +285,7 @@ fn test_sort_unified_search_results_with_channel() {let results: Vec<UnifiedSearchResponseItem> = vec![// Document with updated_at = 2000UnifiedSearchResponseItem::Document(DocumentSearchResponseItemWithMetadata {+ properties: None,metadata: Some(DocumentMetadata {created_at: DateTime::from_timestamp(1900, 0).unwrap(),updated_at: DateTime::from_timestamp(2000, 0).unwrap(),