evo360-types 1.3.809 → 1.3.811

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,11 +11,49 @@ export interface SearchThreadsParams {
11
11
  closed_by_user_id?: string;
12
12
  close_codes?: string[];
13
13
  tag_ids?: string[];
14
- /** Free-text contains-match against contact_name (case-insensitive) OR contact_address (digits/email/etc). */
14
+ /**
15
+ * Free-text contains-match. Com `search_scope` ausente ou 'contact': contact_name
16
+ * (case-insensitive) OR contact_address (digits/email/etc). Com 'message': o texto
17
+ * das mensagens da conversa (ver `SearchScope`).
18
+ */
15
19
  search?: string;
20
+ /** feat-350 — onde o `search` procura. Ausente = 'contact' (comportamento anterior). */
21
+ search_scope?: SearchScope;
16
22
  cursor?: string;
17
23
  limit?: number;
18
24
  }
25
+ /**
26
+ * feat-350 — escopo do campo de busca.
27
+ *
28
+ * - 'contact': nome e endereço do contato (padrão).
29
+ * - 'message' (BETA): texto das mensagens do tenant na janela — texto, nota interna,
30
+ * legenda de mídia e transcrição de áudio. Template HSM fica fora (o mesmo texto vai
31
+ * para centenas de pacientes). Exige `MESSAGE_SEARCH_MIN_CHARS` caracteres.
32
+ */
33
+ export type SearchScope = 'contact' | 'message';
34
+ /** feat-350 — mínimo de caracteres (depois de aparar) para buscar no texto das mensagens. */
35
+ export declare const MESSAGE_SEARCH_MIN_CHARS = 3;
36
+ /** feat-350 — de onde veio o texto que casou. */
37
+ export type MatchedMessageSource = 'text' | 'note' | 'caption' | 'transcript';
38
+ /**
39
+ * feat-350 — a mensagem MAIS RECENTE da conversa que casou com a busca no modo
40
+ * 'message', já recortada em volta do termo para caber na linha da lista.
41
+ */
42
+ export interface ThreadMatchedMessage {
43
+ firestore_message_id: string;
44
+ /** ISO. */
45
+ occurred_at: string;
46
+ direction: 'in' | 'out' | 'internal';
47
+ source: MatchedMessageSource;
48
+ /** ~140 caracteres em volta do termo, com "…" onde o texto foi cortado. */
49
+ snippet: string;
50
+ /** Posição do termo dentro de `snippet` (para destacar). */
51
+ match_start: number;
52
+ /** Comprimento do termo dentro de `snippet`; 0 = não localizado no recorte. */
53
+ match_length: number;
54
+ /** Mensagens da conversa que casaram, na janela. */
55
+ match_count: number;
56
+ }
19
57
  /**
20
58
  * Janela de datas efetivamente usada na consulta.
21
59
  *
@@ -78,6 +116,8 @@ export interface ThreadAggregate {
78
116
  contact?: ThreadAggregateContact;
79
117
  tags?: ThreadAggregateTag[];
80
118
  current_open_ticket?: ThreadAggregateCurrentOpenTicket | null;
119
+ /** feat-350 — só no modo `search_scope: 'message'`. */
120
+ matched_message?: ThreadMatchedMessage | null;
81
121
  }
82
122
  export interface SearchThreadsStats {
83
123
  bq_query_id?: string;
@@ -141,7 +181,9 @@ export interface SearchFacetsResponse {
141
181
  applied_window: AppliedWindow;
142
182
  stats: SearchFacetsStats;
143
183
  }
144
- export type SearchThreadsErrorCode = 'invalid_filter' | 'tag_filter_too_broad' | 'forbidden' | 'bq_error' | 'fs_error';
184
+ export type SearchThreadsErrorCode = 'invalid_filter' | 'tag_filter_too_broad'
185
+ /** feat-350 — modo 'message' com menos de MESSAGE_SEARCH_MIN_CHARS caracteres. */
186
+ | 'search_too_short' | 'forbidden' | 'bq_error' | 'fs_error';
145
187
  export interface SearchThreadsErrorResponse {
146
188
  ok: false;
147
189
  error: string;
@@ -4,3 +4,6 @@
4
4
  // for top-N. Timeline endpoint UNION-ALLs events + messages_raw +
5
5
  // message_statuses + message_reactions for a single contact (archive use case).
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.MESSAGE_SEARCH_MIN_CHARS = void 0;
8
+ /** feat-350 — mínimo de caracteres (depois de aparar) para buscar no texto das mensagens. */
9
+ exports.MESSAGE_SEARCH_MIN_CHARS = 3;
@@ -18,12 +18,54 @@ export interface SearchThreadsParams {
18
18
  closed_by_user_id?: string;
19
19
  close_codes?: string[];
20
20
  tag_ids?: string[];
21
- /** Free-text contains-match against contact_name (case-insensitive) OR contact_address (digits/email/etc). */
21
+ /**
22
+ * Free-text contains-match. Com `search_scope` ausente ou 'contact': contact_name
23
+ * (case-insensitive) OR contact_address (digits/email/etc). Com 'message': o texto
24
+ * das mensagens da conversa (ver `SearchScope`).
25
+ */
22
26
  search?: string;
27
+ /** feat-350 — onde o `search` procura. Ausente = 'contact' (comportamento anterior). */
28
+ search_scope?: SearchScope;
23
29
  cursor?: string;
24
30
  limit?: number;
25
31
  }
26
32
 
33
+ /**
34
+ * feat-350 — escopo do campo de busca.
35
+ *
36
+ * - 'contact': nome e endereço do contato (padrão).
37
+ * - 'message' (BETA): texto das mensagens do tenant na janela — texto, nota interna,
38
+ * legenda de mídia e transcrição de áudio. Template HSM fica fora (o mesmo texto vai
39
+ * para centenas de pacientes). Exige `MESSAGE_SEARCH_MIN_CHARS` caracteres.
40
+ */
41
+ export type SearchScope = 'contact' | 'message';
42
+
43
+ /** feat-350 — mínimo de caracteres (depois de aparar) para buscar no texto das mensagens. */
44
+ export const MESSAGE_SEARCH_MIN_CHARS = 3;
45
+
46
+ /** feat-350 — de onde veio o texto que casou. */
47
+ export type MatchedMessageSource = 'text' | 'note' | 'caption' | 'transcript';
48
+
49
+ /**
50
+ * feat-350 — a mensagem MAIS RECENTE da conversa que casou com a busca no modo
51
+ * 'message', já recortada em volta do termo para caber na linha da lista.
52
+ */
53
+ export interface ThreadMatchedMessage {
54
+ firestore_message_id: string;
55
+ /** ISO. */
56
+ occurred_at: string;
57
+ direction: 'in' | 'out' | 'internal';
58
+ source: MatchedMessageSource;
59
+ /** ~140 caracteres em volta do termo, com "…" onde o texto foi cortado. */
60
+ snippet: string;
61
+ /** Posição do termo dentro de `snippet` (para destacar). */
62
+ match_start: number;
63
+ /** Comprimento do termo dentro de `snippet`; 0 = não localizado no recorte. */
64
+ match_length: number;
65
+ /** Mensagens da conversa que casaram, na janela. */
66
+ match_count: number;
67
+ }
68
+
27
69
  /**
28
70
  * Janela de datas efetivamente usada na consulta.
29
71
  *
@@ -91,6 +133,8 @@ export interface ThreadAggregate {
91
133
  contact?: ThreadAggregateContact;
92
134
  tags?: ThreadAggregateTag[];
93
135
  current_open_ticket?: ThreadAggregateCurrentOpenTicket | null;
136
+ /** feat-350 — só no modo `search_scope: 'message'`. */
137
+ matched_message?: ThreadMatchedMessage | null;
94
138
  }
95
139
 
96
140
  export interface SearchThreadsStats {
@@ -172,6 +216,8 @@ export interface SearchFacetsResponse {
172
216
  export type SearchThreadsErrorCode =
173
217
  | 'invalid_filter'
174
218
  | 'tag_filter_too_broad'
219
+ /** feat-350 — modo 'message' com menos de MESSAGE_SEARCH_MIN_CHARS caracteres. */
220
+ | 'search_too_short'
175
221
  | 'forbidden'
176
222
  | 'bq_error'
177
223
  | 'fs_error';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "evo360-types",
3
- "version": "1.3.809",
3
+ "version": "1.3.811",
4
4
  "description": "HREVO360 Shared Types",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",