evo360-types 1.3.804 → 1.3.809

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16,6 +16,10 @@ export declare const zActionArgsSchema: z.ZodObject<{
16
16
  * Schema for RbacPermValue (tri-state permission value)
17
17
  */
18
18
  export declare const zRbacPermValueSchema: z.ZodEnum<["allow", "deny", "forbid"]>;
19
+ /**
20
+ * Schema for PermOverrideValue (per-user override, feat-345)
21
+ */
22
+ export declare const zPermOverrideValueSchema: z.ZodEnum<["allow", "forbid"]>;
19
23
  /**
20
24
  * Schema for TenantUserStatus
21
25
  */
@@ -41,6 +45,7 @@ export declare const zTenantUserSchema: z.ZodObject<{
41
45
  status: z.ZodEnum<["active", "invited", "disabled", "removed"]>;
42
46
  roles: z.ZodArray<z.ZodString, "many">;
43
47
  perms: z.ZodRecord<z.ZodString, z.ZodBoolean>;
48
+ perm_overrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEnum<["allow", "forbid"]>>>;
44
49
  picture_url: z.ZodOptional<z.ZodString>;
45
50
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
46
51
  id: z.ZodString;
@@ -55,6 +60,7 @@ export declare const zTenantUserSchema: z.ZodObject<{
55
60
  status: z.ZodEnum<["active", "invited", "disabled", "removed"]>;
56
61
  roles: z.ZodArray<z.ZodString, "many">;
57
62
  perms: z.ZodRecord<z.ZodString, z.ZodBoolean>;
63
+ perm_overrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEnum<["allow", "forbid"]>>>;
58
64
  picture_url: z.ZodOptional<z.ZodString>;
59
65
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
60
66
  id: z.ZodString;
@@ -69,6 +75,7 @@ export declare const zTenantUserSchema: z.ZodObject<{
69
75
  status: z.ZodEnum<["active", "invited", "disabled", "removed"]>;
70
76
  roles: z.ZodArray<z.ZodString, "many">;
71
77
  perms: z.ZodRecord<z.ZodString, z.ZodBoolean>;
78
+ perm_overrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEnum<["allow", "forbid"]>>>;
72
79
  picture_url: z.ZodOptional<z.ZodString>;
73
80
  }, z.ZodTypeAny, "passthrough">>;
74
81
  /**
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.zNexusClaimsSchema = exports.zNexusModulesSchema = exports.zNexusModuleToolsPermissionsSchema = exports.zNexusModuleFinancePermissionsSchema = exports.zNexusModuleChatPermissionsSchema = exports.zRbacGroupSchema = exports.zRbacPermissionMetadataSchema = exports.zRbacRoleSchema = exports.zRbacRolePermsSchema = exports.zUserTenantIndexSchema = exports.zTenantUserSchema = exports.zUserTenantIndexStatusSchema = exports.zTenantUserStatusSchema = exports.zRbacPermValueSchema = exports.zActionArgsSchema = void 0;
3
+ exports.zNexusClaimsSchema = exports.zNexusModulesSchema = exports.zNexusModuleToolsPermissionsSchema = exports.zNexusModuleFinancePermissionsSchema = exports.zNexusModuleChatPermissionsSchema = exports.zRbacGroupSchema = exports.zRbacPermissionMetadataSchema = exports.zRbacRoleSchema = exports.zRbacRolePermsSchema = exports.zUserTenantIndexSchema = exports.zTenantUserSchema = exports.zUserTenantIndexStatusSchema = exports.zTenantUserStatusSchema = exports.zPermOverrideValueSchema = exports.zRbacPermValueSchema = exports.zActionArgsSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const zod_schemas_1 = require("../shared/zod-schemas");
6
6
  const zod_schemas_2 = require("../evo-tenant/zod-schemas");
@@ -14,6 +14,10 @@ exports.zActionArgsSchema = zod_1.z.object({
14
14
  * Schema for RbacPermValue (tri-state permission value)
15
15
  */
16
16
  exports.zRbacPermValueSchema = zod_1.z.enum(["allow", "deny", "forbid"]);
17
+ /**
18
+ * Schema for PermOverrideValue (per-user override, feat-345)
19
+ */
20
+ exports.zPermOverrideValueSchema = zod_1.z.enum(["allow", "forbid"]);
17
21
  /**
18
22
  * Schema for TenantUserStatus
19
23
  */
@@ -41,6 +45,7 @@ exports.zTenantUserSchema = zod_schemas_1.zFireDocSchema
41
45
  status: exports.zTenantUserStatusSchema,
42
46
  roles: zod_1.z.array(zod_1.z.string()),
43
47
  perms: zod_1.z.record(zod_1.z.boolean()),
48
+ perm_overrides: zod_1.z.record(exports.zPermOverrideValueSchema).optional(),
44
49
  picture_url: zod_1.z.string().optional(),
45
50
  })
46
51
  .passthrough();
@@ -15,6 +15,11 @@ export const zActionArgsSchema = z.object({
15
15
  */
16
16
  export const zRbacPermValueSchema = z.enum(["allow", "deny", "forbid"]);
17
17
 
18
+ /**
19
+ * Schema for PermOverrideValue (per-user override, feat-345)
20
+ */
21
+ export const zPermOverrideValueSchema = z.enum(["allow", "forbid"]);
22
+
18
23
  /**
19
24
  * Schema for TenantUserStatus
20
25
  */
@@ -44,6 +49,7 @@ export const zTenantUserSchema = zFireDocSchema
44
49
  status: zTenantUserStatusSchema,
45
50
  roles: z.array(z.string()),
46
51
  perms: z.record(z.boolean()),
52
+ perm_overrides: z.record(zPermOverrideValueSchema).optional(),
47
53
  picture_url: z.string().optional(),
48
54
  })
49
55
  .passthrough();
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- export declare const zModuleActionSchema: z.ZodEnum<["enable", "disable", "trial", "override"]>;
2
+ export declare const zModuleActionSchema: z.ZodEnum<["enable", "disable", "trial", "override", "configure"]>;
3
3
  export declare const zModuleStepKindSchema: z.ZodEnum<["entitlement", "rbac_group", "rbac_recompute", "contract_allowance", "contract_check", "rollout_check"]>;
4
4
  export declare const zModuleStepStatusSchema: z.ZodEnum<["pending", "noop", "change", "done", "failed", "blocked", "skipped"]>;
5
5
  export declare const zModuleRunModeSchema: z.ZodEnum<["plan", "apply"]>;
@@ -10,13 +10,16 @@ export declare const zModuleChangeParamsSchema: z.ZodObject<{
10
10
  allow_without_contract: z.ZodOptional<z.ZodBoolean>;
11
11
  purge_rbac: z.ZodOptional<z.ZodBoolean>;
12
12
  suspend: z.ZodOptional<z.ZodBoolean>;
13
+ capabilities: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodBoolean, z.ZodNumber, z.ZodString]>>>;
13
14
  }, "strip", z.ZodTypeAny, {
15
+ capabilities?: Record<string, string | number | boolean> | undefined;
14
16
  expires_at?: Date | null | undefined;
15
17
  allow_without_contract?: boolean | undefined;
16
18
  override_until?: Date | null | undefined;
17
19
  purge_rbac?: boolean | undefined;
18
20
  suspend?: boolean | undefined;
19
21
  }, {
22
+ capabilities?: Record<string, string | number | boolean> | undefined;
20
23
  expires_at?: unknown;
21
24
  allow_without_contract?: boolean | undefined;
22
25
  override_until?: unknown;
@@ -27,20 +30,23 @@ export declare const zModuleChangeParamsSchema: z.ZodObject<{
27
30
  export declare const zModuleChangeRequestSchema: z.ZodEffects<z.ZodObject<{
28
31
  tenant: z.ZodString;
29
32
  module: z.ZodEffects<z.ZodString, string, string>;
30
- action: z.ZodEnum<["enable", "disable", "trial", "override"]>;
33
+ action: z.ZodEnum<["enable", "disable", "trial", "override", "configure"]>;
31
34
  params: z.ZodDefault<z.ZodOptional<z.ZodObject<{
32
35
  expires_at: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodDate, Date, unknown>>>;
33
36
  override_until: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodDate, Date, unknown>>>;
34
37
  allow_without_contract: z.ZodOptional<z.ZodBoolean>;
35
38
  purge_rbac: z.ZodOptional<z.ZodBoolean>;
36
39
  suspend: z.ZodOptional<z.ZodBoolean>;
40
+ capabilities: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodBoolean, z.ZodNumber, z.ZodString]>>>;
37
41
  }, "strip", z.ZodTypeAny, {
42
+ capabilities?: Record<string, string | number | boolean> | undefined;
38
43
  expires_at?: Date | null | undefined;
39
44
  allow_without_contract?: boolean | undefined;
40
45
  override_until?: Date | null | undefined;
41
46
  purge_rbac?: boolean | undefined;
42
47
  suspend?: boolean | undefined;
43
48
  }, {
49
+ capabilities?: Record<string, string | number | boolean> | undefined;
44
50
  expires_at?: unknown;
45
51
  allow_without_contract?: boolean | undefined;
46
52
  override_until?: unknown;
@@ -51,6 +57,7 @@ export declare const zModuleChangeRequestSchema: z.ZodEffects<z.ZodObject<{
51
57
  }, "strip", z.ZodTypeAny, {
52
58
  tenant: string;
53
59
  params: {
60
+ capabilities?: Record<string, string | number | boolean> | undefined;
54
61
  expires_at?: Date | null | undefined;
55
62
  allow_without_contract?: boolean | undefined;
56
63
  override_until?: Date | null | undefined;
@@ -58,14 +65,15 @@ export declare const zModuleChangeRequestSchema: z.ZodEffects<z.ZodObject<{
58
65
  suspend?: boolean | undefined;
59
66
  };
60
67
  reason: string;
61
- action: "trial" | "enable" | "disable" | "override";
68
+ action: "trial" | "enable" | "disable" | "override" | "configure";
62
69
  module: string;
63
70
  }, {
64
71
  tenant: string;
65
72
  reason: string;
66
- action: "trial" | "enable" | "disable" | "override";
73
+ action: "trial" | "enable" | "disable" | "override" | "configure";
67
74
  module: string;
68
75
  params?: {
76
+ capabilities?: Record<string, string | number | boolean> | undefined;
69
77
  expires_at?: unknown;
70
78
  allow_without_contract?: boolean | undefined;
71
79
  override_until?: unknown;
@@ -75,6 +83,7 @@ export declare const zModuleChangeRequestSchema: z.ZodEffects<z.ZodObject<{
75
83
  }>, {
76
84
  tenant: string;
77
85
  params: {
86
+ capabilities?: Record<string, string | number | boolean> | undefined;
78
87
  expires_at?: Date | null | undefined;
79
88
  allow_without_contract?: boolean | undefined;
80
89
  override_until?: Date | null | undefined;
@@ -82,14 +91,15 @@ export declare const zModuleChangeRequestSchema: z.ZodEffects<z.ZodObject<{
82
91
  suspend?: boolean | undefined;
83
92
  };
84
93
  reason: string;
85
- action: "trial" | "enable" | "disable" | "override";
94
+ action: "trial" | "enable" | "disable" | "override" | "configure";
86
95
  module: string;
87
96
  }, {
88
97
  tenant: string;
89
98
  reason: string;
90
- action: "trial" | "enable" | "disable" | "override";
99
+ action: "trial" | "enable" | "disable" | "override" | "configure";
91
100
  module: string;
92
101
  params?: {
102
+ capabilities?: Record<string, string | number | boolean> | undefined;
93
103
  expires_at?: unknown;
94
104
  allow_without_contract?: boolean | undefined;
95
105
  override_until?: unknown;
@@ -195,7 +205,7 @@ export declare const zModuleProvisioningRunSchema: z.ZodObject<{
195
205
  } & {
196
206
  tenant: z.ZodString;
197
207
  module: z.ZodString;
198
- action: z.ZodEnum<["enable", "disable", "trial", "override"]>;
208
+ action: z.ZodEnum<["enable", "disable", "trial", "override", "configure"]>;
199
209
  mode: z.ZodEnum<["plan", "apply"]>;
200
210
  status: z.ZodEnum<["planned", "running", "done", "failed", "blocked", "superseded"]>;
201
211
  params: z.ZodObject<{
@@ -204,13 +214,16 @@ export declare const zModuleProvisioningRunSchema: z.ZodObject<{
204
214
  allow_without_contract: z.ZodOptional<z.ZodBoolean>;
205
215
  purge_rbac: z.ZodOptional<z.ZodBoolean>;
206
216
  suspend: z.ZodOptional<z.ZodBoolean>;
217
+ capabilities: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodBoolean, z.ZodNumber, z.ZodString]>>>;
207
218
  }, "strip", z.ZodTypeAny, {
219
+ capabilities?: Record<string, string | number | boolean> | undefined;
208
220
  expires_at?: Date | null | undefined;
209
221
  allow_without_contract?: boolean | undefined;
210
222
  override_until?: Date | null | undefined;
211
223
  purge_rbac?: boolean | undefined;
212
224
  suspend?: boolean | undefined;
213
225
  }, {
226
+ capabilities?: Record<string, string | number | boolean> | undefined;
214
227
  expires_at?: unknown;
215
228
  allow_without_contract?: boolean | undefined;
216
229
  override_until?: unknown;
@@ -275,7 +288,7 @@ export declare const zModuleProvisioningRunSchema: z.ZodObject<{
275
288
  } & {
276
289
  tenant: z.ZodString;
277
290
  module: z.ZodString;
278
- action: z.ZodEnum<["enable", "disable", "trial", "override"]>;
291
+ action: z.ZodEnum<["enable", "disable", "trial", "override", "configure"]>;
279
292
  mode: z.ZodEnum<["plan", "apply"]>;
280
293
  status: z.ZodEnum<["planned", "running", "done", "failed", "blocked", "superseded"]>;
281
294
  params: z.ZodObject<{
@@ -284,13 +297,16 @@ export declare const zModuleProvisioningRunSchema: z.ZodObject<{
284
297
  allow_without_contract: z.ZodOptional<z.ZodBoolean>;
285
298
  purge_rbac: z.ZodOptional<z.ZodBoolean>;
286
299
  suspend: z.ZodOptional<z.ZodBoolean>;
300
+ capabilities: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodBoolean, z.ZodNumber, z.ZodString]>>>;
287
301
  }, "strip", z.ZodTypeAny, {
302
+ capabilities?: Record<string, string | number | boolean> | undefined;
288
303
  expires_at?: Date | null | undefined;
289
304
  allow_without_contract?: boolean | undefined;
290
305
  override_until?: Date | null | undefined;
291
306
  purge_rbac?: boolean | undefined;
292
307
  suspend?: boolean | undefined;
293
308
  }, {
309
+ capabilities?: Record<string, string | number | boolean> | undefined;
294
310
  expires_at?: unknown;
295
311
  allow_without_contract?: boolean | undefined;
296
312
  override_until?: unknown;
@@ -355,7 +371,7 @@ export declare const zModuleProvisioningRunSchema: z.ZodObject<{
355
371
  } & {
356
372
  tenant: z.ZodString;
357
373
  module: z.ZodString;
358
- action: z.ZodEnum<["enable", "disable", "trial", "override"]>;
374
+ action: z.ZodEnum<["enable", "disable", "trial", "override", "configure"]>;
359
375
  mode: z.ZodEnum<["plan", "apply"]>;
360
376
  status: z.ZodEnum<["planned", "running", "done", "failed", "blocked", "superseded"]>;
361
377
  params: z.ZodObject<{
@@ -364,13 +380,16 @@ export declare const zModuleProvisioningRunSchema: z.ZodObject<{
364
380
  allow_without_contract: z.ZodOptional<z.ZodBoolean>;
365
381
  purge_rbac: z.ZodOptional<z.ZodBoolean>;
366
382
  suspend: z.ZodOptional<z.ZodBoolean>;
383
+ capabilities: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodBoolean, z.ZodNumber, z.ZodString]>>>;
367
384
  }, "strip", z.ZodTypeAny, {
385
+ capabilities?: Record<string, string | number | boolean> | undefined;
368
386
  expires_at?: Date | null | undefined;
369
387
  allow_without_contract?: boolean | undefined;
370
388
  override_until?: Date | null | undefined;
371
389
  purge_rbac?: boolean | undefined;
372
390
  suspend?: boolean | undefined;
373
391
  }, {
392
+ capabilities?: Record<string, string | number | boolean> | undefined;
374
393
  expires_at?: unknown;
375
394
  allow_without_contract?: boolean | undefined;
376
395
  override_until?: unknown;
@@ -11,7 +11,7 @@ const catalog_1 = require("../../types/evo-modules/catalog");
11
11
  // `types/evo-modules/index.ts`. As listas são à mão: manter os dois lados
12
12
  // sincronizados (o teste do catálogo confere).
13
13
  // ======================================================
14
- exports.zModuleActionSchema = zod_1.z.enum(["enable", "disable", "trial", "override"]);
14
+ exports.zModuleActionSchema = zod_1.z.enum(["enable", "disable", "trial", "override", "configure"]);
15
15
  exports.zModuleStepKindSchema = zod_1.z.enum([
16
16
  "entitlement",
17
17
  "rbac_group",
@@ -44,6 +44,7 @@ exports.zModuleChangeParamsSchema = zod_1.z.object({
44
44
  allow_without_contract: zod_1.z.boolean().optional(),
45
45
  purge_rbac: zod_1.z.boolean().optional(),
46
46
  suspend: zod_1.z.boolean().optional(),
47
+ capabilities: zod_1.z.record(zod_1.z.union([zod_1.z.boolean(), zod_1.z.number(), zod_1.z.string()])).optional(),
47
48
  });
48
49
  const zModuleKeyInCatalog = zod_1.z
49
50
  .string()
@@ -78,6 +79,32 @@ exports.zModuleChangeRequestSchema = zod_1.z
78
79
  ctx.addIssue({ code: zod_1.z.ZodIssueCode.custom, path: ["params", "override_until"], message: "params.override_until must be in the future" });
79
80
  }
80
81
  }
82
+ if (req.action === "configure") {
83
+ const caps = req.params.capabilities;
84
+ const keys = caps ? Object.keys(caps) : [];
85
+ if (!caps || keys.length === 0) {
86
+ ctx.addIssue({ code: zod_1.z.ZodIssueCode.custom, path: ["params", "capabilities"], message: "configure requires at least one capability" });
87
+ return;
88
+ }
89
+ const def = (0, catalog_1.getModuleDefinition)(req.module);
90
+ if (!def)
91
+ return; // `module` já falhou no refine do catálogo
92
+ for (let i = 0; i < keys.length; i++) {
93
+ const key = keys[i];
94
+ const known = def.capabilities[key];
95
+ if (!known) {
96
+ ctx.addIssue({ code: zod_1.z.ZodIssueCode.custom, path: ["params", "capabilities", key], message: `capability '${key}' is not in the catalog of '${def.key}'` });
97
+ continue;
98
+ }
99
+ const value = caps[key];
100
+ if (typeof value !== typeof known.default) {
101
+ ctx.addIssue({ code: zod_1.z.ZodIssueCode.custom, path: ["params", "capabilities", key], message: `capability '${key}' must be ${typeof known.default}` });
102
+ }
103
+ else if (typeof value === "number" && (!isFinite(value) || value < 0 || Math.floor(value) !== value)) {
104
+ ctx.addIssue({ code: zod_1.z.ZodIssueCode.custom, path: ["params", "capabilities", key], message: `capability '${key}' must be a non-negative integer` });
105
+ }
106
+ }
107
+ }
81
108
  });
82
109
  /** Body de `nex_tenants-applyModuleChange`: exatamente um de `plan_run_id` / `resume_run_id`. */
83
110
  exports.zModuleApplyRequestSchema = zod_1.z
@@ -10,7 +10,7 @@ import { getModuleDefinition } from "../../types/evo-modules/catalog";
10
10
  // sincronizados (o teste do catálogo confere).
11
11
  // ======================================================
12
12
 
13
- export const zModuleActionSchema = z.enum(["enable", "disable", "trial", "override"]);
13
+ export const zModuleActionSchema = z.enum(["enable", "disable", "trial", "override", "configure"]);
14
14
 
15
15
  export const zModuleStepKindSchema = z.enum([
16
16
  "entitlement",
@@ -48,6 +48,7 @@ export const zModuleChangeParamsSchema = z.object({
48
48
  allow_without_contract: z.boolean().optional(),
49
49
  purge_rbac: z.boolean().optional(),
50
50
  suspend: z.boolean().optional(),
51
+ capabilities: z.record(z.union([z.boolean(), z.number(), z.string()])).optional(),
51
52
  });
52
53
 
53
54
  const zModuleKeyInCatalog = z
@@ -82,6 +83,30 @@ export const zModuleChangeRequestSchema = z
82
83
  ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["params", "override_until"], message: "params.override_until must be in the future" });
83
84
  }
84
85
  }
86
+ if (req.action === "configure") {
87
+ const caps = req.params.capabilities;
88
+ const keys = caps ? Object.keys(caps) : [];
89
+ if (!caps || keys.length === 0) {
90
+ ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["params", "capabilities"], message: "configure requires at least one capability" });
91
+ return;
92
+ }
93
+ const def = getModuleDefinition(req.module);
94
+ if (!def) return; // `module` já falhou no refine do catálogo
95
+ for (let i = 0; i < keys.length; i++) {
96
+ const key = keys[i];
97
+ const known = def.capabilities[key];
98
+ if (!known) {
99
+ ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["params", "capabilities", key], message: `capability '${key}' is not in the catalog of '${def.key}'` });
100
+ continue;
101
+ }
102
+ const value = caps[key];
103
+ if (typeof value !== typeof known.default) {
104
+ ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["params", "capabilities", key], message: `capability '${key}' must be ${typeof known.default}` });
105
+ } else if (typeof value === "number" && (!isFinite(value) || value < 0 || Math.floor(value) !== value)) {
106
+ ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["params", "capabilities", key], message: `capability '${key}' must be a non-negative integer` });
107
+ }
108
+ }
109
+ }
85
110
  });
86
111
 
87
112
  /** Body de `nex_tenants-applyModuleChange`: exatamente um de `plan_run_id` / `resume_run_id`. */
@@ -21,6 +21,19 @@ export declare const RbacPermValueEnum: {
21
21
  readonly Forbid: "forbid";
22
22
  };
23
23
  export type RbacPermValue = (typeof RbacPermValueEnum)[keyof typeof RbacPermValueEnum];
24
+ /**
25
+ * Per-user permission override value (feat-345).
26
+ * Applied by the materializer AFTER the roles:
27
+ * - 'allow': the permission is granted even if no role grants it
28
+ * - 'forbid': the permission is removed even if a role grants it
29
+ * Absent key = inherit from roles (there is no 'deny' here).
30
+ */
31
+ export declare const PermOverrideValueEnum: {
32
+ readonly Allow: "allow";
33
+ readonly Forbid: "forbid";
34
+ };
35
+ export type PermOverrideValue = Extract<RbacPermValue, (typeof PermOverrideValueEnum)[keyof typeof PermOverrideValueEnum]>;
36
+ export declare const PERM_OVERRIDE_VALUES: readonly PermOverrideValue[];
24
37
  /**
25
38
  * Membership status for a user in a tenant.
26
39
  */
@@ -71,6 +84,16 @@ export interface ITenantUser extends IFireDoc {
71
84
  perms: {
72
85
  [permissionKey: string]: boolean;
73
86
  };
87
+ /**
88
+ * Per-user permission overrides (feat-345). INPUT field, next to `roles`:
89
+ * the materializer applies them on top of the roles and writes the result
90
+ * into `perms`, so they survive every recompute. Only the
91
+ * `core_tenant_users-setPermOverrides` callable writes this field.
92
+ * Absent = `{}`.
93
+ */
94
+ perm_overrides?: {
95
+ [permissionKey: string]: PermOverrideValue;
96
+ };
74
97
  /**
75
98
  * User picture URL.
76
99
  */
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.UserTenantIndexStatusEnum = exports.TenantUserStatusEnum = exports.RbacPermValueEnum = exports.CoreRbacPermissions = void 0;
17
+ exports.UserTenantIndexStatusEnum = exports.TenantUserStatusEnum = exports.PERM_OVERRIDE_VALUES = exports.PermOverrideValueEnum = exports.RbacPermValueEnum = exports.CoreRbacPermissions = void 0;
18
18
  __exportStar(require("./fb_collections"), exports);
19
19
  // Permissões para o core rbac
20
20
  exports.CoreRbacPermissions = {
@@ -36,6 +36,21 @@ exports.RbacPermValueEnum = {
36
36
  Deny: "deny",
37
37
  Forbid: "forbid",
38
38
  };
39
+ /**
40
+ * Per-user permission override value (feat-345).
41
+ * Applied by the materializer AFTER the roles:
42
+ * - 'allow': the permission is granted even if no role grants it
43
+ * - 'forbid': the permission is removed even if a role grants it
44
+ * Absent key = inherit from roles (there is no 'deny' here).
45
+ */
46
+ exports.PermOverrideValueEnum = {
47
+ Allow: "allow",
48
+ Forbid: "forbid",
49
+ };
50
+ exports.PERM_OVERRIDE_VALUES = [
51
+ exports.PermOverrideValueEnum.Allow,
52
+ exports.PermOverrideValueEnum.Forbid,
53
+ ];
39
54
  /**
40
55
  * Membership status for a user in a tenant.
41
56
  */
@@ -30,6 +30,26 @@ export const RbacPermValueEnum = {
30
30
  export type RbacPermValue =
31
31
  (typeof RbacPermValueEnum)[keyof typeof RbacPermValueEnum];
32
32
 
33
+ /**
34
+ * Per-user permission override value (feat-345).
35
+ * Applied by the materializer AFTER the roles:
36
+ * - 'allow': the permission is granted even if no role grants it
37
+ * - 'forbid': the permission is removed even if a role grants it
38
+ * Absent key = inherit from roles (there is no 'deny' here).
39
+ */
40
+ export const PermOverrideValueEnum = {
41
+ Allow: "allow",
42
+ Forbid: "forbid",
43
+ } as const;
44
+ export type PermOverrideValue = Extract<
45
+ RbacPermValue,
46
+ (typeof PermOverrideValueEnum)[keyof typeof PermOverrideValueEnum]
47
+ >;
48
+ export const PERM_OVERRIDE_VALUES: readonly PermOverrideValue[] = [
49
+ PermOverrideValueEnum.Allow,
50
+ PermOverrideValueEnum.Forbid,
51
+ ] as const;
52
+
33
53
  /**
34
54
  * Membership status for a user in a tenant.
35
55
  */
@@ -91,6 +111,17 @@ export interface ITenantUser extends IFireDoc {
91
111
  [permissionKey: string]: boolean;
92
112
  };
93
113
 
114
+ /**
115
+ * Per-user permission overrides (feat-345). INPUT field, next to `roles`:
116
+ * the materializer applies them on top of the roles and writes the result
117
+ * into `perms`, so they survive every recompute. Only the
118
+ * `core_tenant_users-setPermOverrides` callable writes this field.
119
+ * Absent = `{}`.
120
+ */
121
+ perm_overrides?: {
122
+ [permissionKey: string]: PermOverrideValue;
123
+ };
124
+
94
125
  /**
95
126
  * User picture URL.
96
127
  */
@@ -29,7 +29,7 @@ export interface IRoutineAllowanceCheck {
29
29
  adding: number;
30
30
  /** `active_now + adding`. */
31
31
  active_after: number;
32
- /** `applies && active_after > included`: a tela mostra o aviso. */
32
+ /** `applies && adding > 0 && active_after > included`: a tela mostra o aviso. */
33
33
  exceeds: boolean;
34
34
  /** Quanto a ativação acrescenta à cobrança deste mês (pode ser 0 se o pico já estava acima). */
35
35
  extra_this_month: number;
@@ -30,7 +30,7 @@ export interface IRoutineAllowanceCheck {
30
30
  adding: number;
31
31
  /** `active_now + adding`. */
32
32
  active_after: number;
33
- /** `applies && active_after > included`: a tela mostra o aviso. */
33
+ /** `applies && adding > 0 && active_after > included`: a tela mostra o aviso. */
34
34
  exceeds: boolean;
35
35
  /** Quanto a ativação acrescenta à cobrança deste mês (pode ser 0 se o pico já estava acima). */
36
36
  extra_this_month: number;
@@ -11,12 +11,17 @@ export declare const MODULES_ROLLOUT_PLATFORM_PATH = "platform/evo-modules/rollo
11
11
  export declare const MODULES_LOCK_TTL_MS: number;
12
12
  /** Regex da chave de módulo (`tenants/{t}.modules[key]`). */
13
13
  export declare const MODULE_KEY_PATTERN: RegExp;
14
- export type ModuleAction = "enable" | "disable" | "trial" | "override";
14
+ /**
15
+ * `configure` (F4): muda capabilities de um módulo JÁ ativo (`params.capabilities`),
16
+ * sem tocar status, contrato, RBAC nem rollout. Só o passo `entitlement`.
17
+ */
18
+ export type ModuleAction = "enable" | "disable" | "trial" | "override" | "configure";
15
19
  export declare const ModuleActionEnum: {
16
20
  readonly Enable: "enable";
17
21
  readonly Disable: "disable";
18
22
  readonly Trial: "trial";
19
23
  readonly Override: "override";
24
+ readonly Configure: "configure";
20
25
  };
21
26
  export type ModuleStepKind = "entitlement" | "rbac_group" | "rbac_recompute" | "contract_allowance" | "contract_check" | "rollout_check";
22
27
  export declare const ModuleStepKindEnum: {
@@ -102,6 +107,11 @@ export interface IModuleChangeParams {
102
107
  purge_rbac?: boolean;
103
108
  /** `disable`: grava `suspended` em vez de `cancelled`. */
104
109
  suspend?: boolean;
110
+ /**
111
+ * `configure`: obrigatório. Capabilities a gravar (merge raso sobre as atuais);
112
+ * só chaves do catálogo do módulo, com o mesmo tipo do `default`.
113
+ */
114
+ capabilities?: Record<string, boolean | number | string>;
105
115
  }
106
116
  export interface IModuleRunActor extends IEntitlementAuditActor {
107
117
  login_id?: string;
@@ -56,6 +56,7 @@ exports.ModuleActionEnum = {
56
56
  Disable: "disable",
57
57
  Trial: "trial",
58
58
  Override: "override",
59
+ Configure: "configure",
59
60
  };
60
61
  exports.ModuleStepKindEnum = {
61
62
  Entitlement: "entitlement",
@@ -49,12 +49,17 @@ export const MODULES_LOCK_TTL_MS = 10 * 60 * 1000;
49
49
  /** Regex da chave de módulo (`tenants/{t}.modules[key]`). */
50
50
  export const MODULE_KEY_PATTERN = /^[a-z][a-z0-9_]{1,40}$/;
51
51
 
52
- export type ModuleAction = "enable" | "disable" | "trial" | "override";
52
+ /**
53
+ * `configure` (F4): muda capabilities de um módulo JÁ ativo (`params.capabilities`),
54
+ * sem tocar status, contrato, RBAC nem rollout. Só o passo `entitlement`.
55
+ */
56
+ export type ModuleAction = "enable" | "disable" | "trial" | "override" | "configure";
53
57
  export const ModuleActionEnum = {
54
58
  Enable: "enable",
55
59
  Disable: "disable",
56
60
  Trial: "trial",
57
61
  Override: "override",
62
+ Configure: "configure",
58
63
  } as const;
59
64
 
60
65
  export type ModuleStepKind =
@@ -173,6 +178,11 @@ export interface IModuleChangeParams {
173
178
  purge_rbac?: boolean;
174
179
  /** `disable`: grava `suspended` em vez de `cancelled`. */
175
180
  suspend?: boolean;
181
+ /**
182
+ * `configure`: obrigatório. Capabilities a gravar (merge raso sobre as atuais);
183
+ * só chaves do catálogo do módulo, com o mesmo tipo do `default`.
184
+ */
185
+ capabilities?: Record<string, boolean | number | string>;
176
186
  }
177
187
 
178
188
  export interface IModuleRunActor extends IEntitlementAuditActor {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "evo360-types",
3
- "version": "1.3.804",
3
+ "version": "1.3.809",
4
4
  "description": "HREVO360 Shared Types",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",