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: update front end to handle new search types for handling name search (#424)
gbirmanf10244b054ce
diff --git a/js/app/packages/app/component/command/useChatItems.ts b/js/app/packages/app/component/command/useChatItems.tsdeleted file mode 100644index 593147e9b8..0000000000--- a/js/app/packages/app/component/command/useChatItems.ts+++ /dev/null@@ -1,42 +0,0 @@-import { useSearchChats } from '@core/signal/search';-import { createMemo } from 'solid-js';-import type { CommandItemCard } from './KonsoleItem';--export function useChatItems(fullTextSearchTerm: () => string) {- const chatSearchResults = useSearchChats(fullTextSearchTerm);-- return createMemo(() => {- const chatResults = chatSearchResults();- if (!chatResults) return [];-- const items: CommandItemCard[] = [];- for (const chat of chatResults.results) {- if (- chat.chat_search_results.length === 0 ||- !chat.metadata ||- chat.metadata.deleted_at- )- continue;- for (const result of chat.chat_search_results) {- const contents = result.highlight.content ?? [];- contents.forEach((content, index) => {- items.push({- type: 'item',- data: {- id: chat.chat_id,- name: result.title,- itemType: 'chat',- },- snippet: {- content,- locationId: result.chat_message_id,- fileType: 'chat',- matchIndex: index,- },- });- });- }- }- return items;- });-}diff --git a/js/app/packages/app/component/command/useCommandItems.ts.rej b/js/app/packages/app/component/command/useCommandItems.ts.rejdeleted file mode 100644index f85f58e238..0000000000--- a/js/app/packages/app/component/command/useCommandItems.ts.rej+++ /dev/null@@ -1,11 +0,0 @@-diff a/js/app/packages/app/component/command/useCommandItems.ts b/js/app/packages/app/component/command/useCommandItems.ts (rejected hunks)-@@ -31,6 +32,9 @@ export function useCommandItems() {- const channelsContext = useChannelsContext();- const channels = () => channelsContext.channels();- const contactItems = useEmailContacts();-+-+ const entityActionItems = useEntityActionItems();-+- const activeScope = activeScopeStack().at(-1) ?? 'global';- const activeCommands = getActiveCommandsFromScope(activeScope, {- sortByScopeLevel: false,diff --git a/js/app/packages/app/component/command/useDocumentItems.ts b/js/app/packages/app/component/command/useDocumentItems.tsdeleted file mode 100644index 643d5436f4..0000000000--- a/js/app/packages/app/component/command/useDocumentItems.ts+++ /dev/null@@ -1,45 +0,0 @@-import { useSearchDocuments } from '@core/signal/search';-import type { BasicDocumentFileType } from '@service-storage/generated/schemas/basicDocumentFileType';-import { createMemo } from 'solid-js';-import type { CommandItemCard } from './KonsoleItem';--export function useDocumentItems(fullTextSearchTerm: () => string) {- const documentSearchResults = useSearchDocuments(fullTextSearchTerm);-- return createMemo(() => {- const docResults = documentSearchResults();- if (!docResults) return [];-- const items: CommandItemCard[] = [];- for (const doc of docResults.results) {- if (- doc.document_search_results.length === 0 ||- !doc.metadata ||- doc.metadata.deleted_at- )- continue;-- for (const result of doc.document_search_results) {- const contents = result.highlight.content ?? [];- contents.forEach((content, index) => {- items.push({- type: 'item',- data: {- id: doc.document_id,- name: doc.document_name,- fileType: doc.file_type as BasicDocumentFileType,- itemType: 'document',- },- snippet: {- content,- locationId: result.node_id,- fileType: doc.file_type,- matchIndex: index,- },- });- });- }- }- return items;- });-}diff --git a/js/app/packages/app/component/command/useEmailItems.ts b/js/app/packages/app/component/command/useEmailItems.tsdeleted file mode 100644index b0f4afd014..0000000000--- a/js/app/packages/app/component/command/useEmailItems.ts+++ /dev/null@@ -1,64 +0,0 @@-import { createPaginatedEmailSearchResource } from '@core/signal/search';-import { createMemo } from 'solid-js';-import type { EmailSearchResponseItem } from '../../../service-search/generated/models/emailSearchResponseItem';-import type { CommandItemCard } from './KonsoleItem';--function transformEmailResultsToItems(- emailResults: EmailSearchResponseItem[]-): CommandItemCard[] {- const items: CommandItemCard[] = [];-- for (const email of emailResults) {- if (email.email_message_search_results.length === 0) continue;-- for (const result of email.email_message_search_results) {- const contents = result.highlight.content ?? [];- contents.forEach((content, index) => {- items.push({- type: 'email',- data: {- id: email.thread_id,- name: result.subject as string,- sender: result.sender,- // Email TODO: This should be sent time, not update time- timestamp: new Date(result.updated_at * 1000).toISOString(),- is_read: result.labels.indexOf('UNREAD') >= 0,- // TODO: This should be the attachments from the email, need to update the search service to return them- attachments: [],- },- snippet: {- content,- locationId: result.message_id,- fileType: 'email',- matchIndex: index,- },- });- });- }- }-- return items;-}--export function useEmailItems(fullTextSearchTerm: () => string) {- const PAGE_SIZE = 25;-- const { data, loadMore, refresh } = createPaginatedEmailSearchResource(- fullTextSearchTerm,- PAGE_SIZE- );-- const items = createMemo(() => {- const data_ = data();- if (!data_) return [];- return transformEmailResultsToItems(data_.results);- });-- return {- items,- hasMore: data()?.hasMore ?? false,- state: data.state,- loadMore,- refresh,- };-}diff --git a/js/app/packages/app/component/command/useSearchItems.ts b/js/app/packages/app/component/command/useSearchItems.tsindex 5c9f8e77b7..a5b6c5f44d 100644--- a/js/app/packages/app/component/command/useSearchItems.ts+++ b/js/app/packages/app/component/command/useSearchItems.ts@@ -12,6 +12,9 @@ import type { UnifiedSearchResponse } from '../../../service-search/generated/moimport type { UnifiedSearchResponseItem } from '../../../service-search/generated/models/unifiedSearchResponseItem';import type { CommandItemCard } from './KonsoleItem';+const convertSecondsToMillis = (timestamp?: number) =>+ timestamp ? timestamp * 1000 : undefined;+function createDocumentItems(doc: UnifiedSearchResponseItem): CommandItemCard[] {@@ -25,8 +28,10 @@ function createDocumentItems()return [];- // TODO: de-duplicate: see logic in useDocumentItemsfor (const result of doc.document_search_results) {+ const isContentHit = !!result.node_id;+ if (!isContentHit) continue;+const contents = result.highlight.content ?? [];contents.forEach((content, index) => {// TODO: Canvas returns some nasty partial <m-foo> tags in plaintext@@ -42,16 +47,16 @@ function createDocumentItems(},snippet: {content,- locationId: result.node_id,- fileType: doc.file_type,+ locationId: result.node_id!,+ fileType: doc.file_type!,matchIndex: index,// For PDF files, extract additional location data- ...(['docx', 'pdf'].includes(doc.file_type) && {+ ...(['docx', 'pdf'].includes(doc.file_type!) && {searchSnippet: extractSearchSnippet(content),highlightTerms: extractSearchTerms(content),}),},- updatedAt: result.updated_at * 1000, // Convert Unix timestamp to milliseconds+ updatedAt: convertSecondsToMillis(doc.metadata?.updated_at),});}});@@ -66,25 +71,28 @@ function createEmailItems(email: UnifiedSearchResponseItem): CommandItemCard[] {if (email.email_message_search_results.length === 0) return [];- // TODO: de-duplicate: see logic in useEmailItemsfor (const result of email.email_message_search_results) {+ const isContentHit = !!result.message_id;+ if (!isContentHit) continue;+const contents = result.highlight.content ?? [];contents.forEach((content, index) => {items.push({type: 'email',data: {id: email.thread_id,- name: result.subject as string,- sender: result.sender,- // TODO: This should be sent time, not update time- timestamp: new Date(result.updated_at * 1000).toISOString(),- is_read: result.labels.indexOf('UNREAD') >= 0,+ name: email.name ?? '',+ sender: result.sender!,+ timestamp: new Date(+ convertSecondsToMillis(result.sent_at ?? email.updated_at)!+ ).toISOString(),+ is_read: !result.labels.includes('UNREAD'),// TODO: This should be the attachments from the email, need to update the search service to return themattachments: [],},snippet: {content,- locationId: result.message_id,+ locationId: result.message_id!,fileType: 'email',matchIndex: index,},@@ -106,25 +114,27 @@ function createChatItems(chat: UnifiedSearchResponseItem): CommandItemCard[] {)return [];- // TODO: de-duplicate: see logic in useChatItemsfor (const result of chat.chat_search_results) {+ const isContentHit = !!result.chat_message_id;+ if (!isContentHit) continue;+const contents = result.highlight.content ?? [];contents.forEach((content, index) => {items.push({type: 'item',data: {id: chat.chat_id,- name: result.title,+ name: chat.name,itemType: 'chat',},snippet: {content,- locationId: result.chat_message_id,+ locationId: result.chat_message_id!,fileType: 'chat',matchIndex: index,senderId: chat.user_id,},- updatedAt: result.updated_at * 1000, // Convert Unix timestamp to milliseconds+ updatedAt: convertSecondsToMillis(chat.metadata?.updated_at),});});}@@ -141,22 +151,26 @@ function createChannelItems(if (channel.channel_message_search_results.length === 0) return [];for (const result of channel.channel_message_search_results) {+ const isContentHit = !!result.message_id;+ if (!isContentHit) continue;+const contents = result.highlight.content ?? [];contents.forEach((content, index) => {items.push({type: 'channel',data: {id: channel.channel_id,+ // TODO: use channels context to get channel namename: '', // Set name to empty string since search results don't contain channel names anymore},snippet: {content,- locationId: result.message_id,+ locationId: result.message_id!,fileType: 'chat',matchIndex: index,- senderId: result.sender_id,+ senderId: result.sender_id!,},- updatedAt: result.updated_at * 1000, // Convert Unix timestamp to milliseconds+ updatedAt: convertSecondsToMillis(channel.metadata?.updated_at),});});}diff --git a/js/app/packages/core/signal/search.ts b/js/app/packages/core/signal/search.tsindex fcff3c7a8d..d39d147230 100644--- a/js/app/packages/core/signal/search.ts+++ b/js/app/packages/core/signal/search.ts@@ -188,6 +188,7 @@ export function createUnifiedSearchResource(const result = await searchClient.search({request: {+ search_on: 'content',match_type: 'partial',query: term,// in order for an index to be searched on, the key needs to exist in "filters"diff --git a/js/app/packages/macro-entity/src/queries/search.ts b/js/app/packages/macro-entity/src/queries/search.tsindex 1eaddff5a3..4dec0d13b8 100644--- a/js/app/packages/macro-entity/src/queries/search.ts+++ b/js/app/packages/macro-entity/src/queries/search.ts@@ -1,5 +1,6 @@import { useChannelsContext } from '@core/component/ChannelsProvider';import { ENABLE_SEARCH_SERVICE } from '@core/constant/featureFlags';+import { idToDisplayName } from '@core/user';import { isErr } from '@core/util/maybeResult';import {extractSearchSnippet,@@ -50,16 +51,19 @@ const getSearchData = (data: TypedInnerSearchResult): SearchData => {switch (data.type) {case 'channel': {contentHitData = data.results.flatMap((r) => {+ const isContentHit = !!r.message_id;+ if (!isContentHit) return [];+const contents = r.highlight.content ?? [];return contents.map((content) => ({type: 'channel' as const,- id: r.message_id,+ id: r.message_id!,content: mergeAdjacentMacroEmTags(content),- senderId: r.sender_id,- sentAt: r.created_at,+ senderId: r.sender_id!,+ sentAt: r.created_at!,location: {type: 'channel' as const,- messageId: r.message_id,+ messageId: r.message_id!,},}));});@@ -87,11 +91,14 @@ const getSearchData = (data: TypedInnerSearchResult): SearchData => {}case 'md': {contentHitData = data.results.flatMap((r) => {+ const isContentHit = !!r.node_id;+ if (!isContentHit) return [];+const contents = r.highlight.content ?? [];return contents.map((content) => ({type: 'md' as const,content: mergeAdjacentMacroEmTags(content),- location: { type: 'md' as const, nodeId: r.node_id },+ location: { type: 'md' as const, nodeId: r.node_id! },}));});break;@@ -104,7 +111,7 @@ const getSearchData = (data: TypedInnerSearchResult): SearchData => {content: mergeAdjacentMacroEmTags(content),location: {type: 'email' as const,- messageId: r.message_id,+ messageId: r.message_id!,},}));});@@ -178,26 +185,42 @@ const useMapSearchResponseItem = () => {}case 'email': {const emailResult = result.email_message_search_results.at(0);- if (!emailResult) {- console.error('Email result not found', result);- return;- }const search = getSearchData({results: result.email_message_search_results,type: 'email',});++ // Email thread subject match+ // TODO: make sure this looks/feels right in the unified list+ if (!emailResult) {+ return {+ type: 'email',+ id: result.thread_id,+ name: result.name ?? '',+ ownerId: result.owner_id,+ createdAt: result.created_at,+ updatedAt: result.updated_at,+ viewedAt: result.viewed_at ?? undefined,+ isRead: false,+ isImportant: false,+ done: false,+ senderName: idToDisplayName(result.user_id),+ search,+ };+ }+return {type: 'email',id: result.thread_id,- name: emailResult.subject ?? '',- ownerId: emailResult.sender,- createdAt: emailResult.sent_at ?? emailResult.updated_at,- updatedAt: emailResult.sent_at ?? emailResult.updated_at,- viewedAt: emailResult.updated_at,+ name: result.name ?? '',+ ownerId: result.owner_id,+ createdAt: emailResult.sent_at ?? result.updated_at,+ updatedAt: emailResult.sent_at ?? result.updated_at,+ viewedAt: result.viewed_at ?? undefined,isRead: !emailResult.labels.includes('UNREAD'),isImportant: emailResult.labels.includes('IMPORTANT'),done: !emailResult.labels.includes('INBOX'),- senderName: emailResult.sender,+ senderName: emailResult.sender!,search,};}diff --git a/js/app/packages/service-search/generated/models/channelSearchResult.ts b/js/app/packages/service-search/generated/models/channelSearchResult.tsindex e25abd8b5b..7f64f40877 100644--- a/js/app/packages/service-search/generated/models/channelSearchResult.ts+++ b/js/app/packages/service-search/generated/models/channelSearchResult.ts@@ -4,26 +4,34 @@* search_service* OpenAPI spec version: 0.1.0*/+import type { ChannelSearchResultCreatedAt } from './channelSearchResultCreatedAt';import type { SearchHighlight } from './searchHighlight';+import type { ChannelSearchResultMessageId } from './channelSearchResultMessageId';import type { ChannelSearchResultScore } from './channelSearchResultScore';+import type { ChannelSearchResultSenderId } from './channelSearchResultSenderId';import type { ChannelSearchResultThreadId } from './channelSearchResultThreadId';+import type { ChannelSearchResultUpdatedAt } from './channelSearchResultUpdatedAt';/*** A channel message match for a given channel id*/export interface ChannelSearchResult {- /** When the channel message was created */- created_at: number;+ /** When the channel message was created+This is only prsent if the search result is on the message content */+ created_at?: ChannelSearchResultCreatedAt;/** The highlights for the channel message */highlight: SearchHighlight;- /** The channel message id */- message_id: string;+ /** The channel message id+This is only prsent if the search result is on the message content */+ message_id?: ChannelSearchResultMessageId;/** The score of the result */score?: ChannelSearchResultScore;- /** The sender id */- sender_id: string;+ /** The sender id+This is only prsent if the search result is on the message content */+ sender_id?: ChannelSearchResultSenderId;/** The channel message thread id */thread_id?: ChannelSearchResultThreadId;- /** When the channel message was last updated */- updated_at: number;+ /** When the channel message was last updated+This is only prsent if the search result is on the message content */+ updated_at?: ChannelSearchResultUpdatedAt;}diff --git a/js/app/packages/service-search/generated/models/channelSearchResultCreatedAt.ts b/js/app/packages/service-search/generated/models/channelSearchResultCreatedAt.tsnew file mode 100644index 0000000000..71d62a1cbe--- /dev/null+++ b/js/app/packages/service-search/generated/models/channelSearchResultCreatedAt.ts@@ -0,0 +1,12 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * search_service+ * OpenAPI spec version: 0.1.0+ */++/**+ * When the channel message was created+This is only prsent if the search result is on the message content+ */+export type ChannelSearchResultCreatedAt = number | null;diff --git a/js/app/packages/service-search/generated/models/channelSearchResultMessageId.ts b/js/app/packages/service-search/generated/models/channelSearchResultMessageId.tsnew file mode 100644index 0000000000..8b193f3aee--- /dev/null+++ b/js/app/packages/service-search/generated/models/channelSearchResultMessageId.ts@@ -0,0 +1,12 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * search_service+ * OpenAPI spec version: 0.1.0+ */++/**+ * The channel message id+This is only prsent if the search result is on the message content+ */+export type ChannelSearchResultMessageId = string | null;diff --git a/js/app/packages/service-search/generated/models/channelSearchResultSenderId.ts b/js/app/packages/service-search/generated/models/channelSearchResultSenderId.tsnew file mode 100644index 0000000000..db57797eac--- /dev/null+++ b/js/app/packages/service-search/generated/models/channelSearchResultSenderId.ts@@ -0,0 +1,12 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * search_service+ * OpenAPI spec version: 0.1.0+ */++/**+ * The sender id+This is only prsent if the search result is on the message content+ */+export type ChannelSearchResultSenderId = string | null;diff --git a/js/app/packages/service-search/generated/models/channelSearchResultUpdatedAt.ts b/js/app/packages/service-search/generated/models/channelSearchResultUpdatedAt.tsnew file mode 100644index 0000000000..18a2c20bdd--- /dev/null+++ b/js/app/packages/service-search/generated/models/channelSearchResultUpdatedAt.ts@@ -0,0 +1,12 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * search_service+ * OpenAPI spec version: 0.1.0+ */++/**+ * When the channel message was last updated+This is only prsent if the search result is on the message content+ */+export type ChannelSearchResultUpdatedAt = number | null;diff --git a/js/app/packages/service-search/generated/models/chatMessageSearchResult.ts b/js/app/packages/service-search/generated/models/chatMessageSearchResult.tsindex 5bf51a3a06..3326369f00 100644--- a/js/app/packages/service-search/generated/models/chatMessageSearchResult.ts+++ b/js/app/packages/service-search/generated/models/chatMessageSearchResult.ts@@ -4,23 +4,23 @@* search_service* OpenAPI spec version: 0.1.0*/+import type { ChatMessageSearchResultChatMessageId } from './chatMessageSearchResultChatMessageId';import type { SearchHighlight } from './searchHighlight';+import type { ChatMessageSearchResultRole } from './chatMessageSearchResultRole';import type { ChatMessageSearchResultScore } from './chatMessageSearchResultScore';/*** A chat match for a given message id*/export interface ChatMessageSearchResult {- /** The chat message id for the chat */- chat_message_id: string;+ /** The chat message id for the chat+This is only present if the search match was on the chat message content */+ chat_message_id?: ChatMessageSearchResultChatMessageId;/** The highlights for the chat message */highlight: SearchHighlight;- /** The role of the chat message */- role: string;+ /** The role of the chat message+This is only present if the search match was on the chat message content */+ role?: ChatMessageSearchResultRole;/** The score of the result */score?: ChatMessageSearchResultScore;- /** The title of the chat */- title: string;- /** When the search chat was last updated */- updated_at: number;}diff --git a/js/app/packages/service-search/generated/models/chatMessageSearchResultChatMessageId.ts b/js/app/packages/service-search/generated/models/chatMessageSearchResultChatMessageId.tsnew file mode 100644index 0000000000..6708a7ad73--- /dev/null+++ b/js/app/packages/service-search/generated/models/chatMessageSearchResultChatMessageId.ts@@ -0,0 +1,12 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * search_service+ * OpenAPI spec version: 0.1.0+ */++/**+ * The chat message id for the chat+This is only present if the search match was on the chat message content+ */+export type ChatMessageSearchResultChatMessageId = string | null;diff --git a/js/app/packages/service-search/generated/models/chatMessageSearchResultRole.ts b/js/app/packages/service-search/generated/models/chatMessageSearchResultRole.tsnew file mode 100644index 0000000000..42dbcb9307--- /dev/null+++ b/js/app/packages/service-search/generated/models/chatMessageSearchResultRole.ts@@ -0,0 +1,12 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * search_service+ * OpenAPI spec version: 0.1.0+ */++/**+ * The role of the chat message+This is only present if the search match was on the chat message content+ */+export type ChatMessageSearchResultRole = string | null;diff --git a/js/app/packages/service-search/generated/models/documentSearchResponseItem.ts b/js/app/packages/service-search/generated/models/documentSearchResponseItem.tsindex 8e6f7c9b09..f83ab8b18f 100644--- a/js/app/packages/service-search/generated/models/documentSearchResponseItem.ts+++ b/js/app/packages/service-search/generated/models/documentSearchResponseItem.ts@@ -5,6 +5,7 @@* OpenAPI spec version: 0.1.0*/import type { DocumentSearchResult } from './documentSearchResult';+import type { DocumentSearchResponseItemFileType } from './documentSearchResponseItemFileType';/*** A single response item, part of the DocumentSearchResponse object@@ -18,7 +19,7 @@ export interface DocumentSearchResponseItem {This may be empty if the search result match was on the document name only */document_search_results: DocumentSearchResult[];/** The file type of the document */- file_type: string;+ file_type?: DocumentSearchResponseItemFileType;/** Standardized fields that all item types will share.These field names are being aligned across all item typesfor consistency in our data model. */diff --git a/js/app/packages/service-search/generated/models/emailSearchResultSubject.ts b/js/app/packages/service-search/generated/models/documentSearchResponseItemFileType.tssimilarity index 52%rename from js/app/packages/service-search/generated/models/emailSearchResultSubject.tsrename to js/app/packages/service-search/generated/models/documentSearchResponseItemFileType.tsindex e30a0ed073..31529b0b33 100644--- a/js/app/packages/service-search/generated/models/emailSearchResultSubject.ts+++ b/js/app/packages/service-search/generated/models/documentSearchResponseItemFileType.ts@@ -5,4 +5,7 @@* OpenAPI spec version: 0.1.0*/-export type EmailSearchResultSubject = string | null;+/**+ * The file type of the document+ */+export type DocumentSearchResponseItemFileType = string | null;diff --git a/js/app/packages/service-search/generated/models/documentSearchResult.ts b/js/app/packages/service-search/generated/models/documentSearchResult.tsindex d7df821979..4ef24efc4f 100644--- a/js/app/packages/service-search/generated/models/documentSearchResult.ts+++ b/js/app/packages/service-search/generated/models/documentSearchResult.ts@@ -5,6 +5,7 @@* OpenAPI spec version: 0.1.0*/import type { SearchHighlight } from './searchHighlight';+import type { DocumentSearchResultNodeId } from './documentSearchResultNodeId';import type { DocumentSearchResultRawContent } from './documentSearchResultRawContent';import type { DocumentSearchResultScore } from './documentSearchResultScore';@@ -15,13 +16,12 @@ export interface DocumentSearchResult {/** The highlights for the document */highlight: SearchHighlight;/** The node id for the document.-This is only useful for markdown at the moment */- node_id: string;+This is only useful for markdown at the moment+This will only be provided if the match was on content */+ node_id?: DocumentSearchResultNodeId;/** The raw content of the document.This is only included for markdown files and will be the raw json node of the match */raw_content?: DocumentSearchResultRawContent;/** The score of the result */score?: DocumentSearchResultScore;- /** When the search document was last updated */- updated_at: number;}diff --git a/js/app/packages/service-search/generated/models/documentSearchResultNodeId.ts b/js/app/packages/service-search/generated/models/documentSearchResultNodeId.tsnew file mode 100644index 0000000000..41ebb41c5f--- /dev/null+++ b/js/app/packages/service-search/generated/models/documentSearchResultNodeId.ts@@ -0,0 +1,13 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * search_service+ * OpenAPI spec version: 0.1.0+ */++/**+ * The node id for the document.+This is only useful for markdown at the moment+This will only be provided if the match was on content+ */+export type DocumentSearchResultNodeId = string | null;diff --git a/js/app/packages/service-search/generated/models/emailSearchResponseItem.ts b/js/app/packages/service-search/generated/models/emailSearchResponseItem.tsindex 83e4d4a154..d7901cacc9 100644--- a/js/app/packages/service-search/generated/models/emailSearchResponseItem.ts+++ b/js/app/packages/service-search/generated/models/emailSearchResponseItem.ts@@ -6,6 +6,7 @@*/import type { EmailSearchResult } from './emailSearchResult';import type { EmailSearchResponseItemName } from './emailSearchResponseItemName';+import type { EmailSearchResponseItemSubject } from './emailSearchResponseItemSubject';/*** A single response item, part of the EmailSearchResponse object@@ -18,9 +19,12 @@ This may be empty if the search result match was on the email subject only */These field names are being aligned across all item typesfor consistency in our data model. */id: string;- /** email threads don't have names, but keeping this here for consistency with other search items */+ /** Subject of the email thread */name?: EmailSearchResponseItemName;owner_id: string;+ /** The subject of the email+This is only present if the search result is on the message content */+ subject?: EmailSearchResponseItemSubject;/** The id of the email thread */thread_id: string;/** The id of the owner of the email thread */diff --git a/js/app/packages/service-search/generated/models/emailSearchResponseItemName.ts b/js/app/packages/service-search/generated/models/emailSearchResponseItemName.tsindex aa4d1d61cb..eaa0c9ea4a 100644--- a/js/app/packages/service-search/generated/models/emailSearchResponseItemName.ts+++ b/js/app/packages/service-search/generated/models/emailSearchResponseItemName.ts@@ -6,6 +6,6 @@*//**- * email threads don't have names, but keeping this here for consistency with other search items+ * Subject of the email thread*/export type EmailSearchResponseItemName = string | null;diff --git a/js/app/packages/service-search/generated/models/emailSearchResponseItemSubject.ts b/js/app/packages/service-search/generated/models/emailSearchResponseItemSubject.tsnew file mode 100644index 0000000000..7ad4ed4bd7--- /dev/null+++ b/js/app/packages/service-search/generated/models/emailSearchResponseItemSubject.ts@@ -0,0 +1,12 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * search_service+ * OpenAPI spec version: 0.1.0+ */++/**+ * The subject of the email+This is only present if the search result is on the message content+ */+export type EmailSearchResponseItemSubject = string | null;diff --git a/js/app/packages/service-search/generated/models/emailSearchResult.ts b/js/app/packages/service-search/generated/models/emailSearchResult.tsindex 2577bba7ec..073dfc96fa 100644--- a/js/app/packages/service-search/generated/models/emailSearchResult.ts+++ b/js/app/packages/service-search/generated/models/emailSearchResult.ts@@ -5,28 +5,34 @@* OpenAPI spec version: 0.1.0*/import type { SearchHighlight } from './searchHighlight';+import type { EmailSearchResultMessageId } from './emailSearchResultMessageId';import type { EmailSearchResultScore } from './emailSearchResultScore';+import type { EmailSearchResultSender } from './emailSearchResultSender';import type { EmailSearchResultSentAt } from './emailSearchResultSentAt';-import type { EmailSearchResultSubject } from './emailSearchResultSubject';/*** A email message match for a given thread id*/export interface EmailSearchResult {+ /** This is only present if the search result is on the message content */bcc: string[];+ /** This is only present if the search result is on the message content */cc: string[];/** The highlights for the email message */highlight: SearchHighlight;+ /** This is only present if the search result is on the message content */labels: string[];- /** The email message id. */- message_id: string;+ /** The email message id.+This is only present if the search result is on the message content */+ message_id?: EmailSearchResultMessageId;+ /** This is only present if the search result is on the message content */recipients: string[];/** The score of the result */score?: EmailSearchResultScore;- sender: string;- /** When the email message was sent */+ /** The sender+This is only present if the search result is on the message content */+ sender?: EmailSearchResultSender;+ /** When the email message was sent+This is only present if the search result is on the message content */sent_at?: EmailSearchResultSentAt;- subject?: EmailSearchResultSubject;- /** When the search email message was last updated */- updated_at: number;}diff --git a/js/app/packages/service-search/generated/models/emailSearchResultMessageId.ts b/js/app/packages/service-search/generated/models/emailSearchResultMessageId.tsnew file mode 100644index 0000000000..7e87d4f92c--- /dev/null+++ b/js/app/packages/service-search/generated/models/emailSearchResultMessageId.ts@@ -0,0 +1,12 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * search_service+ * OpenAPI spec version: 0.1.0+ */++/**+ * The email message id.+This is only present if the search result is on the message content+ */+export type EmailSearchResultMessageId = string | null;diff --git a/js/app/packages/service-search/generated/models/emailSearchResultSender.ts b/js/app/packages/service-search/generated/models/emailSearchResultSender.tsnew file mode 100644index 0000000000..fc23160c9e--- /dev/null+++ b/js/app/packages/service-search/generated/models/emailSearchResultSender.ts@@ -0,0 +1,12 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * search_service+ * OpenAPI spec version: 0.1.0+ */++/**+ * The sender+This is only present if the search result is on the message content+ */+export type EmailSearchResultSender = string | null;diff --git a/js/app/packages/service-search/generated/models/emailSearchResultSentAt.ts b/js/app/packages/service-search/generated/models/emailSearchResultSentAt.tsindex f5860529dc..d257ebd79d 100644--- a/js/app/packages/service-search/generated/models/emailSearchResultSentAt.ts+++ b/js/app/packages/service-search/generated/models/emailSearchResultSentAt.ts@@ -7,5 +7,6 @@/*** When the email message was sent+This is only present if the search result is on the message content*/export type EmailSearchResultSentAt = number | null;diff --git a/js/app/packages/service-search/generated/models/index.ts b/js/app/packages/service-search/generated/models/index.tsindex 78077ed74d..140fd0b4c5 100644--- a/js/app/packages/service-search/generated/models/index.ts+++ b/js/app/packages/service-search/generated/models/index.ts@@ -24,10 +24,16 @@ export * from './channelSearchResponseItemWithMetadata';export * from './channelSearchResponseItemWithMetadataAllOf';export * from './channelSearchResponseItemWithMetadataAllOfMetadata';export * from './channelSearchResult';+export * from './channelSearchResultCreatedAt';+export * from './channelSearchResultMessageId';export * from './channelSearchResultScore';+export * from './channelSearchResultSenderId';export * from './channelSearchResultThreadId';+export * from './channelSearchResultUpdatedAt';export * from './chatFilters';export * from './chatMessageSearchResult';+export * from './chatMessageSearchResultChatMessageId';+export * from './chatMessageSearchResultRole';export * from './chatMessageSearchResultScore';export * from './chatMetadata';export * from './chatMetadataDeletedAt';@@ -59,10 +65,12 @@ export * from './documentSearchRequestAllOfTwoQuery';export * from './documentSearchRequestAllOfTwoTerms';export * from './documentSearchResponse';export * from './documentSearchResponseItem';+export * from './documentSearchResponseItemFileType';export * from './documentSearchResponseItemWithMetadata';export * from './documentSearchResponseItemWithMetadataAllOf';export * from './documentSearchResponseItemWithMetadataAllOfMetadata';export * from './documentSearchResult';+export * from './documentSearchResultNodeId';export * from './documentSearchResultRawContent';export * from './documentSearchResultScore';export * from './emailFilters';@@ -76,14 +84,16 @@ export * from './emailSearchRequestAllOfTwoTerms';export * from './emailSearchResponse';export * from './emailSearchResponseItem';export * from './emailSearchResponseItemName';+export * from './emailSearchResponseItemSubject';export * from './emailSearchResponseItemWithMetadata';export * from './emailSearchResponseItemWithMetadataAllOf';export * from './emailSearchResponseItemWithMetadataAllOfSnippet';export * from './emailSearchResponseItemWithMetadataAllOfViewedAt';export * from './emailSearchResult';+export * from './emailSearchResultMessageId';export * from './emailSearchResultScore';+export * from './emailSearchResultSender';export * from './emailSearchResultSentAt';-export * from './emailSearchResultSubject';export * from './emptyResponse';export * from './errorResponse';export * from './fileType';diff --git a/js/app/packages/service-search/openapi.json b/js/app/packages/service-search/openapi.jsonindex 4b9a053e01..fd073242e0 100644--- a/js/app/packages/service-search/openapi.json+++ b/js/app/packages/service-search/openapi.json@@ -982,41 +982,38 @@"ChannelSearchResult": {"type": "object","description": "A channel message match for a given channel id",- "required": [- "message_id",- "sender_id",- "highlight",- "created_at",- "updated_at"- ],+ "required": ["highlight"],"properties": {"created_at": {- "type": "integer",+ "type": ["integer", "null"],"format": "int64",- "description": "When the channel message was created"+ "description": "When the channel message was created\nThis is only prsent if the search result is on the message content"},"highlight": {"$ref": "#/components/schemas/SearchHighlight","description": "The highlights for the channel message"},"message_id": {- "type": "string",- "description": "The channel message id"+ "type": ["string", "null"],+ "description": "The channel message id\nThis is only prsent if the search result is on the message content"},"score": {"type": ["number", "null"],"format": "double","description": "The score of the result"},- "sender_id": { "type": "string", "description": "The sender id" },+ "sender_id": {+ "type": ["string", "null"],+ "description": "The sender id\nThis is only prsent if the search result is on the message content"+ },"thread_id": {"type": ["string", "null"],"description": "The channel message thread id"},"updated_at": {- "type": "integer",+ "type": ["integer", "null"],"format": "int64",- "description": "When the channel message was last updated"+ "description": "When the channel message was last updated\nThis is only prsent if the search result is on the message content"}}},@@ -1049,36 +1046,24 @@"ChatMessageSearchResult": {"type": "object","description": "A chat match for a given message id",- "required": [- "chat_message_id",- "role",- "highlight",- "updated_at",- "title"- ],+ "required": ["highlight"],"properties": {"chat_message_id": {- "type": "string",- "description": "The chat message id for the chat"+ "type": ["string", "null"],+ "description": "The chat message id for the chat\nThis is only present if the search match was on the chat message content"},"highlight": {"$ref": "#/components/schemas/SearchHighlight","description": "The highlights for the chat message"},"role": {- "type": "string",- "description": "The role of the chat message"+ "type": ["string", "null"],+ "description": "The role of the chat message\nThis is only present if the search match was on the chat message content"},"score": {"type": ["number", "null"],"format": "double","description": "The score of the result"- },- "title": { "type": "string", "description": "The title of the chat" },- "updated_at": {- "type": "integer",- "format": "int64",- "description": "When the search chat was last updated"}}},@@ -1307,7 +1292,6 @@"owner_id","document_id","document_name",- "file_type","document_search_results"],"properties": {@@ -1325,7 +1309,7 @@"description": "The search results for the document\nThis may be empty if the search result match was on the document name only"},"file_type": {- "type": "string",+ "type": ["string", "null"],"description": "The file type of the document"},"id": {@@ -1359,15 +1343,15 @@"DocumentSearchResult": {"type": "object","description": "A document match for a given node",- "required": ["node_id", "highlight", "updated_at"],+ "required": ["highlight"],"properties": {"highlight": {"$ref": "#/components/schemas/SearchHighlight","description": "The highlights for the document"},"node_id": {- "type": "string",- "description": "The node id for the document.\nThis is only useful for markdown at the moment"+ "type": ["string", "null"],+ "description": "The node id for the document.\nThis is only useful for markdown at the moment\nThis will only be provided if the match was on content"},"raw_content": {"type": ["string", "null"],@@ -1377,11 +1361,6 @@"type": ["number", "null"],"format": "double","description": "The score of the result"- },- "updated_at": {- "type": "integer",- "format": "int64",- "description": "When the search document was last updated"}}},@@ -1491,9 +1470,13 @@},"name": {"type": ["string", "null"],- "description": "email threads don't have names, but keeping this here for consistency with other search items"+ "description": "Subject of the email thread"},"owner_id": { "type": "string" },+ "subject": {+ "type": ["string", "null"],+ "description": "The subject of the email\nThis is only present if the search result is on the message content"+ },"thread_id": {"type": "string","description": "The id of the email thread"@@ -1523,45 +1506,49 @@"EmailSearchResult": {"type": "object","description": "A email message match for a given thread id",- "required": [- "message_id",- "sender",- "recipients",- "cc",- "bcc",- "labels",- "highlight",- "updated_at"- ],+ "required": ["recipients", "cc", "bcc", "labels", "highlight"],"properties": {- "bcc": { "type": "array", "items": { "type": "string" } },- "cc": { "type": "array", "items": { "type": "string" } },+ "bcc": {+ "type": "array",+ "items": { "type": "string" },+ "description": "This is only present if the search result is on the message content"+ },+ "cc": {+ "type": "array",+ "items": { "type": "string" },+ "description": "This is only present if the search result is on the message content"+ },"highlight": {"$ref": "#/components/schemas/SearchHighlight","description": "The highlights for the email message"},- "labels": { "type": "array", "items": { "type": "string" } },+ "labels": {+ "type": "array",+ "items": { "type": "string" },+ "description": "This is only present if the search result is on the message content"+ },"message_id": {- "type": "string",- "description": "The email message id."+ "type": ["string", "null"],+ "description": "The email message id.\nThis is only present if the search result is on the message content"+ },+ "recipients": {+ "type": "array",+ "items": { "type": "string" },+ "description": "This is only present if the search result is on the message content"},- "recipients": { "type": "array", "items": { "type": "string" } },"score": {"type": ["number", "null"],"format": "double","description": "The score of the result"},- "sender": { "type": "string" },+ "sender": {+ "type": ["string", "null"],+ "description": "The sender\nThis is only present if the search result is on the message content"+ },"sent_at": {"type": ["integer", "null"],"format": "int64",- "description": "When the email message was sent"- },- "subject": { "type": ["string", "null"] },- "updated_at": {- "type": "integer",- "format": "int64",- "description": "When the search email message was last updated"+ "description": "When the email message was sent\nThis is only present if the search result is on the message content"}}},