evo360-types 1.3.656 → 1.3.659
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-csq/zod-schemas.d.ts +32 -32
- package/dist/apps/evo-modules/zod-schemas.d.ts +446 -0
- package/dist/apps/evo-modules/zod-schemas.js +143 -0
- package/dist/apps/evo-modules/zod-schemas.ts +153 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/index.ts +2 -0
- package/dist/types/evo-modules/activation.d.ts +46 -0
- package/dist/types/evo-modules/activation.js +131 -0
- package/dist/types/evo-modules/activation.ts +150 -0
- package/dist/types/evo-modules/catalog.d.ts +28 -0
- package/dist/types/evo-modules/catalog.js +130 -0
- package/dist/types/evo-modules/catalog.ts +131 -0
- package/dist/types/evo-modules/index.d.ts +227 -0
- package/dist/types/evo-modules/index.js +75 -0
- package/dist/types/evo-modules/index.ts +329 -0
- package/dist/types/evo-telemedicine/fb_collections.js +1 -1
- package/dist/types/evo-telemedicine/fb_collections.ts +1 -1
- package/dist/types/evo-telemedicine/index.d.ts +8 -12
- package/dist/types/evo-telemedicine/index.ts +8 -12
- package/dist/types/evo-tenant/index.ts +3 -1
- package/fixtures/tenant-modules/is-module-active.parity.json +364 -0
- package/package.json +7 -4
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import type { IPlatformModuleDefinition } from "./index";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Versão do catálogo, gravada em `IModuleProvisioningRun.types_version`.
|
|
5
|
+
* Mudou capability, passo, grupo ou métrica de algum módulo ⇒ incrementar: o
|
|
6
|
+
* run antigo precisa dizer com que catálogo foi planejado.
|
|
7
|
+
*/
|
|
8
|
+
export const PLATFORM_MODULE_CATALOG_VERSION = "2026-10-06.1";
|
|
9
|
+
|
|
10
|
+
export const PLATFORM_MODULE_TELEMEDICINE = "telemedicine";
|
|
11
|
+
export const PLATFORM_MODULE_CSQ = "csq";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Catálogo de módulos da plataforma (feat-263). É código, não Firestore: carrega
|
|
15
|
+
* comportamento (passos, grupos, métricas) e precisa de versionamento e tipos.
|
|
16
|
+
*
|
|
17
|
+
* Módulo novo = uma entrada aqui + publish. O estado por tenant continua em
|
|
18
|
+
* `tenants/{t}.modules[key]`.
|
|
19
|
+
*/
|
|
20
|
+
export const PLATFORM_MODULE_CATALOG: Readonly<Record<string, IPlatformModuleDefinition>> = {
|
|
21
|
+
telemedicine: {
|
|
22
|
+
key: PLATFORM_MODULE_TELEMEDICINE,
|
|
23
|
+
label: "Virtual Care (Telemedicina)",
|
|
24
|
+
description:
|
|
25
|
+
"Teleconsultas por vídeo integradas à agenda, com gravação e admissão automática.",
|
|
26
|
+
app_id: "evo-telemedicine",
|
|
27
|
+
// Defaults idênticos ao `TELEMEDICINE_DEFAULT_CAPABILITIES` da R5 (feat-160):
|
|
28
|
+
// transcrição NUNCA nasce ligada (gate documental D12).
|
|
29
|
+
capabilities: {
|
|
30
|
+
recording: { label: "Gravação", default: true },
|
|
31
|
+
transcription: { label: "Transcrição", default: false },
|
|
32
|
+
auto_admit: { label: "Admissão automática", default: true },
|
|
33
|
+
},
|
|
34
|
+
// `active/contract` sem `expires_at`: a franquia faz parte do contrato; um
|
|
35
|
+
// `expires_at` desligaria a base inteira numa data, em silêncio.
|
|
36
|
+
default_entitlement: { status: "active", source: "contract" },
|
|
37
|
+
default_for_new_tenants: true,
|
|
38
|
+
rbac_groups: ["evo-telemedicine"],
|
|
39
|
+
allowance_metrics: [{ metric: "teleconsultations_unrecorded", default_included: 5 }],
|
|
40
|
+
rollout: {
|
|
41
|
+
path: "platform/evo-telemedicine/config/rollout",
|
|
42
|
+
layout: "legacy_fields",
|
|
43
|
+
flags: {
|
|
44
|
+
create: "create_enabled",
|
|
45
|
+
join: "join_enabled",
|
|
46
|
+
recording: "recording_enabled",
|
|
47
|
+
transcription: "transcription_enabled",
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
depends_on: [],
|
|
51
|
+
provisioning: {
|
|
52
|
+
enable: ["entitlement", "rbac_group", "rbac_recompute", "contract_allowance", "rollout_check"],
|
|
53
|
+
// O grupo RBAC fica no disable (Q7): o upsell depende de `evo_telemedicine_read`.
|
|
54
|
+
disable: ["entitlement", "contract_check"],
|
|
55
|
+
},
|
|
56
|
+
legacy: { audit_collections: ["apps/evo-telemedicine/entitlement-audit"] },
|
|
57
|
+
},
|
|
58
|
+
csq: {
|
|
59
|
+
key: PLATFORM_MODULE_CSQ,
|
|
60
|
+
label: "CSQ — Qualidade do atendimento",
|
|
61
|
+
description:
|
|
62
|
+
"Avaliação automática da qualidade das conversas encerradas (laudo por ticket).",
|
|
63
|
+
app_id: "evo-csq",
|
|
64
|
+
capabilities: {},
|
|
65
|
+
default_entitlement: { status: "active", source: "manual" },
|
|
66
|
+
default_for_new_tenants: false,
|
|
67
|
+
rbac_groups: [],
|
|
68
|
+
allowance_metrics: [],
|
|
69
|
+
rollout: null,
|
|
70
|
+
depends_on: [],
|
|
71
|
+
provisioning: {
|
|
72
|
+
enable: ["entitlement"],
|
|
73
|
+
disable: ["entitlement"],
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export function getModuleDefinition(key: string | null | undefined): IPlatformModuleDefinition | null {
|
|
79
|
+
if (!key || typeof key !== "string") return null;
|
|
80
|
+
if (!Object.prototype.hasOwnProperty.call(PLATFORM_MODULE_CATALOG, key)) return null;
|
|
81
|
+
return PLATFORM_MODULE_CATALOG[key];
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** Definições em ordem estável (ordem de declaração). */
|
|
85
|
+
export function listModuleDefinitions(): IPlatformModuleDefinition[] {
|
|
86
|
+
const out: IPlatformModuleDefinition[] = [];
|
|
87
|
+
for (const key in PLATFORM_MODULE_CATALOG) {
|
|
88
|
+
if (Object.prototype.hasOwnProperty.call(PLATFORM_MODULE_CATALOG, key)) {
|
|
89
|
+
out.push(PLATFORM_MODULE_CATALOG[key]);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return out;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** Chaves do catálogo em ordem de declaração. */
|
|
96
|
+
export function listModuleKeys(): string[] {
|
|
97
|
+
const out: string[] = [];
|
|
98
|
+
for (const key in PLATFORM_MODULE_CATALOG) {
|
|
99
|
+
if (Object.prototype.hasOwnProperty.call(PLATFORM_MODULE_CATALOG, key)) out.push(key);
|
|
100
|
+
}
|
|
101
|
+
return out;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** Capabilities default do módulo (mapa novo a cada chamada). */
|
|
105
|
+
export function buildModuleDefaultCapabilities(
|
|
106
|
+
definition: IPlatformModuleDefinition,
|
|
107
|
+
): Record<string, boolean | number | string> {
|
|
108
|
+
const out: Record<string, boolean | number | string> = {};
|
|
109
|
+
for (const cap in definition.capabilities) {
|
|
110
|
+
if (Object.prototype.hasOwnProperty.call(definition.capabilities, cap)) {
|
|
111
|
+
out[cap] = definition.capabilities[cap].default;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return out;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** Módulos que tenant novo recebe habilitados. */
|
|
118
|
+
export function listDefaultModulesForNewTenants(): IPlatformModuleDefinition[] {
|
|
119
|
+
return listModuleDefinitions().filter((d) => d.default_for_new_tenants);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/** União, sem repetição e em ordem, dos grupos RBAC dos módulos default de tenant novo. */
|
|
123
|
+
export function listDefaultTenantRbacGroups(): string[] {
|
|
124
|
+
const out: string[] = [];
|
|
125
|
+
for (const def of listDefaultModulesForNewTenants()) {
|
|
126
|
+
for (const g of def.rbac_groups) {
|
|
127
|
+
if (out.indexOf(g) === -1) out.push(g);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return out;
|
|
131
|
+
}
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import type { IFireDoc, IFireGlobalDoc } from "../shared";
|
|
2
|
+
import type { ITenantModuleEntitlement, TenantModuleSource, TenantModuleStatus } from "../evo-tenant";
|
|
3
|
+
import type { EntitlementAuditAction, IEntitlementAuditActor } from "../evo-telemedicine";
|
|
4
|
+
export * from "./catalog";
|
|
5
|
+
export * from "./activation";
|
|
6
|
+
export declare const EVO_MODULES_APP = "evo-modules";
|
|
7
|
+
export declare const MODULES_ENTITLEMENT_AUDIT_COLLECTION = "entitlement-audit";
|
|
8
|
+
export declare const MODULES_PROVISIONING_COLLECTION = "provisioning";
|
|
9
|
+
export declare const MODULES_ROLLOUT_PLATFORM_PATH = "platform/evo-modules/rollout";
|
|
10
|
+
/** TTL do lock por tenant+módulo durante um apply. */
|
|
11
|
+
export declare const MODULES_LOCK_TTL_MS: number;
|
|
12
|
+
/** Regex da chave de módulo (`tenants/{t}.modules[key]`). */
|
|
13
|
+
export declare const MODULE_KEY_PATTERN: RegExp;
|
|
14
|
+
export type ModuleAction = "enable" | "disable" | "trial" | "override";
|
|
15
|
+
export declare const ModuleActionEnum: {
|
|
16
|
+
readonly Enable: "enable";
|
|
17
|
+
readonly Disable: "disable";
|
|
18
|
+
readonly Trial: "trial";
|
|
19
|
+
readonly Override: "override";
|
|
20
|
+
};
|
|
21
|
+
export type ModuleStepKind = "entitlement" | "rbac_group" | "rbac_recompute" | "contract_allowance" | "contract_check" | "rollout_check";
|
|
22
|
+
export declare const ModuleStepKindEnum: {
|
|
23
|
+
readonly Entitlement: "entitlement";
|
|
24
|
+
readonly RbacGroup: "rbac_group";
|
|
25
|
+
readonly RbacRecompute: "rbac_recompute";
|
|
26
|
+
readonly ContractAllowance: "contract_allowance";
|
|
27
|
+
readonly ContractCheck: "contract_check";
|
|
28
|
+
readonly RolloutCheck: "rollout_check";
|
|
29
|
+
};
|
|
30
|
+
export declare const MODULE_STEP_KINDS: readonly ModuleStepKind[];
|
|
31
|
+
export interface IModuleRolloutDescriptor {
|
|
32
|
+
/** Path completo do doc (4 segmentos: `platform/<app>/<col>/<doc>`). */
|
|
33
|
+
path: string;
|
|
34
|
+
/**
|
|
35
|
+
* `flags_map`: doc genérico `{ flags: { [flag]: boolean }, emergency_kill }`.
|
|
36
|
+
* `legacy_fields`: doc com um campo booleano por flag (telemedicina).
|
|
37
|
+
*/
|
|
38
|
+
layout: "flags_map" | "legacy_fields";
|
|
39
|
+
/** flag -> campo do doc (`legacy_fields`) ou chave em `flags` (`flags_map`). */
|
|
40
|
+
flags: Record<string, string>;
|
|
41
|
+
}
|
|
42
|
+
export interface IModuleCapabilityDefinition {
|
|
43
|
+
label: string;
|
|
44
|
+
default: boolean | number | string;
|
|
45
|
+
}
|
|
46
|
+
export interface IModuleAllowanceMetric {
|
|
47
|
+
/** Chave de `NexFinopsMetricCatalog`. */
|
|
48
|
+
metric: string;
|
|
49
|
+
/** Gravado no contrato vigente quando a chave está ausente (Q6). */
|
|
50
|
+
default_included: number;
|
|
51
|
+
}
|
|
52
|
+
export interface IPlatformModuleDefinition {
|
|
53
|
+
/** `MODULE_KEY_PATTERN`; é a chave em `tenants/{t}.modules`. */
|
|
54
|
+
key: string;
|
|
55
|
+
label: string;
|
|
56
|
+
description?: string;
|
|
57
|
+
/** App do Firestore onde vivem os dados do módulo (`evo-telemedicine`, `evo-csq`). */
|
|
58
|
+
app_id: string;
|
|
59
|
+
capabilities: Record<string, IModuleCapabilityDefinition>;
|
|
60
|
+
/** Status/origem gravados no `enable` de um tenant sem entitlement. */
|
|
61
|
+
default_entitlement: {
|
|
62
|
+
status: TenantModuleStatus;
|
|
63
|
+
source: TenantModuleSource;
|
|
64
|
+
};
|
|
65
|
+
/** Tenant novo nasce com o módulo (`createTenant`). */
|
|
66
|
+
default_for_new_tenants: boolean;
|
|
67
|
+
/** Grupos RBAC globais que tornam os papéis do módulo atribuíveis. */
|
|
68
|
+
rbac_groups: string[];
|
|
69
|
+
allowance_metrics: IModuleAllowanceMetric[];
|
|
70
|
+
rollout: IModuleRolloutDescriptor | null;
|
|
71
|
+
depends_on: string[];
|
|
72
|
+
provisioning: {
|
|
73
|
+
enable: ModuleStepKind[];
|
|
74
|
+
disable: ModuleStepKind[];
|
|
75
|
+
};
|
|
76
|
+
legacy?: {
|
|
77
|
+
/** Trilhas antigas (relativas a `tenants/{t}/`), lidas pelo histórico e nunca escritas. */
|
|
78
|
+
audit_collections?: string[];
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
export type ModuleStepStatus = "pending" | "noop" | "change" | "done" | "failed" | "blocked" | "skipped";
|
|
82
|
+
export interface IModuleProvisioningStep {
|
|
83
|
+
kind: ModuleStepKind;
|
|
84
|
+
status: ModuleStepStatus;
|
|
85
|
+
summary: string;
|
|
86
|
+
before?: unknown;
|
|
87
|
+
after?: unknown;
|
|
88
|
+
error?: string | null;
|
|
89
|
+
started_at?: Date | null;
|
|
90
|
+
finished_at?: Date | null;
|
|
91
|
+
}
|
|
92
|
+
export type ModuleRunMode = "plan" | "apply";
|
|
93
|
+
export type ModuleRunStatus = "planned" | "running" | "done" | "failed" | "blocked" | "superseded";
|
|
94
|
+
export interface IModuleChangeParams {
|
|
95
|
+
/** `trial`: obrigatório. */
|
|
96
|
+
expires_at?: Date | null;
|
|
97
|
+
/** `override`: obrigatório. */
|
|
98
|
+
override_until?: Date | null;
|
|
99
|
+
/** `enable`: libera o passo `contract_allowance` quando ele vem `blocked` (Q6). */
|
|
100
|
+
allow_without_contract?: boolean;
|
|
101
|
+
/** `disable`: remove o grupo RBAC se nenhum outro módulo ativo o declara (Q7). */
|
|
102
|
+
purge_rbac?: boolean;
|
|
103
|
+
/** `disable`: grava `suspended` em vez de `cancelled`. */
|
|
104
|
+
suspend?: boolean;
|
|
105
|
+
}
|
|
106
|
+
export interface IModuleRunActor extends IEntitlementAuditActor {
|
|
107
|
+
login_id?: string;
|
|
108
|
+
}
|
|
109
|
+
export interface IModuleProvisioningRun extends IFireDoc {
|
|
110
|
+
tenant: string;
|
|
111
|
+
module: string;
|
|
112
|
+
action: ModuleAction;
|
|
113
|
+
mode: ModuleRunMode;
|
|
114
|
+
status: ModuleRunStatus;
|
|
115
|
+
params: IModuleChangeParams;
|
|
116
|
+
/** Hash estável dos passos planejados (kind+status+after). Muda ⇒ `PLAN_DRIFT`. */
|
|
117
|
+
plan_hash: string;
|
|
118
|
+
/** `PLATFORM_MODULE_CATALOG_VERSION` de quem planejou/aplicou. */
|
|
119
|
+
types_version: string;
|
|
120
|
+
steps: IModuleProvisioningStep[];
|
|
121
|
+
actor: IModuleRunActor;
|
|
122
|
+
reason: string;
|
|
123
|
+
/** Run `apply` que este retoma. */
|
|
124
|
+
resumed_from?: string | null;
|
|
125
|
+
/** Run `plan` que originou este `apply`. */
|
|
126
|
+
plan_run_id?: string | null;
|
|
127
|
+
error?: string | null;
|
|
128
|
+
finished_at?: Date | null;
|
|
129
|
+
}
|
|
130
|
+
/** Lock no doc `tenants/{t}/apps/evo-modules`, campo `locks.{module}`. */
|
|
131
|
+
export interface IModuleLock {
|
|
132
|
+
run_id: string;
|
|
133
|
+
expires_at: Date;
|
|
134
|
+
}
|
|
135
|
+
export interface IModuleRolloutDoc extends IFireGlobalDoc {
|
|
136
|
+
flags: Record<string, boolean>;
|
|
137
|
+
emergency_kill: boolean;
|
|
138
|
+
updated_at: Date;
|
|
139
|
+
updated_by: string;
|
|
140
|
+
}
|
|
141
|
+
/** Estado de rollout normalizado (o mesmo para os dois layouts). */
|
|
142
|
+
export interface IModuleRolloutState {
|
|
143
|
+
module: string;
|
|
144
|
+
path: string;
|
|
145
|
+
/** `false` ⇒ doc ausente/ilegível: tudo negado. */
|
|
146
|
+
exists: boolean;
|
|
147
|
+
flags: Record<string, boolean>;
|
|
148
|
+
emergency_kill: boolean;
|
|
149
|
+
updated_at: Date | null;
|
|
150
|
+
updated_by: string | null;
|
|
151
|
+
}
|
|
152
|
+
export interface IModuleEntitlementAudit extends IFireDoc {
|
|
153
|
+
module: string;
|
|
154
|
+
action: EntitlementAuditAction;
|
|
155
|
+
before?: ITenantModuleEntitlement | null;
|
|
156
|
+
after: ITenantModuleEntitlement;
|
|
157
|
+
actor: IEntitlementAuditActor;
|
|
158
|
+
reason: string;
|
|
159
|
+
occurred_at: Date;
|
|
160
|
+
correlation_id?: string;
|
|
161
|
+
run_id?: string;
|
|
162
|
+
}
|
|
163
|
+
export interface IModuleStepContext {
|
|
164
|
+
tenant: string;
|
|
165
|
+
module: IPlatformModuleDefinition;
|
|
166
|
+
action: ModuleAction;
|
|
167
|
+
params: IModuleChangeParams;
|
|
168
|
+
actor_user_id: string | null;
|
|
169
|
+
/** Passos anteriores do mesmo run (estado corrente). */
|
|
170
|
+
previous_steps?: IModuleProvisioningStep[];
|
|
171
|
+
}
|
|
172
|
+
export type ModuleStepPlanResult = Pick<IModuleProvisioningStep, "status" | "summary" | "before" | "after">;
|
|
173
|
+
export type ModuleStepApplyResult = Pick<IModuleProvisioningStep, "status" | "summary" | "after">;
|
|
174
|
+
export interface IModuleStepExecutor {
|
|
175
|
+
plan(ctx: IModuleStepContext): Promise<ModuleStepPlanResult>;
|
|
176
|
+
apply(ctx: IModuleStepContext): Promise<ModuleStepApplyResult>;
|
|
177
|
+
}
|
|
178
|
+
export interface IModuleChangeRequest {
|
|
179
|
+
tenant: string;
|
|
180
|
+
module: string;
|
|
181
|
+
action: ModuleAction;
|
|
182
|
+
params?: IModuleChangeParams;
|
|
183
|
+
reason: string;
|
|
184
|
+
}
|
|
185
|
+
export interface IModuleApplyRequest {
|
|
186
|
+
tenant: string;
|
|
187
|
+
/** Aplica o plano deste run (`mode: 'plan'`). Exclusivo com `resume_run_id`. */
|
|
188
|
+
plan_run_id?: string;
|
|
189
|
+
/** Retoma um run `apply` em `failed`/`blocked`. */
|
|
190
|
+
resume_run_id?: string;
|
|
191
|
+
/** Sobrepõe params do plano (só `allow_without_contract` faz sentido aqui). */
|
|
192
|
+
params?: Pick<IModuleChangeParams, "allow_without_contract">;
|
|
193
|
+
}
|
|
194
|
+
export interface IModuleOverviewRequest {
|
|
195
|
+
tenant: string;
|
|
196
|
+
}
|
|
197
|
+
export interface IModuleOverviewEntry {
|
|
198
|
+
definition: IPlatformModuleDefinition;
|
|
199
|
+
entitlement: ITenantModuleEntitlement | null;
|
|
200
|
+
active: boolean;
|
|
201
|
+
rollout: IModuleRolloutState | null;
|
|
202
|
+
}
|
|
203
|
+
export interface IModuleOverviewResponse {
|
|
204
|
+
ok: true;
|
|
205
|
+
tenant: string;
|
|
206
|
+
catalog_version: string;
|
|
207
|
+
modules: IModuleOverviewEntry[];
|
|
208
|
+
/** Últimos 10 runs (plan e apply), mais recentes primeiro. */
|
|
209
|
+
runs: IModuleProvisioningRun[];
|
|
210
|
+
/** Últimas 30 entradas de auditoria (caminho genérico + legados), por `occurred_at` desc. */
|
|
211
|
+
audit: IModuleEntitlementAudit[];
|
|
212
|
+
}
|
|
213
|
+
export interface IModulePlanResponse {
|
|
214
|
+
ok: true;
|
|
215
|
+
run: IModuleProvisioningRun;
|
|
216
|
+
}
|
|
217
|
+
export type ModuleApplyErrorCode = "PLAN_DRIFT" | "MODULE_LOCKED" | "RUN_NOT_FOUND" | "RUN_NOT_RESUMABLE";
|
|
218
|
+
export type IModuleApplyResponse = {
|
|
219
|
+
ok: true;
|
|
220
|
+
run: IModuleProvisioningRun;
|
|
221
|
+
}
|
|
222
|
+
/** O estado mudou desde o plano: `plan` é o run novo (`mode: 'plan'`) para revisar. */
|
|
223
|
+
| {
|
|
224
|
+
ok: false;
|
|
225
|
+
error: "PLAN_DRIFT";
|
|
226
|
+
plan: IModuleProvisioningRun;
|
|
227
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ======================================================
|
|
3
|
+
// evo-modules (feat-263 — Módulos da plataforma)
|
|
4
|
+
//
|
|
5
|
+
// Entitlement de módulos por tenant: "este cliente tem direito ao módulo X?".
|
|
6
|
+
// NÃO é feature flag: o kill switch operacional de cada módulo é o `rollout`
|
|
7
|
+
// (doc de plataforma), um gate independente.
|
|
8
|
+
//
|
|
9
|
+
// Storage do estado continua em `tenants/{t}.modules[key]`
|
|
10
|
+
// (`ITenantModuleEntitlement`, feat-160 D5). Este namespace acrescenta:
|
|
11
|
+
// - o catálogo em código (`PLATFORM_MODULE_CATALOG`), que carrega
|
|
12
|
+
// comportamento (passos de provisionamento, grupos RBAC, métricas de franquia);
|
|
13
|
+
// - a decisão única `isModuleActive` / `hasModuleCapability`, usada por
|
|
14
|
+
// backend, web-app e Nexus (o Flutter espelha pela fixture de paridade);
|
|
15
|
+
// - os tipos do run de provisionamento, do doc de rollout genérico e da
|
|
16
|
+
// auditoria genérica.
|
|
17
|
+
//
|
|
18
|
+
// Firestore (por tenant):
|
|
19
|
+
// - App doc (locks): /tenants/{t}/apps/evo-modules campo `locks.{module}`
|
|
20
|
+
// - Auditoria: /tenants/{t}/apps/evo-modules/entitlement-audit/{id}
|
|
21
|
+
// - Provisionamento: /tenants/{t}/apps/evo-modules/provisioning/{runId}
|
|
22
|
+
//
|
|
23
|
+
// Plataforma (só backend):
|
|
24
|
+
// - Rollout genérico: /platform/evo-modules/rollout/{module}
|
|
25
|
+
// (a telemedicina continua em `platform/evo-telemedicine/config/rollout`,
|
|
26
|
+
// lida pelo mesmo reader via `rollout.layout = 'legacy_fields'`).
|
|
27
|
+
// ======================================================
|
|
28
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
29
|
+
if (k2 === undefined) k2 = k;
|
|
30
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
31
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
32
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
33
|
+
}
|
|
34
|
+
Object.defineProperty(o, k2, desc);
|
|
35
|
+
}) : (function(o, m, k, k2) {
|
|
36
|
+
if (k2 === undefined) k2 = k;
|
|
37
|
+
o[k2] = m[k];
|
|
38
|
+
}));
|
|
39
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
40
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
41
|
+
};
|
|
42
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
|
+
exports.MODULE_STEP_KINDS = exports.ModuleStepKindEnum = exports.ModuleActionEnum = exports.MODULE_KEY_PATTERN = exports.MODULES_LOCK_TTL_MS = exports.MODULES_ROLLOUT_PLATFORM_PATH = exports.MODULES_PROVISIONING_COLLECTION = exports.MODULES_ENTITLEMENT_AUDIT_COLLECTION = exports.EVO_MODULES_APP = void 0;
|
|
44
|
+
__exportStar(require("./catalog"), exports);
|
|
45
|
+
__exportStar(require("./activation"), exports);
|
|
46
|
+
exports.EVO_MODULES_APP = "evo-modules";
|
|
47
|
+
exports.MODULES_ENTITLEMENT_AUDIT_COLLECTION = "entitlement-audit";
|
|
48
|
+
exports.MODULES_PROVISIONING_COLLECTION = "provisioning";
|
|
49
|
+
exports.MODULES_ROLLOUT_PLATFORM_PATH = "platform/evo-modules/rollout";
|
|
50
|
+
/** TTL do lock por tenant+módulo durante um apply. */
|
|
51
|
+
exports.MODULES_LOCK_TTL_MS = 10 * 60 * 1000;
|
|
52
|
+
/** Regex da chave de módulo (`tenants/{t}.modules[key]`). */
|
|
53
|
+
exports.MODULE_KEY_PATTERN = /^[a-z][a-z0-9_]{1,40}$/;
|
|
54
|
+
exports.ModuleActionEnum = {
|
|
55
|
+
Enable: "enable",
|
|
56
|
+
Disable: "disable",
|
|
57
|
+
Trial: "trial",
|
|
58
|
+
Override: "override",
|
|
59
|
+
};
|
|
60
|
+
exports.ModuleStepKindEnum = {
|
|
61
|
+
Entitlement: "entitlement",
|
|
62
|
+
RbacGroup: "rbac_group",
|
|
63
|
+
RbacRecompute: "rbac_recompute",
|
|
64
|
+
ContractAllowance: "contract_allowance",
|
|
65
|
+
ContractCheck: "contract_check",
|
|
66
|
+
RolloutCheck: "rollout_check",
|
|
67
|
+
};
|
|
68
|
+
exports.MODULE_STEP_KINDS = [
|
|
69
|
+
"entitlement",
|
|
70
|
+
"rbac_group",
|
|
71
|
+
"rbac_recompute",
|
|
72
|
+
"contract_allowance",
|
|
73
|
+
"contract_check",
|
|
74
|
+
"rollout_check",
|
|
75
|
+
];
|