evo360-types 1.3.152 → 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.
- package/dist/apps/evo-chat/chatbee/zod-schemas.d.ts +6 -6
- package/dist/apps/evo-core/zod-schemas.d.ts +207 -0
- package/dist/apps/evo-core/zod-schemas.js +81 -1
- package/dist/apps/evo-core/zod-schemas.ts +90 -0
- package/dist/apps/evo-hub-ia/channel/zod-schemas.d.ts +2 -2
- package/dist/apps/evo-survey/zod-schemas.d.ts +8 -8
- package/dist/apps/evo-task/zod-schemas.d.ts +28 -16
- package/dist/apps/evo-task/zod-schemas.js +1 -0
- package/dist/apps/evo-task/zod-schemas.ts +1 -0
- package/dist/apps/evo-tenant/zod-schemas.d.ts +2 -2
- package/dist/types/evo-core/index.d.ts +1 -0
- package/dist/types/evo-core/index.js +16 -0
- package/dist/types/evo-core/index.ts +3 -0
- package/dist/types/evo-core/rbac/fb_collections.d.ts +4 -0
- package/dist/types/evo-core/rbac/fb_collections.js +8 -0
- package/dist/types/evo-core/rbac/fb_collections.ts +5 -0
- package/dist/types/evo-core/rbac/index.d.ts +135 -0
- package/dist/types/evo-core/rbac/index.js +17 -0
- package/dist/types/evo-core/rbac/index.ts +168 -0
- package/dist/types/evo-task/index.d.ts +1 -0
- package/dist/types/evo-task/index.ts +1 -0
- package/package.json +1 -1
|
@@ -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: "
|
|
38
|
+
task_creation: "disabled" | "suggestion" | "create";
|
|
39
39
|
system_message_prompt: string;
|
|
40
40
|
}, {
|
|
41
41
|
default_operation_mode: "reply" | "suggestion";
|
|
42
|
-
task_creation: "
|
|
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: "
|
|
92
|
+
task_creation: "disabled" | "suggestion" | "create";
|
|
93
93
|
system_message_prompt: string;
|
|
94
94
|
}, {
|
|
95
95
|
default_operation_mode: "reply" | "suggestion";
|
|
96
|
-
task_creation: "
|
|
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: "
|
|
146
|
+
task_creation: "disabled" | "suggestion" | "create";
|
|
147
147
|
system_message_prompt: string;
|
|
148
148
|
}, {
|
|
149
149
|
default_operation_mode: "reply" | "suggestion";
|
|
150
|
-
task_creation: "
|
|
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: "
|
|
26
|
+
task_creation: "disabled" | "suggestion" | "create";
|
|
27
27
|
system_message_prompt: string;
|
|
28
28
|
}, {
|
|
29
29
|
default_operation_mode: "reply" | "suggestion";
|
|
30
|
-
task_creation: "
|
|
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;
|
|
@@ -14,13 +14,16 @@ export declare const zTaskExternalLinkSchema: z.ZodObject<{
|
|
|
14
14
|
type: z.ZodEnum<["crm_lead", "med_patient", "med_professional", "med_appointment", "chat_contact"]>;
|
|
15
15
|
id: z.ZodString;
|
|
16
16
|
label: z.ZodOptional<z.ZodString>;
|
|
17
|
+
ref: z.ZodOptional<z.ZodAny>;
|
|
17
18
|
}, "strip", z.ZodTypeAny, {
|
|
18
19
|
id: string;
|
|
19
20
|
type: "crm_lead" | "med_patient" | "med_professional" | "med_appointment" | "chat_contact";
|
|
21
|
+
ref?: any;
|
|
20
22
|
label?: string | undefined;
|
|
21
23
|
}, {
|
|
22
24
|
id: string;
|
|
23
25
|
type: "crm_lead" | "med_patient" | "med_professional" | "med_appointment" | "chat_contact";
|
|
26
|
+
ref?: any;
|
|
24
27
|
label?: string | undefined;
|
|
25
28
|
}>;
|
|
26
29
|
export declare const zTaskScheduleSchema: z.ZodObject<{
|
|
@@ -185,6 +188,7 @@ export declare const zTaskOnFailureSchema: z.ZodObject<{
|
|
|
185
188
|
category?: string | null | undefined;
|
|
186
189
|
}>, "many">>>;
|
|
187
190
|
}, "strip", z.ZodTypeAny, {
|
|
191
|
+
description?: string | undefined;
|
|
188
192
|
tags?: {
|
|
189
193
|
name: string;
|
|
190
194
|
hidden: boolean;
|
|
@@ -193,9 +197,9 @@ export declare const zTaskOnFailureSchema: z.ZodObject<{
|
|
|
193
197
|
category?: string | null | undefined;
|
|
194
198
|
}[] | null | undefined;
|
|
195
199
|
title?: string | undefined;
|
|
196
|
-
description?: string | undefined;
|
|
197
200
|
priority?: "low" | "medium" | "high" | undefined;
|
|
198
201
|
}, {
|
|
202
|
+
description?: string | undefined;
|
|
199
203
|
tags?: {
|
|
200
204
|
name: string;
|
|
201
205
|
hidden: boolean;
|
|
@@ -204,7 +208,6 @@ export declare const zTaskOnFailureSchema: z.ZodObject<{
|
|
|
204
208
|
category?: string | null | undefined;
|
|
205
209
|
}[] | null | undefined;
|
|
206
210
|
title?: string | undefined;
|
|
207
|
-
description?: string | undefined;
|
|
208
211
|
priority?: "low" | "medium" | "high" | undefined;
|
|
209
212
|
}>>;
|
|
210
213
|
auto_fallbacks: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -226,6 +229,7 @@ export declare const zTaskOnFailureSchema: z.ZodObject<{
|
|
|
226
229
|
ref?: any;
|
|
227
230
|
} | undefined;
|
|
228
231
|
create_handoff_task?: {
|
|
232
|
+
description?: string | undefined;
|
|
229
233
|
tags?: {
|
|
230
234
|
name: string;
|
|
231
235
|
hidden: boolean;
|
|
@@ -234,7 +238,6 @@ export declare const zTaskOnFailureSchema: z.ZodObject<{
|
|
|
234
238
|
category?: string | null | undefined;
|
|
235
239
|
}[] | null | undefined;
|
|
236
240
|
title?: string | undefined;
|
|
237
|
-
description?: string | undefined;
|
|
238
241
|
priority?: "low" | "medium" | "high" | undefined;
|
|
239
242
|
} | undefined;
|
|
240
243
|
auto_fallbacks?: {
|
|
@@ -248,6 +251,7 @@ export declare const zTaskOnFailureSchema: z.ZodObject<{
|
|
|
248
251
|
ref?: any;
|
|
249
252
|
} | undefined;
|
|
250
253
|
create_handoff_task?: {
|
|
254
|
+
description?: string | undefined;
|
|
251
255
|
tags?: {
|
|
252
256
|
name: string;
|
|
253
257
|
hidden: boolean;
|
|
@@ -256,7 +260,6 @@ export declare const zTaskOnFailureSchema: z.ZodObject<{
|
|
|
256
260
|
category?: string | null | undefined;
|
|
257
261
|
}[] | null | undefined;
|
|
258
262
|
title?: string | undefined;
|
|
259
|
-
description?: string | undefined;
|
|
260
263
|
priority?: "low" | "medium" | "high" | undefined;
|
|
261
264
|
} | undefined;
|
|
262
265
|
auto_fallbacks?: {
|
|
@@ -336,13 +339,16 @@ export declare const zTaskSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
336
339
|
type: z.ZodEnum<["crm_lead", "med_patient", "med_professional", "med_appointment", "chat_contact"]>;
|
|
337
340
|
id: z.ZodString;
|
|
338
341
|
label: z.ZodOptional<z.ZodString>;
|
|
342
|
+
ref: z.ZodOptional<z.ZodAny>;
|
|
339
343
|
}, "strip", z.ZodTypeAny, {
|
|
340
344
|
id: string;
|
|
341
345
|
type: "crm_lead" | "med_patient" | "med_professional" | "med_appointment" | "chat_contact";
|
|
346
|
+
ref?: any;
|
|
342
347
|
label?: string | undefined;
|
|
343
348
|
}, {
|
|
344
349
|
id: string;
|
|
345
350
|
type: "crm_lead" | "med_patient" | "med_professional" | "med_appointment" | "chat_contact";
|
|
351
|
+
ref?: any;
|
|
346
352
|
label?: string | undefined;
|
|
347
353
|
}>, "many">>;
|
|
348
354
|
idempotency_key: z.ZodOptional<z.ZodString>;
|
|
@@ -478,6 +484,7 @@ export declare const zTaskSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
478
484
|
category?: string | null | undefined;
|
|
479
485
|
}>, "many">>>;
|
|
480
486
|
}, "strip", z.ZodTypeAny, {
|
|
487
|
+
description?: string | undefined;
|
|
481
488
|
tags?: {
|
|
482
489
|
name: string;
|
|
483
490
|
hidden: boolean;
|
|
@@ -486,9 +493,9 @@ export declare const zTaskSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
486
493
|
category?: string | null | undefined;
|
|
487
494
|
}[] | null | undefined;
|
|
488
495
|
title?: string | undefined;
|
|
489
|
-
description?: string | undefined;
|
|
490
496
|
priority?: "low" | "medium" | "high" | undefined;
|
|
491
497
|
}, {
|
|
498
|
+
description?: string | undefined;
|
|
492
499
|
tags?: {
|
|
493
500
|
name: string;
|
|
494
501
|
hidden: boolean;
|
|
@@ -497,7 +504,6 @@ export declare const zTaskSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
497
504
|
category?: string | null | undefined;
|
|
498
505
|
}[] | null | undefined;
|
|
499
506
|
title?: string | undefined;
|
|
500
|
-
description?: string | undefined;
|
|
501
507
|
priority?: "low" | "medium" | "high" | undefined;
|
|
502
508
|
}>>;
|
|
503
509
|
auto_fallbacks: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -519,6 +525,7 @@ export declare const zTaskSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
519
525
|
ref?: any;
|
|
520
526
|
} | undefined;
|
|
521
527
|
create_handoff_task?: {
|
|
528
|
+
description?: string | undefined;
|
|
522
529
|
tags?: {
|
|
523
530
|
name: string;
|
|
524
531
|
hidden: boolean;
|
|
@@ -527,7 +534,6 @@ export declare const zTaskSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
527
534
|
category?: string | null | undefined;
|
|
528
535
|
}[] | null | undefined;
|
|
529
536
|
title?: string | undefined;
|
|
530
|
-
description?: string | undefined;
|
|
531
537
|
priority?: "low" | "medium" | "high" | undefined;
|
|
532
538
|
} | undefined;
|
|
533
539
|
auto_fallbacks?: {
|
|
@@ -541,6 +547,7 @@ export declare const zTaskSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
541
547
|
ref?: any;
|
|
542
548
|
} | undefined;
|
|
543
549
|
create_handoff_task?: {
|
|
550
|
+
description?: string | undefined;
|
|
544
551
|
tags?: {
|
|
545
552
|
name: string;
|
|
546
553
|
hidden: boolean;
|
|
@@ -549,7 +556,6 @@ export declare const zTaskSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
549
556
|
category?: string | null | undefined;
|
|
550
557
|
}[] | null | undefined;
|
|
551
558
|
title?: string | undefined;
|
|
552
|
-
description?: string | undefined;
|
|
553
559
|
priority?: "low" | "medium" | "high" | undefined;
|
|
554
560
|
} | undefined;
|
|
555
561
|
auto_fallbacks?: {
|
|
@@ -638,13 +644,16 @@ export declare const zTaskSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
638
644
|
type: z.ZodEnum<["crm_lead", "med_patient", "med_professional", "med_appointment", "chat_contact"]>;
|
|
639
645
|
id: z.ZodString;
|
|
640
646
|
label: z.ZodOptional<z.ZodString>;
|
|
647
|
+
ref: z.ZodOptional<z.ZodAny>;
|
|
641
648
|
}, "strip", z.ZodTypeAny, {
|
|
642
649
|
id: string;
|
|
643
650
|
type: "crm_lead" | "med_patient" | "med_professional" | "med_appointment" | "chat_contact";
|
|
651
|
+
ref?: any;
|
|
644
652
|
label?: string | undefined;
|
|
645
653
|
}, {
|
|
646
654
|
id: string;
|
|
647
655
|
type: "crm_lead" | "med_patient" | "med_professional" | "med_appointment" | "chat_contact";
|
|
656
|
+
ref?: any;
|
|
648
657
|
label?: string | undefined;
|
|
649
658
|
}>, "many">>;
|
|
650
659
|
idempotency_key: z.ZodOptional<z.ZodString>;
|
|
@@ -780,6 +789,7 @@ export declare const zTaskSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
780
789
|
category?: string | null | undefined;
|
|
781
790
|
}>, "many">>>;
|
|
782
791
|
}, "strip", z.ZodTypeAny, {
|
|
792
|
+
description?: string | undefined;
|
|
783
793
|
tags?: {
|
|
784
794
|
name: string;
|
|
785
795
|
hidden: boolean;
|
|
@@ -788,9 +798,9 @@ export declare const zTaskSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
788
798
|
category?: string | null | undefined;
|
|
789
799
|
}[] | null | undefined;
|
|
790
800
|
title?: string | undefined;
|
|
791
|
-
description?: string | undefined;
|
|
792
801
|
priority?: "low" | "medium" | "high" | undefined;
|
|
793
802
|
}, {
|
|
803
|
+
description?: string | undefined;
|
|
794
804
|
tags?: {
|
|
795
805
|
name: string;
|
|
796
806
|
hidden: boolean;
|
|
@@ -799,7 +809,6 @@ export declare const zTaskSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
799
809
|
category?: string | null | undefined;
|
|
800
810
|
}[] | null | undefined;
|
|
801
811
|
title?: string | undefined;
|
|
802
|
-
description?: string | undefined;
|
|
803
812
|
priority?: "low" | "medium" | "high" | undefined;
|
|
804
813
|
}>>;
|
|
805
814
|
auto_fallbacks: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -821,6 +830,7 @@ export declare const zTaskSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
821
830
|
ref?: any;
|
|
822
831
|
} | undefined;
|
|
823
832
|
create_handoff_task?: {
|
|
833
|
+
description?: string | undefined;
|
|
824
834
|
tags?: {
|
|
825
835
|
name: string;
|
|
826
836
|
hidden: boolean;
|
|
@@ -829,7 +839,6 @@ export declare const zTaskSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
829
839
|
category?: string | null | undefined;
|
|
830
840
|
}[] | null | undefined;
|
|
831
841
|
title?: string | undefined;
|
|
832
|
-
description?: string | undefined;
|
|
833
842
|
priority?: "low" | "medium" | "high" | undefined;
|
|
834
843
|
} | undefined;
|
|
835
844
|
auto_fallbacks?: {
|
|
@@ -843,6 +852,7 @@ export declare const zTaskSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
843
852
|
ref?: any;
|
|
844
853
|
} | undefined;
|
|
845
854
|
create_handoff_task?: {
|
|
855
|
+
description?: string | undefined;
|
|
846
856
|
tags?: {
|
|
847
857
|
name: string;
|
|
848
858
|
hidden: boolean;
|
|
@@ -851,7 +861,6 @@ export declare const zTaskSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
851
861
|
category?: string | null | undefined;
|
|
852
862
|
}[] | null | undefined;
|
|
853
863
|
title?: string | undefined;
|
|
854
|
-
description?: string | undefined;
|
|
855
864
|
priority?: "low" | "medium" | "high" | undefined;
|
|
856
865
|
} | undefined;
|
|
857
866
|
auto_fallbacks?: {
|
|
@@ -940,13 +949,16 @@ export declare const zTaskSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
940
949
|
type: z.ZodEnum<["crm_lead", "med_patient", "med_professional", "med_appointment", "chat_contact"]>;
|
|
941
950
|
id: z.ZodString;
|
|
942
951
|
label: z.ZodOptional<z.ZodString>;
|
|
952
|
+
ref: z.ZodOptional<z.ZodAny>;
|
|
943
953
|
}, "strip", z.ZodTypeAny, {
|
|
944
954
|
id: string;
|
|
945
955
|
type: "crm_lead" | "med_patient" | "med_professional" | "med_appointment" | "chat_contact";
|
|
956
|
+
ref?: any;
|
|
946
957
|
label?: string | undefined;
|
|
947
958
|
}, {
|
|
948
959
|
id: string;
|
|
949
960
|
type: "crm_lead" | "med_patient" | "med_professional" | "med_appointment" | "chat_contact";
|
|
961
|
+
ref?: any;
|
|
950
962
|
label?: string | undefined;
|
|
951
963
|
}>, "many">>;
|
|
952
964
|
idempotency_key: z.ZodOptional<z.ZodString>;
|
|
@@ -1082,6 +1094,7 @@ export declare const zTaskSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
1082
1094
|
category?: string | null | undefined;
|
|
1083
1095
|
}>, "many">>>;
|
|
1084
1096
|
}, "strip", z.ZodTypeAny, {
|
|
1097
|
+
description?: string | undefined;
|
|
1085
1098
|
tags?: {
|
|
1086
1099
|
name: string;
|
|
1087
1100
|
hidden: boolean;
|
|
@@ -1090,9 +1103,9 @@ export declare const zTaskSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
1090
1103
|
category?: string | null | undefined;
|
|
1091
1104
|
}[] | null | undefined;
|
|
1092
1105
|
title?: string | undefined;
|
|
1093
|
-
description?: string | undefined;
|
|
1094
1106
|
priority?: "low" | "medium" | "high" | undefined;
|
|
1095
1107
|
}, {
|
|
1108
|
+
description?: string | undefined;
|
|
1096
1109
|
tags?: {
|
|
1097
1110
|
name: string;
|
|
1098
1111
|
hidden: boolean;
|
|
@@ -1101,7 +1114,6 @@ export declare const zTaskSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
1101
1114
|
category?: string | null | undefined;
|
|
1102
1115
|
}[] | null | undefined;
|
|
1103
1116
|
title?: string | undefined;
|
|
1104
|
-
description?: string | undefined;
|
|
1105
1117
|
priority?: "low" | "medium" | "high" | undefined;
|
|
1106
1118
|
}>>;
|
|
1107
1119
|
auto_fallbacks: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -1123,6 +1135,7 @@ export declare const zTaskSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
1123
1135
|
ref?: any;
|
|
1124
1136
|
} | undefined;
|
|
1125
1137
|
create_handoff_task?: {
|
|
1138
|
+
description?: string | undefined;
|
|
1126
1139
|
tags?: {
|
|
1127
1140
|
name: string;
|
|
1128
1141
|
hidden: boolean;
|
|
@@ -1131,7 +1144,6 @@ export declare const zTaskSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
1131
1144
|
category?: string | null | undefined;
|
|
1132
1145
|
}[] | null | undefined;
|
|
1133
1146
|
title?: string | undefined;
|
|
1134
|
-
description?: string | undefined;
|
|
1135
1147
|
priority?: "low" | "medium" | "high" | undefined;
|
|
1136
1148
|
} | undefined;
|
|
1137
1149
|
auto_fallbacks?: {
|
|
@@ -1145,6 +1157,7 @@ export declare const zTaskSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
1145
1157
|
ref?: any;
|
|
1146
1158
|
} | undefined;
|
|
1147
1159
|
create_handoff_task?: {
|
|
1160
|
+
description?: string | undefined;
|
|
1148
1161
|
tags?: {
|
|
1149
1162
|
name: string;
|
|
1150
1163
|
hidden: boolean;
|
|
@@ -1153,7 +1166,6 @@ export declare const zTaskSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
1153
1166
|
category?: string | null | undefined;
|
|
1154
1167
|
}[] | null | undefined;
|
|
1155
1168
|
title?: string | undefined;
|
|
1156
|
-
description?: string | undefined;
|
|
1157
1169
|
priority?: "low" | "medium" | "high" | undefined;
|
|
1158
1170
|
} | undefined;
|
|
1159
1171
|
auto_fallbacks?: {
|
|
@@ -47,6 +47,7 @@ exports.zTaskExternalLinkSchema = zod_1.z.object({
|
|
|
47
47
|
type: exports.zTaskExternalObjectTypeSchema,
|
|
48
48
|
id: zod_1.z.string(),
|
|
49
49
|
label: zod_1.z.string().optional(),
|
|
50
|
+
ref: zod_1.z.any().optional(), // FirestoreDocumentReference
|
|
50
51
|
});
|
|
51
52
|
// Schema para ITaskSchedule
|
|
52
53
|
exports.zTaskScheduleSchema = zod_1.z.object({
|
|
@@ -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;
|
|
@@ -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);
|
|
@@ -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,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
|
+
}
|