evo360-types 1.3.807 → 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.
@@ -16,6 +16,10 @@ export declare const zActionArgsSchema: z.ZodObject<{
16
16
  * Schema for RbacPermValue (tri-state permission value)
17
17
  */
18
18
  export declare const zRbacPermValueSchema: z.ZodEnum<["allow", "deny", "forbid"]>;
19
+ /**
20
+ * Schema for PermOverrideValue (per-user override, feat-345)
21
+ */
22
+ export declare const zPermOverrideValueSchema: z.ZodEnum<["allow", "forbid"]>;
19
23
  /**
20
24
  * Schema for TenantUserStatus
21
25
  */
@@ -41,6 +45,7 @@ export declare const zTenantUserSchema: z.ZodObject<{
41
45
  status: z.ZodEnum<["active", "invited", "disabled", "removed"]>;
42
46
  roles: z.ZodArray<z.ZodString, "many">;
43
47
  perms: z.ZodRecord<z.ZodString, z.ZodBoolean>;
48
+ perm_overrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEnum<["allow", "forbid"]>>>;
44
49
  picture_url: z.ZodOptional<z.ZodString>;
45
50
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
46
51
  id: z.ZodString;
@@ -55,6 +60,7 @@ export declare const zTenantUserSchema: z.ZodObject<{
55
60
  status: z.ZodEnum<["active", "invited", "disabled", "removed"]>;
56
61
  roles: z.ZodArray<z.ZodString, "many">;
57
62
  perms: z.ZodRecord<z.ZodString, z.ZodBoolean>;
63
+ perm_overrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEnum<["allow", "forbid"]>>>;
58
64
  picture_url: z.ZodOptional<z.ZodString>;
59
65
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
60
66
  id: z.ZodString;
@@ -69,6 +75,7 @@ export declare const zTenantUserSchema: z.ZodObject<{
69
75
  status: z.ZodEnum<["active", "invited", "disabled", "removed"]>;
70
76
  roles: z.ZodArray<z.ZodString, "many">;
71
77
  perms: z.ZodRecord<z.ZodString, z.ZodBoolean>;
78
+ perm_overrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEnum<["allow", "forbid"]>>>;
72
79
  picture_url: z.ZodOptional<z.ZodString>;
73
80
  }, z.ZodTypeAny, "passthrough">>;
74
81
  /**
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.zNexusClaimsSchema = exports.zNexusModulesSchema = exports.zNexusModuleToolsPermissionsSchema = exports.zNexusModuleFinancePermissionsSchema = exports.zNexusModuleChatPermissionsSchema = exports.zRbacGroupSchema = exports.zRbacPermissionMetadataSchema = exports.zRbacRoleSchema = exports.zRbacRolePermsSchema = exports.zUserTenantIndexSchema = exports.zTenantUserSchema = exports.zUserTenantIndexStatusSchema = exports.zTenantUserStatusSchema = exports.zRbacPermValueSchema = exports.zActionArgsSchema = void 0;
3
+ exports.zNexusClaimsSchema = exports.zNexusModulesSchema = exports.zNexusModuleToolsPermissionsSchema = exports.zNexusModuleFinancePermissionsSchema = exports.zNexusModuleChatPermissionsSchema = exports.zRbacGroupSchema = exports.zRbacPermissionMetadataSchema = exports.zRbacRoleSchema = exports.zRbacRolePermsSchema = exports.zUserTenantIndexSchema = exports.zTenantUserSchema = exports.zUserTenantIndexStatusSchema = exports.zTenantUserStatusSchema = exports.zPermOverrideValueSchema = exports.zRbacPermValueSchema = exports.zActionArgsSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const zod_schemas_1 = require("../shared/zod-schemas");
6
6
  const zod_schemas_2 = require("../evo-tenant/zod-schemas");
@@ -14,6 +14,10 @@ exports.zActionArgsSchema = zod_1.z.object({
14
14
  * Schema for RbacPermValue (tri-state permission value)
15
15
  */
16
16
  exports.zRbacPermValueSchema = zod_1.z.enum(["allow", "deny", "forbid"]);
17
+ /**
18
+ * Schema for PermOverrideValue (per-user override, feat-345)
19
+ */
20
+ exports.zPermOverrideValueSchema = zod_1.z.enum(["allow", "forbid"]);
17
21
  /**
18
22
  * Schema for TenantUserStatus
19
23
  */
@@ -41,6 +45,7 @@ exports.zTenantUserSchema = zod_schemas_1.zFireDocSchema
41
45
  status: exports.zTenantUserStatusSchema,
42
46
  roles: zod_1.z.array(zod_1.z.string()),
43
47
  perms: zod_1.z.record(zod_1.z.boolean()),
48
+ perm_overrides: zod_1.z.record(exports.zPermOverrideValueSchema).optional(),
44
49
  picture_url: zod_1.z.string().optional(),
45
50
  })
46
51
  .passthrough();
@@ -15,6 +15,11 @@ export const zActionArgsSchema = z.object({
15
15
  */
16
16
  export const zRbacPermValueSchema = z.enum(["allow", "deny", "forbid"]);
17
17
 
18
+ /**
19
+ * Schema for PermOverrideValue (per-user override, feat-345)
20
+ */
21
+ export const zPermOverrideValueSchema = z.enum(["allow", "forbid"]);
22
+
18
23
  /**
19
24
  * Schema for TenantUserStatus
20
25
  */
@@ -44,6 +49,7 @@ export const zTenantUserSchema = zFireDocSchema
44
49
  status: zTenantUserStatusSchema,
45
50
  roles: z.array(z.string()),
46
51
  perms: z.record(z.boolean()),
52
+ perm_overrides: z.record(zPermOverrideValueSchema).optional(),
47
53
  picture_url: z.string().optional(),
48
54
  })
49
55
  .passthrough();
@@ -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';
@@ -21,6 +21,19 @@ export declare const RbacPermValueEnum: {
21
21
  readonly Forbid: "forbid";
22
22
  };
23
23
  export type RbacPermValue = (typeof RbacPermValueEnum)[keyof typeof RbacPermValueEnum];
24
+ /**
25
+ * Per-user permission override value (feat-345).
26
+ * Applied by the materializer AFTER the roles:
27
+ * - 'allow': the permission is granted even if no role grants it
28
+ * - 'forbid': the permission is removed even if a role grants it
29
+ * Absent key = inherit from roles (there is no 'deny' here).
30
+ */
31
+ export declare const PermOverrideValueEnum: {
32
+ readonly Allow: "allow";
33
+ readonly Forbid: "forbid";
34
+ };
35
+ export type PermOverrideValue = Extract<RbacPermValue, (typeof PermOverrideValueEnum)[keyof typeof PermOverrideValueEnum]>;
36
+ export declare const PERM_OVERRIDE_VALUES: readonly PermOverrideValue[];
24
37
  /**
25
38
  * Membership status for a user in a tenant.
26
39
  */
@@ -71,6 +84,16 @@ export interface ITenantUser extends IFireDoc {
71
84
  perms: {
72
85
  [permissionKey: string]: boolean;
73
86
  };
87
+ /**
88
+ * Per-user permission overrides (feat-345). INPUT field, next to `roles`:
89
+ * the materializer applies them on top of the roles and writes the result
90
+ * into `perms`, so they survive every recompute. Only the
91
+ * `core_tenant_users-setPermOverrides` callable writes this field.
92
+ * Absent = `{}`.
93
+ */
94
+ perm_overrides?: {
95
+ [permissionKey: string]: PermOverrideValue;
96
+ };
74
97
  /**
75
98
  * User picture URL.
76
99
  */
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.UserTenantIndexStatusEnum = exports.TenantUserStatusEnum = exports.RbacPermValueEnum = exports.CoreRbacPermissions = void 0;
17
+ exports.UserTenantIndexStatusEnum = exports.TenantUserStatusEnum = exports.PERM_OVERRIDE_VALUES = exports.PermOverrideValueEnum = exports.RbacPermValueEnum = exports.CoreRbacPermissions = void 0;
18
18
  __exportStar(require("./fb_collections"), exports);
19
19
  // Permissões para o core rbac
20
20
  exports.CoreRbacPermissions = {
@@ -36,6 +36,21 @@ exports.RbacPermValueEnum = {
36
36
  Deny: "deny",
37
37
  Forbid: "forbid",
38
38
  };
39
+ /**
40
+ * Per-user permission override value (feat-345).
41
+ * Applied by the materializer AFTER the roles:
42
+ * - 'allow': the permission is granted even if no role grants it
43
+ * - 'forbid': the permission is removed even if a role grants it
44
+ * Absent key = inherit from roles (there is no 'deny' here).
45
+ */
46
+ exports.PermOverrideValueEnum = {
47
+ Allow: "allow",
48
+ Forbid: "forbid",
49
+ };
50
+ exports.PERM_OVERRIDE_VALUES = [
51
+ exports.PermOverrideValueEnum.Allow,
52
+ exports.PermOverrideValueEnum.Forbid,
53
+ ];
39
54
  /**
40
55
  * Membership status for a user in a tenant.
41
56
  */
@@ -30,6 +30,26 @@ export const RbacPermValueEnum = {
30
30
  export type RbacPermValue =
31
31
  (typeof RbacPermValueEnum)[keyof typeof RbacPermValueEnum];
32
32
 
33
+ /**
34
+ * Per-user permission override value (feat-345).
35
+ * Applied by the materializer AFTER the roles:
36
+ * - 'allow': the permission is granted even if no role grants it
37
+ * - 'forbid': the permission is removed even if a role grants it
38
+ * Absent key = inherit from roles (there is no 'deny' here).
39
+ */
40
+ export const PermOverrideValueEnum = {
41
+ Allow: "allow",
42
+ Forbid: "forbid",
43
+ } as const;
44
+ export type PermOverrideValue = Extract<
45
+ RbacPermValue,
46
+ (typeof PermOverrideValueEnum)[keyof typeof PermOverrideValueEnum]
47
+ >;
48
+ export const PERM_OVERRIDE_VALUES: readonly PermOverrideValue[] = [
49
+ PermOverrideValueEnum.Allow,
50
+ PermOverrideValueEnum.Forbid,
51
+ ] as const;
52
+
33
53
  /**
34
54
  * Membership status for a user in a tenant.
35
55
  */
@@ -91,6 +111,17 @@ export interface ITenantUser extends IFireDoc {
91
111
  [permissionKey: string]: boolean;
92
112
  };
93
113
 
114
+ /**
115
+ * Per-user permission overrides (feat-345). INPUT field, next to `roles`:
116
+ * the materializer applies them on top of the roles and writes the result
117
+ * into `perms`, so they survive every recompute. Only the
118
+ * `core_tenant_users-setPermOverrides` callable writes this field.
119
+ * Absent = `{}`.
120
+ */
121
+ perm_overrides?: {
122
+ [permissionKey: string]: PermOverrideValue;
123
+ };
124
+
94
125
  /**
95
126
  * User picture URL.
96
127
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "evo360-types",
3
- "version": "1.3.807",
3
+ "version": "1.3.811",
4
4
  "description": "HREVO360 Shared Types",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",