evo360-types 1.3.153 → 1.3.154

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.
@@ -35,11 +35,11 @@ export declare const zChatBeeChannelConfigSchema: z.ZodObject<z.objectUtil.exten
35
35
  allow_reply_mode: boolean;
36
36
  transcribe_audio_when_ai_disabled: boolean;
37
37
  suggest_agenda_action: boolean;
38
- task_creation: "suggestion" | "disabled" | "create";
38
+ task_creation: "disabled" | "suggestion" | "create";
39
39
  system_message_prompt: string;
40
40
  }, {
41
41
  default_operation_mode: "reply" | "suggestion";
42
- task_creation: "suggestion" | "disabled" | "create";
42
+ task_creation: "disabled" | "suggestion" | "create";
43
43
  system_message_prompt: string;
44
44
  active?: boolean | undefined;
45
45
  enabled_for_new_contacts?: boolean | undefined;
@@ -89,11 +89,11 @@ export declare const zChatBeeChannelConfigSchema: z.ZodObject<z.objectUtil.exten
89
89
  allow_reply_mode: boolean;
90
90
  transcribe_audio_when_ai_disabled: boolean;
91
91
  suggest_agenda_action: boolean;
92
- task_creation: "suggestion" | "disabled" | "create";
92
+ task_creation: "disabled" | "suggestion" | "create";
93
93
  system_message_prompt: string;
94
94
  }, {
95
95
  default_operation_mode: "reply" | "suggestion";
96
- task_creation: "suggestion" | "disabled" | "create";
96
+ task_creation: "disabled" | "suggestion" | "create";
97
97
  system_message_prompt: string;
98
98
  active?: boolean | undefined;
99
99
  enabled_for_new_contacts?: boolean | undefined;
@@ -143,11 +143,11 @@ export declare const zChatBeeChannelConfigSchema: z.ZodObject<z.objectUtil.exten
143
143
  allow_reply_mode: boolean;
144
144
  transcribe_audio_when_ai_disabled: boolean;
145
145
  suggest_agenda_action: boolean;
146
- task_creation: "suggestion" | "disabled" | "create";
146
+ task_creation: "disabled" | "suggestion" | "create";
147
147
  system_message_prompt: string;
148
148
  }, {
149
149
  default_operation_mode: "reply" | "suggestion";
150
- task_creation: "suggestion" | "disabled" | "create";
150
+ task_creation: "disabled" | "suggestion" | "create";
151
151
  system_message_prompt: string;
152
152
  active?: boolean | undefined;
153
153
  enabled_for_new_contacts?: boolean | undefined;
@@ -12,3 +12,210 @@ export declare const zActionArgsSchema: z.ZodObject<{
12
12
  old_values?: Record<string, any> | undefined;
13
13
  new_values?: Record<string, any> | undefined;
14
14
  }>;
15
+ /**
16
+ * Schema for RbacPermValue (tri-state permission value)
17
+ */
18
+ export declare const zRbacPermValueSchema: z.ZodEnum<["allow", "deny", "forbid"]>;
19
+ /**
20
+ * Schema for TenantUserStatus
21
+ */
22
+ export declare const zTenantUserStatusSchema: z.ZodEnum<["active", "invited", "disabled", "removed"]>;
23
+ /**
24
+ * Schema for UserTenantIndexStatus
25
+ */
26
+ export declare const zUserTenantIndexStatusSchema: z.ZodEnum<["active", "invited", "disabled"]>;
27
+ /**
28
+ * Schema for ITenantUser (membership document)
29
+ * Note: id, tenant, created_at, updated_at come from zFireDocSchema
30
+ */
31
+ export declare const zTenantUserSchema: z.ZodObject<z.objectUtil.extendShape<{
32
+ id: z.ZodString;
33
+ ref: z.ZodAny;
34
+ tenant: z.ZodString;
35
+ model_ver: z.ZodDefault<z.ZodNumber>;
36
+ created_at: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
37
+ updated_at: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
38
+ deleted_at: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
39
+ }, {
40
+ status: z.ZodEnum<["active", "invited", "disabled", "removed"]>;
41
+ roles: z.ZodArray<z.ZodString, "many">;
42
+ perms: z.ZodRecord<z.ZodString, z.ZodBoolean>;
43
+ }>, "passthrough", z.ZodTypeAny, z.objectOutputType<z.objectUtil.extendShape<{
44
+ id: z.ZodString;
45
+ ref: z.ZodAny;
46
+ tenant: z.ZodString;
47
+ model_ver: z.ZodDefault<z.ZodNumber>;
48
+ created_at: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
49
+ updated_at: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
50
+ deleted_at: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
51
+ }, {
52
+ status: z.ZodEnum<["active", "invited", "disabled", "removed"]>;
53
+ roles: z.ZodArray<z.ZodString, "many">;
54
+ perms: z.ZodRecord<z.ZodString, z.ZodBoolean>;
55
+ }>, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<{
56
+ id: z.ZodString;
57
+ ref: z.ZodAny;
58
+ tenant: z.ZodString;
59
+ model_ver: z.ZodDefault<z.ZodNumber>;
60
+ created_at: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
61
+ updated_at: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
62
+ deleted_at: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
63
+ }, {
64
+ status: z.ZodEnum<["active", "invited", "disabled", "removed"]>;
65
+ roles: z.ZodArray<z.ZodString, "many">;
66
+ perms: z.ZodRecord<z.ZodString, z.ZodBoolean>;
67
+ }>, z.ZodTypeAny, "passthrough">>;
68
+ /**
69
+ * Schema for IUserTenantIndex (inverted index)
70
+ * Note: id, tenant, created_at, updated_at come from zFireDocSchema
71
+ */
72
+ export declare const zUserTenantIndexSchema: z.ZodObject<z.objectUtil.extendShape<{
73
+ id: z.ZodString;
74
+ ref: z.ZodAny;
75
+ tenant: z.ZodString;
76
+ model_ver: z.ZodDefault<z.ZodNumber>;
77
+ created_at: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
78
+ updated_at: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
79
+ deleted_at: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
80
+ }, {
81
+ status: z.ZodEnum<["active", "invited", "disabled"]>;
82
+ tenant_name: z.ZodString;
83
+ tenant_deleted_at: z.ZodNullable<z.ZodEffects<z.ZodDate, Date, unknown>>;
84
+ }>, "passthrough", z.ZodTypeAny, z.objectOutputType<z.objectUtil.extendShape<{
85
+ id: z.ZodString;
86
+ ref: z.ZodAny;
87
+ tenant: z.ZodString;
88
+ model_ver: z.ZodDefault<z.ZodNumber>;
89
+ created_at: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
90
+ updated_at: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
91
+ deleted_at: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
92
+ }, {
93
+ status: z.ZodEnum<["active", "invited", "disabled"]>;
94
+ tenant_name: z.ZodString;
95
+ tenant_deleted_at: z.ZodNullable<z.ZodEffects<z.ZodDate, Date, unknown>>;
96
+ }>, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<{
97
+ id: z.ZodString;
98
+ ref: z.ZodAny;
99
+ tenant: z.ZodString;
100
+ model_ver: z.ZodDefault<z.ZodNumber>;
101
+ created_at: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
102
+ updated_at: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
103
+ deleted_at: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
104
+ }, {
105
+ status: z.ZodEnum<["active", "invited", "disabled"]>;
106
+ tenant_name: z.ZodString;
107
+ tenant_deleted_at: z.ZodNullable<z.ZodEffects<z.ZodDate, Date, unknown>>;
108
+ }>, z.ZodTypeAny, "passthrough">>;
109
+ /**
110
+ * Schema for role permission mapping in IRbacGroup
111
+ */
112
+ export declare const zRbacRolePermsSchema: z.ZodRecord<z.ZodString, z.ZodEnum<["allow", "deny", "forbid"]>>;
113
+ /**
114
+ * Schema for role definition in IRbacGroup
115
+ */
116
+ export declare const zRbacRoleSchema: z.ZodObject<{
117
+ name: z.ZodString;
118
+ description: z.ZodOptional<z.ZodString>;
119
+ perms: z.ZodRecord<z.ZodString, z.ZodEnum<["allow", "deny", "forbid"]>>;
120
+ }, "strip", z.ZodTypeAny, {
121
+ name: string;
122
+ perms: Record<string, "allow" | "deny" | "forbid">;
123
+ description?: string | undefined;
124
+ }, {
125
+ name: string;
126
+ perms: Record<string, "allow" | "deny" | "forbid">;
127
+ description?: string | undefined;
128
+ }>;
129
+ /**
130
+ * Schema for permission metadata in IRbacGroup
131
+ */
132
+ export declare const zRbacPermissionMetadataSchema: z.ZodObject<{
133
+ description: z.ZodOptional<z.ZodString>;
134
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
135
+ description: z.ZodOptional<z.ZodString>;
136
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
137
+ description: z.ZodOptional<z.ZodString>;
138
+ }, z.ZodTypeAny, "passthrough">>;
139
+ /**
140
+ * Schema for IRbacGroup (RBAC catalog)
141
+ * Note: IRbacGroup does NOT extend IFireDoc (global document, not tenant-scoped)
142
+ */
143
+ export declare const zRbacGroupSchema: z.ZodObject<{
144
+ id: z.ZodString;
145
+ name: z.ZodString;
146
+ description: z.ZodOptional<z.ZodString>;
147
+ permissions: z.ZodRecord<z.ZodString, z.ZodObject<{
148
+ description: z.ZodOptional<z.ZodString>;
149
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
150
+ description: z.ZodOptional<z.ZodString>;
151
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
152
+ description: z.ZodOptional<z.ZodString>;
153
+ }, z.ZodTypeAny, "passthrough">>>;
154
+ roles: z.ZodRecord<z.ZodString, z.ZodObject<{
155
+ name: z.ZodString;
156
+ description: z.ZodOptional<z.ZodString>;
157
+ perms: z.ZodRecord<z.ZodString, z.ZodEnum<["allow", "deny", "forbid"]>>;
158
+ }, "strip", z.ZodTypeAny, {
159
+ name: string;
160
+ perms: Record<string, "allow" | "deny" | "forbid">;
161
+ description?: string | undefined;
162
+ }, {
163
+ name: string;
164
+ perms: Record<string, "allow" | "deny" | "forbid">;
165
+ description?: string | undefined;
166
+ }>>;
167
+ created_at: z.ZodEffects<z.ZodDate, Date, unknown>;
168
+ updated_at: z.ZodEffects<z.ZodDate, Date, unknown>;
169
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
170
+ id: z.ZodString;
171
+ name: z.ZodString;
172
+ description: z.ZodOptional<z.ZodString>;
173
+ permissions: z.ZodRecord<z.ZodString, z.ZodObject<{
174
+ description: z.ZodOptional<z.ZodString>;
175
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
176
+ description: z.ZodOptional<z.ZodString>;
177
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
178
+ description: z.ZodOptional<z.ZodString>;
179
+ }, z.ZodTypeAny, "passthrough">>>;
180
+ roles: z.ZodRecord<z.ZodString, z.ZodObject<{
181
+ name: z.ZodString;
182
+ description: z.ZodOptional<z.ZodString>;
183
+ perms: z.ZodRecord<z.ZodString, z.ZodEnum<["allow", "deny", "forbid"]>>;
184
+ }, "strip", z.ZodTypeAny, {
185
+ name: string;
186
+ perms: Record<string, "allow" | "deny" | "forbid">;
187
+ description?: string | undefined;
188
+ }, {
189
+ name: string;
190
+ perms: Record<string, "allow" | "deny" | "forbid">;
191
+ description?: string | undefined;
192
+ }>>;
193
+ created_at: z.ZodEffects<z.ZodDate, Date, unknown>;
194
+ updated_at: z.ZodEffects<z.ZodDate, Date, unknown>;
195
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
196
+ id: z.ZodString;
197
+ name: z.ZodString;
198
+ description: z.ZodOptional<z.ZodString>;
199
+ permissions: z.ZodRecord<z.ZodString, z.ZodObject<{
200
+ description: z.ZodOptional<z.ZodString>;
201
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
202
+ description: z.ZodOptional<z.ZodString>;
203
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
204
+ description: z.ZodOptional<z.ZodString>;
205
+ }, z.ZodTypeAny, "passthrough">>>;
206
+ roles: z.ZodRecord<z.ZodString, z.ZodObject<{
207
+ name: z.ZodString;
208
+ description: z.ZodOptional<z.ZodString>;
209
+ perms: z.ZodRecord<z.ZodString, z.ZodEnum<["allow", "deny", "forbid"]>>;
210
+ }, "strip", z.ZodTypeAny, {
211
+ name: string;
212
+ perms: Record<string, "allow" | "deny" | "forbid">;
213
+ description?: string | undefined;
214
+ }, {
215
+ name: string;
216
+ perms: Record<string, "allow" | "deny" | "forbid">;
217
+ description?: string | undefined;
218
+ }>>;
219
+ created_at: z.ZodEffects<z.ZodDate, Date, unknown>;
220
+ updated_at: z.ZodEffects<z.ZodDate, Date, unknown>;
221
+ }, z.ZodTypeAny, "passthrough">>;
@@ -1,9 +1,89 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.zActionArgsSchema = void 0;
3
+ exports.zRbacGroupSchema = exports.zRbacPermissionMetadataSchema = exports.zRbacRoleSchema = exports.zRbacRolePermsSchema = exports.zUserTenantIndexSchema = exports.zTenantUserSchema = exports.zUserTenantIndexStatusSchema = exports.zTenantUserStatusSchema = exports.zRbacPermValueSchema = exports.zActionArgsSchema = void 0;
4
4
  const zod_1 = require("zod");
5
+ const zod_schemas_1 = require("../shared/zod-schemas");
5
6
  exports.zActionArgsSchema = zod_1.z.object({
6
7
  old_values: zod_1.z.record(zod_1.z.any()).optional(),
7
8
  new_values: zod_1.z.record(zod_1.z.any()).optional(),
8
9
  deleted_at: zod_1.z.coerce.date().optional(),
9
10
  });
11
+ // ----- RBAC Zod Schemas
12
+ /**
13
+ * Schema for RbacPermValue (tri-state permission value)
14
+ */
15
+ exports.zRbacPermValueSchema = zod_1.z.enum(["allow", "deny", "forbid"]);
16
+ /**
17
+ * Schema for TenantUserStatus
18
+ */
19
+ exports.zTenantUserStatusSchema = zod_1.z.enum([
20
+ "active",
21
+ "invited",
22
+ "disabled",
23
+ "removed",
24
+ ]);
25
+ /**
26
+ * Schema for UserTenantIndexStatus
27
+ */
28
+ exports.zUserTenantIndexStatusSchema = zod_1.z.enum([
29
+ "active",
30
+ "invited",
31
+ "disabled",
32
+ ]);
33
+ /**
34
+ * Schema for ITenantUser (membership document)
35
+ * Note: id, tenant, created_at, updated_at come from zFireDocSchema
36
+ */
37
+ exports.zTenantUserSchema = zod_schemas_1.zFireDocSchema
38
+ .extend({
39
+ status: exports.zTenantUserStatusSchema,
40
+ roles: zod_1.z.array(zod_1.z.string()),
41
+ perms: zod_1.z.record(zod_1.z.boolean()),
42
+ })
43
+ .passthrough();
44
+ /**
45
+ * Schema for IUserTenantIndex (inverted index)
46
+ * Note: id, tenant, created_at, updated_at come from zFireDocSchema
47
+ */
48
+ exports.zUserTenantIndexSchema = zod_schemas_1.zFireDocSchema
49
+ .extend({
50
+ status: exports.zUserTenantIndexStatusSchema,
51
+ tenant_name: zod_1.z.string(),
52
+ tenant_deleted_at: zod_schemas_1.zFirestoreDateSchema.nullable(),
53
+ })
54
+ .passthrough();
55
+ /**
56
+ * Schema for role permission mapping in IRbacGroup
57
+ */
58
+ exports.zRbacRolePermsSchema = zod_1.z.record(exports.zRbacPermValueSchema);
59
+ /**
60
+ * Schema for role definition in IRbacGroup
61
+ */
62
+ exports.zRbacRoleSchema = zod_1.z.object({
63
+ name: zod_1.z.string(),
64
+ description: zod_1.z.string().optional(),
65
+ perms: exports.zRbacRolePermsSchema,
66
+ });
67
+ /**
68
+ * Schema for permission metadata in IRbacGroup
69
+ */
70
+ exports.zRbacPermissionMetadataSchema = zod_1.z
71
+ .object({
72
+ description: zod_1.z.string().optional(),
73
+ })
74
+ .passthrough();
75
+ /**
76
+ * Schema for IRbacGroup (RBAC catalog)
77
+ * Note: IRbacGroup does NOT extend IFireDoc (global document, not tenant-scoped)
78
+ */
79
+ exports.zRbacGroupSchema = zod_1.z
80
+ .object({
81
+ id: zod_1.z.string(),
82
+ name: zod_1.z.string(),
83
+ description: zod_1.z.string().optional(),
84
+ permissions: zod_1.z.record(exports.zRbacPermissionMetadataSchema),
85
+ roles: zod_1.z.record(exports.zRbacRoleSchema),
86
+ created_at: zod_schemas_1.zFirestoreDateSchema,
87
+ updated_at: zod_schemas_1.zFirestoreDateSchema,
88
+ })
89
+ .passthrough();
@@ -1,7 +1,97 @@
1
1
  import { z } from "zod";
2
+ import { zFireDocSchema, zFirestoreDateSchema } from "../shared/zod-schemas";
2
3
 
3
4
  export const zActionArgsSchema = z.object({
4
5
  old_values: z.record(z.any()).optional(),
5
6
  new_values: z.record(z.any()).optional(),
6
7
  deleted_at: z.coerce.date().optional(),
7
8
  });
9
+
10
+ // ----- RBAC Zod Schemas
11
+
12
+ /**
13
+ * Schema for RbacPermValue (tri-state permission value)
14
+ */
15
+ export const zRbacPermValueSchema = z.enum(["allow", "deny", "forbid"]);
16
+
17
+ /**
18
+ * Schema for TenantUserStatus
19
+ */
20
+ export const zTenantUserStatusSchema = z.enum([
21
+ "active",
22
+ "invited",
23
+ "disabled",
24
+ "removed",
25
+ ]);
26
+
27
+ /**
28
+ * Schema for UserTenantIndexStatus
29
+ */
30
+ export const zUserTenantIndexStatusSchema = z.enum([
31
+ "active",
32
+ "invited",
33
+ "disabled",
34
+ ]);
35
+
36
+ /**
37
+ * Schema for ITenantUser (membership document)
38
+ * Note: id, tenant, created_at, updated_at come from zFireDocSchema
39
+ */
40
+ export const zTenantUserSchema = zFireDocSchema
41
+ .extend({
42
+ status: zTenantUserStatusSchema,
43
+ roles: z.array(z.string()),
44
+ perms: z.record(z.boolean()),
45
+ })
46
+ .passthrough();
47
+
48
+ /**
49
+ * Schema for IUserTenantIndex (inverted index)
50
+ * Note: id, tenant, created_at, updated_at come from zFireDocSchema
51
+ */
52
+ export const zUserTenantIndexSchema = zFireDocSchema
53
+ .extend({
54
+ status: zUserTenantIndexStatusSchema,
55
+ tenant_name: z.string(),
56
+ tenant_deleted_at: zFirestoreDateSchema.nullable(),
57
+ })
58
+ .passthrough();
59
+
60
+ /**
61
+ * Schema for role permission mapping in IRbacGroup
62
+ */
63
+ export const zRbacRolePermsSchema = z.record(zRbacPermValueSchema);
64
+
65
+ /**
66
+ * Schema for role definition in IRbacGroup
67
+ */
68
+ export const zRbacRoleSchema = z.object({
69
+ name: z.string(),
70
+ description: z.string().optional(),
71
+ perms: zRbacRolePermsSchema,
72
+ });
73
+
74
+ /**
75
+ * Schema for permission metadata in IRbacGroup
76
+ */
77
+ export const zRbacPermissionMetadataSchema = z
78
+ .object({
79
+ description: z.string().optional(),
80
+ })
81
+ .passthrough();
82
+
83
+ /**
84
+ * Schema for IRbacGroup (RBAC catalog)
85
+ * Note: IRbacGroup does NOT extend IFireDoc (global document, not tenant-scoped)
86
+ */
87
+ export const zRbacGroupSchema = z
88
+ .object({
89
+ id: z.string(),
90
+ name: z.string(),
91
+ description: z.string().optional(),
92
+ permissions: z.record(zRbacPermissionMetadataSchema),
93
+ roles: z.record(zRbacRoleSchema),
94
+ created_at: zFirestoreDateSchema,
95
+ updated_at: zFirestoreDateSchema,
96
+ })
97
+ .passthrough();
@@ -23,11 +23,11 @@ export declare const zHubIAConfigSchema: z.ZodObject<{
23
23
  allow_reply_mode: boolean;
24
24
  transcribe_audio_when_ai_disabled: boolean;
25
25
  suggest_agenda_action: boolean;
26
- task_creation: "suggestion" | "disabled" | "create";
26
+ task_creation: "disabled" | "suggestion" | "create";
27
27
  system_message_prompt: string;
28
28
  }, {
29
29
  default_operation_mode: "reply" | "suggestion";
30
- task_creation: "suggestion" | "disabled" | "create";
30
+ task_creation: "disabled" | "suggestion" | "create";
31
31
  system_message_prompt: string;
32
32
  active?: boolean | undefined;
33
33
  enabled_for_new_contacts?: boolean | undefined;
@@ -1197,9 +1197,9 @@ export declare const zSurveyInviteeSchema: z.ZodObject<z.objectUtil.extendShape<
1197
1197
  created_at?: Date | null | undefined;
1198
1198
  updated_at?: Date | null | undefined;
1199
1199
  deleted_at?: Date | null | undefined;
1200
+ description?: string | undefined;
1200
1201
  email?: string | undefined;
1201
1202
  photo_url?: string | null | undefined;
1202
- description?: string | undefined;
1203
1203
  invitedUserId?: string | undefined;
1204
1204
  submissionId?: string | undefined;
1205
1205
  }, {
@@ -1211,10 +1211,10 @@ export declare const zSurveyInviteeSchema: z.ZodObject<z.objectUtil.extendShape<
1211
1211
  created_at?: Date | null | undefined;
1212
1212
  updated_at?: Date | null | undefined;
1213
1213
  deleted_at?: Date | null | undefined;
1214
+ description?: string | undefined;
1214
1215
  email?: string | undefined;
1215
1216
  photo_url?: string | null | undefined;
1216
1217
  phone?: string | undefined;
1217
- description?: string | undefined;
1218
1218
  invitedUserId?: string | undefined;
1219
1219
  isAnonymous?: boolean | undefined;
1220
1220
  submissionId?: string | undefined;
@@ -1374,9 +1374,9 @@ export declare const zSurveyDeploymentSchema: z.ZodObject<z.objectUtil.extendSha
1374
1374
  created_at?: Date | null | undefined;
1375
1375
  updated_at?: Date | null | undefined;
1376
1376
  deleted_at?: Date | null | undefined;
1377
+ description?: string | undefined;
1377
1378
  email?: string | undefined;
1378
1379
  photo_url?: string | null | undefined;
1379
- description?: string | undefined;
1380
1380
  invitedUserId?: string | undefined;
1381
1381
  submissionId?: string | undefined;
1382
1382
  }, {
@@ -1388,10 +1388,10 @@ export declare const zSurveyDeploymentSchema: z.ZodObject<z.objectUtil.extendSha
1388
1388
  created_at?: Date | null | undefined;
1389
1389
  updated_at?: Date | null | undefined;
1390
1390
  deleted_at?: Date | null | undefined;
1391
+ description?: string | undefined;
1391
1392
  email?: string | undefined;
1392
1393
  photo_url?: string | null | undefined;
1393
1394
  phone?: string | undefined;
1394
- description?: string | undefined;
1395
1395
  invitedUserId?: string | undefined;
1396
1396
  isAnonymous?: boolean | undefined;
1397
1397
  submissionId?: string | undefined;
@@ -1555,6 +1555,7 @@ export declare const zSurveyDeploymentSchema: z.ZodObject<z.objectUtil.extendSha
1555
1555
  created_at?: Date | null | undefined;
1556
1556
  updated_at?: Date | null | undefined;
1557
1557
  deleted_at?: Date | null | undefined;
1558
+ description?: string | undefined;
1558
1559
  surveys?: z.objectOutputType<z.objectUtil.extendShape<{
1559
1560
  id: z.ZodString;
1560
1561
  ref: z.ZodAny;
@@ -1623,7 +1624,6 @@ export declare const zSurveyDeploymentSchema: z.ZodObject<z.objectUtil.extendSha
1623
1624
  submission_date?: Date | undefined;
1624
1625
  inviteeId?: string | undefined;
1625
1626
  }[] | null | undefined;
1626
- description?: string | undefined;
1627
1627
  invitees?: {
1628
1628
  name: string;
1629
1629
  id: string;
@@ -1636,9 +1636,9 @@ export declare const zSurveyDeploymentSchema: z.ZodObject<z.objectUtil.extendSha
1636
1636
  created_at?: Date | null | undefined;
1637
1637
  updated_at?: Date | null | undefined;
1638
1638
  deleted_at?: Date | null | undefined;
1639
+ description?: string | undefined;
1639
1640
  email?: string | undefined;
1640
1641
  photo_url?: string | null | undefined;
1641
- description?: string | undefined;
1642
1642
  invitedUserId?: string | undefined;
1643
1643
  submissionId?: string | undefined;
1644
1644
  }[] | null | undefined;
@@ -1656,6 +1656,7 @@ export declare const zSurveyDeploymentSchema: z.ZodObject<z.objectUtil.extendSha
1656
1656
  created_at?: Date | null | undefined;
1657
1657
  updated_at?: Date | null | undefined;
1658
1658
  deleted_at?: Date | null | undefined;
1659
+ description?: string | undefined;
1659
1660
  surveys?: z.objectInputType<z.objectUtil.extendShape<{
1660
1661
  id: z.ZodString;
1661
1662
  ref: z.ZodAny;
@@ -1724,7 +1725,6 @@ export declare const zSurveyDeploymentSchema: z.ZodObject<z.objectUtil.extendSha
1724
1725
  answer_count?: number | undefined;
1725
1726
  submission_count?: number | undefined;
1726
1727
  }[] | null | undefined;
1727
- description?: string | undefined;
1728
1728
  submission_count?: number | undefined;
1729
1729
  section_count?: number | undefined;
1730
1730
  question_count?: number | undefined;
@@ -1737,10 +1737,10 @@ export declare const zSurveyDeploymentSchema: z.ZodObject<z.objectUtil.extendSha
1737
1737
  created_at?: Date | null | undefined;
1738
1738
  updated_at?: Date | null | undefined;
1739
1739
  deleted_at?: Date | null | undefined;
1740
+ description?: string | undefined;
1740
1741
  email?: string | undefined;
1741
1742
  photo_url?: string | null | undefined;
1742
1743
  phone?: string | undefined;
1743
- description?: string | undefined;
1744
1744
  invitedUserId?: string | undefined;
1745
1745
  isAnonymous?: boolean | undefined;
1746
1746
  submissionId?: string | undefined;
@@ -188,6 +188,7 @@ export declare const zTaskOnFailureSchema: z.ZodObject<{
188
188
  category?: string | null | undefined;
189
189
  }>, "many">>>;
190
190
  }, "strip", z.ZodTypeAny, {
191
+ description?: string | undefined;
191
192
  tags?: {
192
193
  name: string;
193
194
  hidden: boolean;
@@ -196,9 +197,9 @@ export declare const zTaskOnFailureSchema: z.ZodObject<{
196
197
  category?: string | null | undefined;
197
198
  }[] | null | undefined;
198
199
  title?: string | undefined;
199
- description?: string | undefined;
200
200
  priority?: "low" | "medium" | "high" | undefined;
201
201
  }, {
202
+ description?: string | undefined;
202
203
  tags?: {
203
204
  name: string;
204
205
  hidden: boolean;
@@ -207,7 +208,6 @@ export declare const zTaskOnFailureSchema: z.ZodObject<{
207
208
  category?: string | null | undefined;
208
209
  }[] | null | undefined;
209
210
  title?: string | undefined;
210
- description?: string | undefined;
211
211
  priority?: "low" | "medium" | "high" | undefined;
212
212
  }>>;
213
213
  auto_fallbacks: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -229,6 +229,7 @@ export declare const zTaskOnFailureSchema: z.ZodObject<{
229
229
  ref?: any;
230
230
  } | undefined;
231
231
  create_handoff_task?: {
232
+ description?: string | undefined;
232
233
  tags?: {
233
234
  name: string;
234
235
  hidden: boolean;
@@ -237,7 +238,6 @@ export declare const zTaskOnFailureSchema: z.ZodObject<{
237
238
  category?: string | null | undefined;
238
239
  }[] | null | undefined;
239
240
  title?: string | undefined;
240
- description?: string | undefined;
241
241
  priority?: "low" | "medium" | "high" | undefined;
242
242
  } | undefined;
243
243
  auto_fallbacks?: {
@@ -251,6 +251,7 @@ export declare const zTaskOnFailureSchema: z.ZodObject<{
251
251
  ref?: any;
252
252
  } | undefined;
253
253
  create_handoff_task?: {
254
+ description?: string | undefined;
254
255
  tags?: {
255
256
  name: string;
256
257
  hidden: boolean;
@@ -259,7 +260,6 @@ export declare const zTaskOnFailureSchema: z.ZodObject<{
259
260
  category?: string | null | undefined;
260
261
  }[] | null | undefined;
261
262
  title?: string | undefined;
262
- description?: string | undefined;
263
263
  priority?: "low" | "medium" | "high" | undefined;
264
264
  } | undefined;
265
265
  auto_fallbacks?: {
@@ -484,6 +484,7 @@ export declare const zTaskSchema: z.ZodObject<z.objectUtil.extendShape<{
484
484
  category?: string | null | undefined;
485
485
  }>, "many">>>;
486
486
  }, "strip", z.ZodTypeAny, {
487
+ description?: string | undefined;
487
488
  tags?: {
488
489
  name: string;
489
490
  hidden: boolean;
@@ -492,9 +493,9 @@ export declare const zTaskSchema: z.ZodObject<z.objectUtil.extendShape<{
492
493
  category?: string | null | undefined;
493
494
  }[] | null | undefined;
494
495
  title?: string | undefined;
495
- description?: string | undefined;
496
496
  priority?: "low" | "medium" | "high" | undefined;
497
497
  }, {
498
+ description?: string | undefined;
498
499
  tags?: {
499
500
  name: string;
500
501
  hidden: boolean;
@@ -503,7 +504,6 @@ export declare const zTaskSchema: z.ZodObject<z.objectUtil.extendShape<{
503
504
  category?: string | null | undefined;
504
505
  }[] | null | undefined;
505
506
  title?: string | undefined;
506
- description?: string | undefined;
507
507
  priority?: "low" | "medium" | "high" | undefined;
508
508
  }>>;
509
509
  auto_fallbacks: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -525,6 +525,7 @@ export declare const zTaskSchema: z.ZodObject<z.objectUtil.extendShape<{
525
525
  ref?: any;
526
526
  } | undefined;
527
527
  create_handoff_task?: {
528
+ description?: string | undefined;
528
529
  tags?: {
529
530
  name: string;
530
531
  hidden: boolean;
@@ -533,7 +534,6 @@ export declare const zTaskSchema: z.ZodObject<z.objectUtil.extendShape<{
533
534
  category?: string | null | undefined;
534
535
  }[] | null | undefined;
535
536
  title?: string | undefined;
536
- description?: string | undefined;
537
537
  priority?: "low" | "medium" | "high" | undefined;
538
538
  } | undefined;
539
539
  auto_fallbacks?: {
@@ -547,6 +547,7 @@ export declare const zTaskSchema: z.ZodObject<z.objectUtil.extendShape<{
547
547
  ref?: any;
548
548
  } | undefined;
549
549
  create_handoff_task?: {
550
+ description?: string | undefined;
550
551
  tags?: {
551
552
  name: string;
552
553
  hidden: boolean;
@@ -555,7 +556,6 @@ export declare const zTaskSchema: z.ZodObject<z.objectUtil.extendShape<{
555
556
  category?: string | null | undefined;
556
557
  }[] | null | undefined;
557
558
  title?: string | undefined;
558
- description?: string | undefined;
559
559
  priority?: "low" | "medium" | "high" | undefined;
560
560
  } | undefined;
561
561
  auto_fallbacks?: {
@@ -789,6 +789,7 @@ export declare const zTaskSchema: z.ZodObject<z.objectUtil.extendShape<{
789
789
  category?: string | null | undefined;
790
790
  }>, "many">>>;
791
791
  }, "strip", z.ZodTypeAny, {
792
+ description?: string | undefined;
792
793
  tags?: {
793
794
  name: string;
794
795
  hidden: boolean;
@@ -797,9 +798,9 @@ export declare const zTaskSchema: z.ZodObject<z.objectUtil.extendShape<{
797
798
  category?: string | null | undefined;
798
799
  }[] | null | undefined;
799
800
  title?: string | undefined;
800
- description?: string | undefined;
801
801
  priority?: "low" | "medium" | "high" | undefined;
802
802
  }, {
803
+ description?: string | undefined;
803
804
  tags?: {
804
805
  name: string;
805
806
  hidden: boolean;
@@ -808,7 +809,6 @@ export declare const zTaskSchema: z.ZodObject<z.objectUtil.extendShape<{
808
809
  category?: string | null | undefined;
809
810
  }[] | null | undefined;
810
811
  title?: string | undefined;
811
- description?: string | undefined;
812
812
  priority?: "low" | "medium" | "high" | undefined;
813
813
  }>>;
814
814
  auto_fallbacks: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -830,6 +830,7 @@ export declare const zTaskSchema: z.ZodObject<z.objectUtil.extendShape<{
830
830
  ref?: any;
831
831
  } | undefined;
832
832
  create_handoff_task?: {
833
+ description?: string | undefined;
833
834
  tags?: {
834
835
  name: string;
835
836
  hidden: boolean;
@@ -838,7 +839,6 @@ export declare const zTaskSchema: z.ZodObject<z.objectUtil.extendShape<{
838
839
  category?: string | null | undefined;
839
840
  }[] | null | undefined;
840
841
  title?: string | undefined;
841
- description?: string | undefined;
842
842
  priority?: "low" | "medium" | "high" | undefined;
843
843
  } | undefined;
844
844
  auto_fallbacks?: {
@@ -852,6 +852,7 @@ export declare const zTaskSchema: z.ZodObject<z.objectUtil.extendShape<{
852
852
  ref?: any;
853
853
  } | undefined;
854
854
  create_handoff_task?: {
855
+ description?: string | undefined;
855
856
  tags?: {
856
857
  name: string;
857
858
  hidden: boolean;
@@ -860,7 +861,6 @@ export declare const zTaskSchema: z.ZodObject<z.objectUtil.extendShape<{
860
861
  category?: string | null | undefined;
861
862
  }[] | null | undefined;
862
863
  title?: string | undefined;
863
- description?: string | undefined;
864
864
  priority?: "low" | "medium" | "high" | undefined;
865
865
  } | undefined;
866
866
  auto_fallbacks?: {
@@ -1094,6 +1094,7 @@ export declare const zTaskSchema: z.ZodObject<z.objectUtil.extendShape<{
1094
1094
  category?: string | null | undefined;
1095
1095
  }>, "many">>>;
1096
1096
  }, "strip", z.ZodTypeAny, {
1097
+ description?: string | undefined;
1097
1098
  tags?: {
1098
1099
  name: string;
1099
1100
  hidden: boolean;
@@ -1102,9 +1103,9 @@ export declare const zTaskSchema: z.ZodObject<z.objectUtil.extendShape<{
1102
1103
  category?: string | null | undefined;
1103
1104
  }[] | null | undefined;
1104
1105
  title?: string | undefined;
1105
- description?: string | undefined;
1106
1106
  priority?: "low" | "medium" | "high" | undefined;
1107
1107
  }, {
1108
+ description?: string | undefined;
1108
1109
  tags?: {
1109
1110
  name: string;
1110
1111
  hidden: boolean;
@@ -1113,7 +1114,6 @@ export declare const zTaskSchema: z.ZodObject<z.objectUtil.extendShape<{
1113
1114
  category?: string | null | undefined;
1114
1115
  }[] | null | undefined;
1115
1116
  title?: string | undefined;
1116
- description?: string | undefined;
1117
1117
  priority?: "low" | "medium" | "high" | undefined;
1118
1118
  }>>;
1119
1119
  auto_fallbacks: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -1135,6 +1135,7 @@ export declare const zTaskSchema: z.ZodObject<z.objectUtil.extendShape<{
1135
1135
  ref?: any;
1136
1136
  } | undefined;
1137
1137
  create_handoff_task?: {
1138
+ description?: string | undefined;
1138
1139
  tags?: {
1139
1140
  name: string;
1140
1141
  hidden: boolean;
@@ -1143,7 +1144,6 @@ export declare const zTaskSchema: z.ZodObject<z.objectUtil.extendShape<{
1143
1144
  category?: string | null | undefined;
1144
1145
  }[] | null | undefined;
1145
1146
  title?: string | undefined;
1146
- description?: string | undefined;
1147
1147
  priority?: "low" | "medium" | "high" | undefined;
1148
1148
  } | undefined;
1149
1149
  auto_fallbacks?: {
@@ -1157,6 +1157,7 @@ export declare const zTaskSchema: z.ZodObject<z.objectUtil.extendShape<{
1157
1157
  ref?: any;
1158
1158
  } | undefined;
1159
1159
  create_handoff_task?: {
1160
+ description?: string | undefined;
1160
1161
  tags?: {
1161
1162
  name: string;
1162
1163
  hidden: boolean;
@@ -1165,7 +1166,6 @@ export declare const zTaskSchema: z.ZodObject<z.objectUtil.extendShape<{
1165
1166
  category?: string | null | undefined;
1166
1167
  }[] | null | undefined;
1167
1168
  title?: string | undefined;
1168
- description?: string | undefined;
1169
1169
  priority?: "low" | "medium" | "high" | undefined;
1170
1170
  } | undefined;
1171
1171
  auto_fallbacks?: {
@@ -26,8 +26,8 @@ export declare const zTenantSchema: z.ZodObject<z.objectUtil.extendShape<{
26
26
  id: string;
27
27
  tenant: string;
28
28
  model_ver: number;
29
- url_alias: string;
30
29
  status: "draft" | "published" | "archived";
30
+ url_alias: string;
31
31
  ref?: any;
32
32
  created_at?: Date | null | undefined;
33
33
  updated_at?: Date | null | undefined;
@@ -43,8 +43,8 @@ export declare const zTenantSchema: z.ZodObject<z.objectUtil.extendShape<{
43
43
  name: string;
44
44
  id: string;
45
45
  tenant: string;
46
- url_alias: string;
47
46
  status: "draft" | "published" | "archived";
47
+ url_alias: string;
48
48
  ref?: any;
49
49
  model_ver?: number | undefined;
50
50
  created_at?: Date | null | undefined;
@@ -43,3 +43,4 @@ export interface IActionArgs {
43
43
  new_values?: Record<string, any>;
44
44
  deleted_at?: Date;
45
45
  }
46
+ export * from "./rbac";
@@ -1,2 +1,18 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
2
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ // RBAC Types
18
+ __exportStar(require("./rbac"), exports);
@@ -50,3 +50,6 @@ export interface IActionArgs {
50
50
  new_values?: Record<string, any>;
51
51
  deleted_at?: Date;
52
52
  }
53
+
54
+ // RBAC Types
55
+ export * from "./rbac";
@@ -0,0 +1,4 @@
1
+ export declare const RBAC_COLLECTION = "rbac";
2
+ export declare const RBAC_GROUPS_COLLECTION = "groups";
3
+ export declare const TENANT_USERS_COLLECTION = "users";
4
+ export declare const USER_TENANTS_COLLECTION = "tenants";
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.USER_TENANTS_COLLECTION = exports.TENANT_USERS_COLLECTION = exports.RBAC_GROUPS_COLLECTION = exports.RBAC_COLLECTION = void 0;
4
+ // RBAC Firestore Collections
5
+ exports.RBAC_COLLECTION = "rbac";
6
+ exports.RBAC_GROUPS_COLLECTION = "groups";
7
+ exports.TENANT_USERS_COLLECTION = "users";
8
+ exports.USER_TENANTS_COLLECTION = "tenants";
@@ -0,0 +1,5 @@
1
+ // RBAC Firestore Collections
2
+ export const RBAC_COLLECTION = "rbac";
3
+ export const RBAC_GROUPS_COLLECTION = "groups";
4
+ export const TENANT_USERS_COLLECTION = "users";
5
+ export const USER_TENANTS_COLLECTION = "tenants";
@@ -0,0 +1,135 @@
1
+ export * from "./fb_collections";
2
+ import type { IFireDoc } from "../../shared";
3
+ /**
4
+ * Tri-state permission value for role definitions.
5
+ * - 'allow': grants the permission
6
+ * - 'deny': does not grant (can be overridden by another role with 'allow')
7
+ * - 'forbid': explicitly denies and overrides any 'allow'
8
+ */
9
+ export type RbacPermValue = "allow" | "deny" | "forbid";
10
+ /**
11
+ * Membership status for a user in a tenant.
12
+ */
13
+ export type TenantUserStatus = "active" | "invited" | "disabled" | "removed";
14
+ /**
15
+ * Status for user tenant index (simplified, no 'removed').
16
+ */
17
+ export type UserTenantIndexStatus = "active" | "invited" | "disabled";
18
+ /**
19
+ * Membership document representing a user's access to a tenant.
20
+ * This is the PRIMARY authorization document for the system.
21
+ *
22
+ * Path: /tenants/{tenantId}/users/{userId}
23
+ */
24
+ export interface ITenantUser extends IFireDoc {
25
+ status: TenantUserStatus;
26
+ /**
27
+ * Array of role IDs assigned to the user in this tenant.
28
+ * Example: ['crm_admin', 'sales']
29
+ */
30
+ roles: string[];
31
+ /**
32
+ * Effective permissions (already resolved from roles).
33
+ * This is a boolean map where each key is a permission identifier.
34
+ *
35
+ * Example:
36
+ * {
37
+ * crm_read: true,
38
+ * crm_write: true,
39
+ * billing_read: false
40
+ * }
41
+ *
42
+ * IMPORTANT: Security Rules and backend should NEVER calculate
43
+ * roles → perms dynamically. Always use this materialized object.
44
+ */
45
+ perms: {
46
+ [permissionKey: string]: boolean;
47
+ };
48
+ }
49
+ /**
50
+ * Inverted index for listing tenants accessible by a user.
51
+ * Used exclusively for performant listing without expensive queries.
52
+ *
53
+ * Path: /users/{userId}/tenants/{tenantId}
54
+ */
55
+ export interface IUserTenantIndex extends IFireDoc {
56
+ status: UserTenantIndexStatus;
57
+ /**
58
+ * Tenant name for display purposes.
59
+ */
60
+ tenant_name: string;
61
+ /**
62
+ * Timestamp when tenant was deleted (soft delete).
63
+ * null if tenant is active.
64
+ */
65
+ tenant_deleted_at: Date | null;
66
+ }
67
+ /**
68
+ * RBAC group definition (catalog).
69
+ * Represents a module's roles and permissions (e.g., 'evo-crm', 'evo-med').
70
+ *
71
+ * Path: /rbac/groups/{groupKey}
72
+ *
73
+ * IMPORTANT: This catalog does NOT participate in real-time authorization.
74
+ * It exists to facilitate registration, consistency, and evolution.
75
+ *
76
+ * Note: This does NOT extend IFireDoc because it's a global document
77
+ * (not tenant-scoped). It has its own structure.
78
+ */
79
+ export interface IRbacGroup {
80
+ /**
81
+ * Document ID.
82
+ */
83
+ id: string;
84
+ /**
85
+ * Human-readable name.
86
+ * Example: "Evo CRM"
87
+ */
88
+ name: string;
89
+ /**
90
+ * Optional description of the module/group.
91
+ */
92
+ description?: string;
93
+ /**
94
+ * Catalog of permissions for this module (documentation/UI).
95
+ * Maps permission keys to metadata.
96
+ */
97
+ permissions: {
98
+ [permissionKey: string]: {
99
+ description?: string;
100
+ [key: string]: unknown;
101
+ };
102
+ };
103
+ /**
104
+ * Roles defined in this module.
105
+ * Maps role IDs to role definitions (name, description, permissions).
106
+ */
107
+ roles: {
108
+ [roleId: string]: {
109
+ name: string;
110
+ description?: string;
111
+ /**
112
+ * Permissions for this role (tri-state).
113
+ * Each permission can be 'allow', 'deny', or 'forbid'.
114
+ */
115
+ perms: {
116
+ [permissionKey: string]: RbacPermValue;
117
+ };
118
+ };
119
+ };
120
+ created_at: Date;
121
+ updated_at: Date;
122
+ }
123
+ /**
124
+ * Extended tenant configuration that includes RBAC groups.
125
+ * This should be added to ITenant interface in evo-tenant module.
126
+ *
127
+ * For now, we define it here as a type that can be merged.
128
+ */
129
+ export interface ITenantRbacConfig {
130
+ /**
131
+ * Array of RBAC group keys that this tenant inherits.
132
+ * Example: ['evo-crm', 'evo-med']
133
+ */
134
+ rbac_groups?: string[];
135
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./fb_collections"), exports);
@@ -0,0 +1,168 @@
1
+ export * from "./fb_collections";
2
+ import type { FirestoreDocumentReference, IFireDoc } from "../../shared";
3
+
4
+ // ----- RBAC Types
5
+
6
+ /**
7
+ * Tri-state permission value for role definitions.
8
+ * - 'allow': grants the permission
9
+ * - 'deny': does not grant (can be overridden by another role with 'allow')
10
+ * - 'forbid': explicitly denies and overrides any 'allow'
11
+ */
12
+ export type RbacPermValue = "allow" | "deny" | "forbid";
13
+
14
+ /**
15
+ * Membership status for a user in a tenant.
16
+ */
17
+ export type TenantUserStatus = "active" | "invited" | "disabled" | "removed";
18
+
19
+ /**
20
+ * Status for user tenant index (simplified, no 'removed').
21
+ */
22
+ export type UserTenantIndexStatus = "active" | "invited" | "disabled";
23
+
24
+ // ----- Tenant User Membership (AUTORIZAÇÃO PRINCIPAL)
25
+ // Path: /tenants/{tenantId}/users/{userId}
26
+
27
+ /**
28
+ * Membership document representing a user's access to a tenant.
29
+ * This is the PRIMARY authorization document for the system.
30
+ *
31
+ * Path: /tenants/{tenantId}/users/{userId}
32
+ */
33
+ export interface ITenantUser extends IFireDoc {
34
+ status: TenantUserStatus;
35
+ // tenant field from IFireDoc represents the tenantId
36
+
37
+ /**
38
+ * Array of role IDs assigned to the user in this tenant.
39
+ * Example: ['crm_admin', 'sales']
40
+ */
41
+ roles: string[];
42
+
43
+ /**
44
+ * Effective permissions (already resolved from roles).
45
+ * This is a boolean map where each key is a permission identifier.
46
+ *
47
+ * Example:
48
+ * {
49
+ * crm_read: true,
50
+ * crm_write: true,
51
+ * billing_read: false
52
+ * }
53
+ *
54
+ * IMPORTANT: Security Rules and backend should NEVER calculate
55
+ * roles → perms dynamically. Always use this materialized object.
56
+ */
57
+ perms: {
58
+ [permissionKey: string]: boolean;
59
+ };
60
+ }
61
+
62
+ // ----- User Tenant Index (ÍNDICE INVERTIDO)
63
+ // Path: /users/{userId}/tenants/{tenantId}
64
+
65
+ /**
66
+ * Inverted index for listing tenants accessible by a user.
67
+ * Used exclusively for performant listing without expensive queries.
68
+ *
69
+ * Path: /users/{userId}/tenants/{tenantId}
70
+ */
71
+ export interface IUserTenantIndex extends IFireDoc {
72
+ status: UserTenantIndexStatus;
73
+ // tenant field from IFireDoc represents the tenantId
74
+
75
+ /**
76
+ * Tenant name for display purposes.
77
+ */
78
+ tenant_name: string;
79
+
80
+ /**
81
+ * Timestamp when tenant was deleted (soft delete).
82
+ * null if tenant is active.
83
+ */
84
+ tenant_deleted_at: Date | null;
85
+ }
86
+
87
+ // ----- RBAC Group (DICIONÁRIO RBAC GLOBAL)
88
+ // Path: /rbac/groups/{groupKey}
89
+
90
+ /**
91
+ * RBAC group definition (catalog).
92
+ * Represents a module's roles and permissions (e.g., 'evo-crm', 'evo-med').
93
+ *
94
+ * Path: /rbac/groups/{groupKey}
95
+ *
96
+ * IMPORTANT: This catalog does NOT participate in real-time authorization.
97
+ * It exists to facilitate registration, consistency, and evolution.
98
+ *
99
+ * Note: This does NOT extend IFireDoc because it's a global document
100
+ * (not tenant-scoped). It has its own structure.
101
+ */
102
+ export interface IRbacGroup {
103
+ /**
104
+ * Document ID.
105
+ */
106
+ id: string;
107
+
108
+ /**
109
+ * Human-readable name.
110
+ * Example: "Evo CRM"
111
+ */
112
+ name: string;
113
+
114
+ /**
115
+ * Optional description of the module/group.
116
+ */
117
+ description?: string;
118
+
119
+ /**
120
+ * Catalog of permissions for this module (documentation/UI).
121
+ * Maps permission keys to metadata.
122
+ */
123
+ permissions: {
124
+ [permissionKey: string]: {
125
+ description?: string;
126
+ // Optional: tags, category, level, etc.
127
+ [key: string]: unknown;
128
+ };
129
+ };
130
+
131
+ /**
132
+ * Roles defined in this module.
133
+ * Maps role IDs to role definitions (name, description, permissions).
134
+ */
135
+ roles: {
136
+ [roleId: string]: {
137
+ name: string;
138
+ description?: string;
139
+ /**
140
+ * Permissions for this role (tri-state).
141
+ * Each permission can be 'allow', 'deny', or 'forbid'.
142
+ */
143
+ perms: {
144
+ [permissionKey: string]: RbacPermValue;
145
+ };
146
+ };
147
+ };
148
+
149
+ created_at: Date;
150
+ updated_at: Date;
151
+ }
152
+
153
+ // ----- Tenant Configuration Extension
154
+ // This extends ITenant to include rbac_groups field
155
+
156
+ /**
157
+ * Extended tenant configuration that includes RBAC groups.
158
+ * This should be added to ITenant interface in evo-tenant module.
159
+ *
160
+ * For now, we define it here as a type that can be merged.
161
+ */
162
+ export interface ITenantRbacConfig {
163
+ /**
164
+ * Array of RBAC group keys that this tenant inherits.
165
+ * Example: ['evo-crm', 'evo-med']
166
+ */
167
+ rbac_groups?: string[];
168
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "evo360-types",
3
- "version": "1.3.153",
3
+ "version": "1.3.154",
4
4
  "description": "HREVO360 Shared Types",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",