@fiado/type-kit 3.141.0 → 3.143.0

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.
Files changed (44) hide show
  1. package/_test_/unit/platformRbac/dtos/CreateTenantRequest.test.ts +8 -6
  2. package/_test_/unit/platformRbac/enums/__snapshots__/permissionBits.test.ts.snap +1 -73
  3. package/_test_/unit/platformRbac/tenantTypes.test.ts +5 -40
  4. package/bin/platformRbac/application/Application.d.ts +1 -1
  5. package/bin/platformRbac/dtos/CreateTenantRequest.d.ts +6 -5
  6. package/bin/platformRbac/dtos/CreateTenantRequest.js +2 -3
  7. package/bin/platformRbac/dtos/ResendOtpRequest.d.ts +22 -0
  8. package/bin/{walletFunding/dtos/CancelFundingRequest.js → platformRbac/dtos/ResendOtpRequest.js} +16 -13
  9. package/bin/platformRbac/dtos/ResendSelfRegisterOtpRequest.d.ts +11 -0
  10. package/bin/{cognitoBackofficeConnector/dtos/MfaPoolConfig.js → platformRbac/dtos/ResendSelfRegisterOtpRequest.js} +18 -18
  11. package/bin/platformRbac/enums/Permission.d.ts +0 -77
  12. package/bin/platformRbac/enums/Permission.js +8 -186
  13. package/bin/platformRbac/enums/PermissionCategory.d.ts +0 -7
  14. package/bin/platformRbac/enums/PermissionCategory.js +4 -9
  15. package/bin/platformRbac/tenantTypes.d.ts +18 -13
  16. package/bin/platformRbac/tenantTypes.js +20 -30
  17. package/package.json +1 -1
  18. package/src/platformRbac/application/Application.ts +2 -1
  19. package/src/platformRbac/dtos/CreateTenantRequest.ts +8 -6
  20. package/src/platformRbac/enums/Permission.ts +8 -191
  21. package/src/platformRbac/enums/PermissionCategory.ts +4 -9
  22. package/src/platformRbac/tenantTypes.ts +21 -32
  23. package/bin/cognitoBackofficeConnector/dtos/MfaPoolConfig.d.ts +0 -7
  24. package/bin/cognitoBackofficeConnector/dtos/PoolConfigResponse.d.ts +0 -20
  25. package/bin/cognitoBackofficeConnector/dtos/PoolConfigResponse.js +0 -11
  26. package/bin/cognitoBackofficeConnector/dtos/PoolsListResponse.d.ts +0 -4
  27. package/bin/cognitoBackofficeConnector/dtos/PoolsListResponse.js +0 -6
  28. package/bin/cognitoBackofficeConnector/validators/MfaTypesRequiresOne.d.ts +0 -17
  29. package/bin/cognitoBackofficeConnector/validators/MfaTypesRequiresOne.js +0 -39
  30. package/bin/rbac/enums/PoolKind.d.ts +0 -16
  31. package/bin/rbac/enums/PoolKind.js +0 -20
  32. package/bin/rbac/index.d.ts +0 -1
  33. package/bin/rbac/index.js +0 -17
  34. package/bin/walletFunding/dtos/CancelFundingReferenceRequest.d.ts +0 -5
  35. package/bin/walletFunding/dtos/CancelFundingReferenceRequest.js +0 -31
  36. package/bin/walletFunding/dtos/CancelFundingReferenceResponse.d.ts +0 -7
  37. package/bin/walletFunding/dtos/CancelFundingReferenceResponse.js +0 -6
  38. package/bin/walletFunding/dtos/CancelFundingRequest.d.ts +0 -11
  39. package/bin/walletFunding/dtos/CancelFundingResponse.d.ts +0 -14
  40. package/bin/walletFunding/dtos/CancelFundingResponse.js +0 -12
  41. package/bin/walletFunding/dtos/CancelWalletFundingRequest.d.ts +0 -3
  42. package/bin/walletFunding/dtos/CancelWalletFundingRequest.js +0 -21
  43. package/bin/walletFunding/dtos/CancelWalletFundingResponse.d.ts +0 -7
  44. package/bin/walletFunding/dtos/CancelWalletFundingResponse.js +0 -6
@@ -104,117 +104,11 @@ export enum Permission {
104
104
  TENANT_LEVEL_MANAGE = 'tenant.level.manage',
105
105
 
106
106
  // ====================================================
107
- // RETAILcatálogo + inventario + ventas
108
- // ====================================================
109
- // RETAIL user-management espejo de tenant.user.* a nivel RETAILER. Los KEYS existen para que el
110
- // catálogo + el picker los ofrezcan; sus endpoints/handlers los implementa el agente de retailer
111
- // user-management (rbac TD-RBAC-049). create.lateral gobierna create + assign + update (igual que tenant).
112
- RETAIL_USER_CREATE = 'retail.user.create',
113
- RETAIL_USER_CREATE_LATERAL = 'retail.user.create.lateral',
114
- RETAIL_USER_READ = 'retail.user.read',
115
- RETAIL_USER_UPDATE = 'retail.user.update',
116
- RETAIL_USER_STATUS = 'retail.user.status',
117
- RETAIL_USER_DELETE = 'retail.user.delete',
118
- RETAIL_USER_PASSWORD_RESET = 'retail.user.password.reset',
119
- RETAIL_USER_MFA_RESET = 'retail.user.mfa.reset',
120
- RETAIL_PRODUCT_CREATE = 'retail.product.create',
121
- RETAIL_PRODUCT_LIST = 'retail.product.list',
122
- RETAIL_PRODUCT_VIEW = 'retail.product.view',
123
- RETAIL_PRODUCT_UPDATE = 'retail.product.update',
124
- RETAIL_PRODUCT_DELETE = 'retail.product.delete',
125
- /** @deprecated DEC-RBAC-061: se renombrará a 'retail.product.mdm.config' (naming con puntos). Migración de datos coordinada por backend pendiente; no usar en código nuevo. */
126
- RETAIL_PRODUCT_MDM_CONFIG = 'retail.product.mdm_config',
127
- RETAIL_INVENTORY_LIST = 'retail.inventory.list',
128
- RETAIL_INVENTORY_VIEW = 'retail.inventory.view',
129
- RETAIL_INVENTORY_UPDATE = 'retail.inventory.update',
130
- RETAIL_SALE_CREATE = 'retail.sale.create',
131
- RETAIL_SALE_LIST = 'retail.sale.list',
132
- RETAIL_SALE_CANCEL = 'retail.sale.cancel',
133
- RETAIL_STORE_MANAGE = 'retail.store.manage',
134
- RETAIL_RETAILER_MANAGE = 'retail.retailer.manage',
135
-
136
- // ====================================================
137
- // LEND — créditos + cobranza
138
- // ====================================================
139
- LEND_CREDIT_CREATE = 'lend.credit.create',
140
- LEND_CREDIT_LIST = 'lend.credit.list',
141
- LEND_CREDIT_VIEW = 'lend.credit.view',
142
- LEND_CREDIT_UPDATE = 'lend.credit.update',
143
- LEND_CREDIT_LIQUIDATE = 'lend.credit.liquidate',
144
- LEND_CREDIT_RESTRUCTURE = 'lend.credit.restructure',
145
- LEND_PAYMENT_APPLY = 'lend.payment.apply',
146
- LEND_PAYMENT_LIST = 'lend.payment.list',
147
- LEND_PAYMENT_REVERSE = 'lend.payment.reverse',
148
- LEND_INSTALLMENT_VIEW = 'lend.installment.view',
149
-
150
- // ====================================================
151
- // MDM — device management (subset especializado de LEND)
152
- // ====================================================
153
- MDM_DEVICE_ENROLL = 'mdm.device.enroll',
154
- MDM_DEVICE_RELEASE = 'mdm.device.release',
155
- MDM_DEVICE_ARCHIVE = 'mdm.device.archive',
156
- MDM_DEVICE_DEACTIVATE = 'mdm.device.deactivate',
157
- MDM_DEVICE_LOCK_MANUAL = 'mdm.device.lock.manual',
158
- MDM_DEVICE_UNLOCK_MANUAL = 'mdm.device.unlock.manual',
159
- /** @deprecated DEC-RBAC-061: se renombrará a 'mdm.device.pin.unlock' (naming con puntos). Migración de datos coordinada por backend pendiente; no usar en código nuevo. */
160
- MDM_DEVICE_PIN_UNLOCK = 'mdm.device.pin_unlock',
161
- /** @deprecated DEC-RBAC-061: se renombrará a 'mdm.device.extend.validity' (naming con puntos). Migración de datos coordinada por backend pendiente; no usar en código nuevo. */
162
- MDM_DEVICE_EXTEND_VALIDITY = 'mdm.device.extend_validity',
163
- MDM_DEVICE_NOTIFY = 'mdm.device.notify',
164
- MDM_DEVICE_STATUS_VIEW = 'mdm.device.status.view',
165
- /** @deprecated DEC-RBAC-061: se renombrará a 'mdm.operation.log.view' (naming con puntos). Migración de datos coordinada por backend pendiente; no usar en código nuevo. */
166
- MDM_OPERATION_LOG_VIEW = 'mdm.operation_log.view',
167
- MDM_TEST = 'mdm.test',
168
-
169
- // ====================================================
170
- // PAY — futuro FiadoPay (placeholder, no usado en MVP)
171
- // ====================================================
172
- PAY_TRANSACTION_VIEW = 'pay.transaction.view',
173
-
174
- // ====================================================
175
- // AGENTS — Fiado Agents (tenant type AGENTS, roles scope GROUP).
176
- // Permisos de DOMINIO derivados de los endpoints/pantallas reales del webapp de agents
177
- // (ver fiado-agents-webapp/docs/rbac/RBAC-agents.md §5.2). El aislamiento entre orgs lo da el
178
- // scope GROUP del roleAssignment (scopeRef = Group_GT.id), no un permiso aparte.
179
- // ====================================================
180
- // Gate de ACCESO a la app web de Agents (gobernanza). Sin este permiso el usuario no
181
- // entra a la app. Lo otorgan los 5 roles GROUP de agents (en su propio repo, no acá).
182
- AGENTS_APP_ACCESS = 'agents.app.access',
183
- AGENTS_AGENT_LIST = 'agents.agent.list',
184
- AGENTS_AGENT_CREATE = 'agents.agent.create',
185
- /** @deprecated DEC-RBAC-061: se renombrará a 'agents.agent.create.bulk' (naming con puntos). Migración de datos coordinada por backend pendiente; no usar en código nuevo. */
186
- AGENTS_AGENT_CREATE_BULK = 'agents.agent.create_bulk',
187
- AGENTS_AGENT_MOVE = 'agents.agent.move',
188
- AGENTS_AGENT_DELETE = 'agents.agent.delete',
189
- AGENTS_REFERRAL_VIEW = 'agents.referral.view',
190
- AGENTS_RANKING_VIEW = 'agents.ranking.view',
191
- AGENTS_PRODUCTION_VIEW = 'agents.production.view',
192
- AGENTS_PERSON_SEARCH = 'agents.person.search',
193
- AGENTS_PERSON_VIEW = 'agents.person.view',
194
- AGENTS_PERSON_UPDATE = 'agents.person.update',
195
- AGENTS_PERSON_CREATE = 'agents.person.create',
196
- AGENTS_DOCUMENT_VIEW = 'agents.document.view',
197
- AGENTS_DOCUMENT_UPLOAD = 'agents.document.upload',
198
- AGENTS_ADDRESS_VIEW = 'agents.address.view',
199
- AGENTS_ADDRESS_MANAGE = 'agents.address.manage',
200
- AGENTS_BENEFICIARY_VIEW = 'agents.beneficiary.view',
201
- AGENTS_BENEFICIARY_MANAGE = 'agents.beneficiary.manage',
202
- AGENTS_CARD_ISSUE = 'agents.card.issue',
203
- AGENTS_CHAT_VIEW = 'agents.chat.view',
204
- AGENTS_CHAT_SEND = 'agents.chat.send',
205
- AGENTS_NOTIFICATION_SEND = 'agents.notification.send',
206
- AGENTS_EXPORT_RUN = 'agents.export.run',
207
- AGENTS_CATALOG_VIEW = 'agents.catalog.view',
208
- // Gestión de grupos del tenant AGENTS (scope TENANT — el operador). Espejo de retail.retailer.manage.
209
- AGENTS_GROUP_MANAGE = 'agents.group.manage',
210
- // Gestión de usuarios DENTRO de un grupo (scope GROUP — el group_owner/admin sobre su grupo; el
211
- // operador la cubre por TENANT). Crea usuarios + asigna roles group_* acotado al groupId. DEC-102.
212
- AGENTS_GROUP_USER_MANAGE = 'agents.group.user.manage',
213
-
214
- // ====================================================
215
- // LEVEL{1,2,3} — primitivas RBAC genéricas por nivel (DEC-RBAC-063, ADITIVO)
216
- // Permisos básicos auto-sembrables por nivel genérico (data-driven). Coexisten con los
217
- // legacy retail.*/agents.* (categorías @deprecated), NO los reemplazan en la línea 3.x.
107
+ // LEVEL{1,2,3}primitivas RBAC genéricas por nivel (DEC-RBAC-063)
108
+ // Permisos básicos auto-sembrables por nivel genérico (data-driven). Los permisos de
109
+ // DOMINIO (retail.*/lend.*/mdm.*/pay.*/agents.*) fueron purgados del catálogo (v4.0.0,
110
+ // BREAKING): el type-kit contiene SOLO el vocabulario del sistema RBAC; los permisos de
111
+ // dominio viven como data (catálogo por aplicación), no hardcodeados acá.
218
112
  // ====================================================
219
113
  LEVEL1_USER_CREATE = 'level1.user.create',
220
114
  LEVEL1_USER_READ = 'level1.user.read',
@@ -311,87 +205,10 @@ export const PERMISSION_BIT_ORDER: readonly Permission[] = [
311
205
  Permission.TENANT_SECURITY_POLICY_MANAGE,
312
206
  Permission.TENANT_BRANDING_MANAGE,
313
207
  Permission.TENANT_AUDIT_VIEW,
314
- Permission.RETAIL_USER_CREATE,
315
- Permission.RETAIL_USER_CREATE_LATERAL,
316
- Permission.RETAIL_USER_READ,
317
- Permission.RETAIL_USER_UPDATE,
318
- Permission.RETAIL_USER_STATUS,
319
- Permission.RETAIL_USER_DELETE,
320
- Permission.RETAIL_USER_PASSWORD_RESET,
321
- Permission.RETAIL_USER_MFA_RESET,
322
- Permission.RETAIL_PRODUCT_CREATE,
323
- Permission.RETAIL_PRODUCT_LIST,
324
- Permission.RETAIL_PRODUCT_VIEW,
325
- Permission.RETAIL_PRODUCT_UPDATE,
326
- Permission.RETAIL_PRODUCT_DELETE,
327
- Permission.RETAIL_PRODUCT_MDM_CONFIG,
328
- Permission.RETAIL_INVENTORY_LIST,
329
- Permission.RETAIL_INVENTORY_VIEW,
330
- Permission.RETAIL_INVENTORY_UPDATE,
331
- Permission.RETAIL_SALE_CREATE,
332
- Permission.RETAIL_SALE_LIST,
333
- Permission.RETAIL_SALE_CANCEL,
334
- Permission.RETAIL_STORE_MANAGE,
335
- Permission.RETAIL_RETAILER_MANAGE,
336
- Permission.LEND_CREDIT_CREATE,
337
- Permission.LEND_CREDIT_LIST,
338
- Permission.LEND_CREDIT_VIEW,
339
- Permission.LEND_CREDIT_UPDATE,
340
- Permission.LEND_CREDIT_LIQUIDATE,
341
- Permission.LEND_CREDIT_RESTRUCTURE,
342
- Permission.LEND_PAYMENT_APPLY,
343
- Permission.LEND_PAYMENT_LIST,
344
- Permission.LEND_PAYMENT_REVERSE,
345
- Permission.LEND_INSTALLMENT_VIEW,
346
- Permission.MDM_DEVICE_ENROLL,
347
- Permission.MDM_DEVICE_RELEASE,
348
- Permission.MDM_DEVICE_ARCHIVE,
349
- Permission.MDM_DEVICE_DEACTIVATE,
350
- Permission.MDM_DEVICE_LOCK_MANUAL,
351
- Permission.MDM_DEVICE_UNLOCK_MANUAL,
352
- Permission.MDM_DEVICE_PIN_UNLOCK,
353
- Permission.MDM_DEVICE_EXTEND_VALIDITY,
354
- Permission.MDM_DEVICE_NOTIFY,
355
- Permission.MDM_DEVICE_STATUS_VIEW,
356
- Permission.MDM_OPERATION_LOG_VIEW,
357
- Permission.MDM_TEST,
358
- Permission.PAY_TRANSACTION_VIEW,
359
- // AGENTS (append-only) — Fiado Agents domain perms.
360
- Permission.AGENTS_AGENT_LIST,
361
- Permission.AGENTS_AGENT_CREATE,
362
- Permission.AGENTS_AGENT_CREATE_BULK,
363
- Permission.AGENTS_AGENT_MOVE,
364
- Permission.AGENTS_AGENT_DELETE,
365
- Permission.AGENTS_REFERRAL_VIEW,
366
- Permission.AGENTS_RANKING_VIEW,
367
- Permission.AGENTS_PRODUCTION_VIEW,
368
- Permission.AGENTS_PERSON_SEARCH,
369
- Permission.AGENTS_PERSON_VIEW,
370
- Permission.AGENTS_PERSON_UPDATE,
371
- Permission.AGENTS_DOCUMENT_VIEW,
372
- Permission.AGENTS_DOCUMENT_UPLOAD,
373
- Permission.AGENTS_ADDRESS_VIEW,
374
- Permission.AGENTS_ADDRESS_MANAGE,
375
- Permission.AGENTS_BENEFICIARY_VIEW,
376
- Permission.AGENTS_BENEFICIARY_MANAGE,
377
- Permission.AGENTS_CARD_ISSUE,
378
- Permission.AGENTS_CHAT_VIEW,
379
- Permission.AGENTS_CHAT_SEND,
380
- Permission.AGENTS_NOTIFICATION_SEND,
381
- Permission.AGENTS_EXPORT_RUN,
382
- Permission.AGENTS_CATALOG_VIEW,
383
- Permission.AGENTS_GROUP_MANAGE,
384
- Permission.AGENTS_GROUP_USER_MANAGE,
385
- // Append-only: nuevo permiso agregado 2026-06-18 (DEC-A2-02). Va al FINAL para no correr los bits
386
- // existentes (PERMS_VERSION cambia, pero los índices previos se conservan).
387
- Permission.AGENTS_PERSON_CREATE,
388
- // Append-only 2026-06-18 (DEC-RBAC-017): catálogo de campos personalizados por tenant. Al FINAL para
389
- // no correr bits existentes. (El bitset está deprecado por token-flaco, pero el orden se mantiene
390
- // sincronizado con el enum para que el test de bits no rompa.)
208
+ // Append-only 2026-06-18 (DEC-RBAC-017): catálogo de campos personalizados por tenant.
209
+ // (El bitset está deprecado por token-flaco, pero el orden se mantiene sincronizado con el
210
+ // enum para que el test de bits no rompa.)
391
211
  Permission.PLATFORM_TENANT_USERFIELDS_MANAGE,
392
- // Append-only 2026-06-21: gate de acceso a la app web de Agents (gobernanza). Al FINAL para no
393
- // correr bits existentes (PERMS_VERSION cambia, pero los índices previos se conservan).
394
- Permission.AGENTS_APP_ACCESS,
395
212
  // Append-only 2026-06-19: lateral platform (platform_super_admin asigna roles scope PLATFORM).
396
213
  // Al FINAL para no correr bits existentes (PERMS_VERSION cambia, índices previos se conservan).
397
214
  Permission.PLATFORM_USER_CREATE_LATERAL,
@@ -6,16 +6,11 @@ export enum PermissionCategory {
6
6
  RBAC = 'rbac',
7
7
  PLATFORM = 'platform',
8
8
  TENANT = 'tenant',
9
- /** @deprecated DEC-RBAC-062/063: se consolida en niveles genéricos (LEVEL_n) data-driven. Migración de tenants pendiente; no usar en código nuevo. */
10
- RETAIL = 'retail',
11
- LEND = 'lend',
12
- MDM = 'mdm',
13
9
  AUDIT = 'audit',
14
- PAY = 'pay',
15
- /** @deprecated DEC-RBAC-062/063: se consolida en niveles genéricos (LEVEL_n) data-driven. Migración de tenants pendiente; no usar en código nuevo. */
16
- AGENTS = 'agents',
17
- // DEC-RBAC-063 (aditivo): categorías de las primitivas RBAC por nivel genérico.
18
- // Coexisten con RETAIL/AGENTS (@deprecated), no los reemplazan en la línea 3.x.
10
+ // DEC-RBAC-063: categorías de las primitivas RBAC por nivel genérico.
11
+ // Las categorías de DOMINIO (retail/lend/mdm/pay/agents) fueron purgadas del catálogo
12
+ // (v4.0.0, BREAKING): el type-kit contiene SOLO el vocabulario del sistema RBAC; el dominio
13
+ // vive como data (catálogo por aplicación), no hardcodeado acá.
19
14
  LEVEL1 = 'level1',
20
15
  LEVEL2 = 'level2',
21
16
  LEVEL3 = 'level3',
@@ -1,16 +1,19 @@
1
1
  import { PermissionScope } from './enums/PermissionScope';
2
2
 
3
3
  /**
4
- * Tipos de tenant soportados por el rbac-business. Cada tipo define su propia
5
- * jerarquía de niveles DEBAJO de TENANT (data-driven). Hoy solo existe `retail`.
4
+ * Tipos de tenant de DOMINIO (retail/agents) PURGADOS (v4.0.0, BREAKING).
6
5
  *
7
- * @deprecated DEC-RBAC-062/063: el modelo de tipos de tenant se consolida en niveles genéricos
8
- * (LEVEL_1..n) data-driven. Migración de tenants pendiente; no usar en código nuevo.
6
+ * El modelo de tipos de tenant de dominio se consolidó en niveles genéricos (LEVEL_1..n)
7
+ * data-driven (DEC-RBAC-062/063). El type-kit contiene SOLO el vocabulario del sistema RBAC;
8
+ * la jerarquía de niveles de cada aplicación vive como data (catálogo por aplicación,
9
+ * ver `LevelDef` en `application/Application`), no hardcodeada acá.
10
+ *
11
+ * El enum queda SIN miembros de dominio a propósito. La maquinaria genérica
12
+ * (`TENANT_TYPES`, `levelsOf`, `tableSuffixForLevel`, `scopeRankOrder`) se conserva para no
13
+ * romper a los consumidores (ej. `ScopeValidationService._rank` vía `scopeRankOrder`), pero
14
+ * ya no aporta niveles legacy: el orden queda definido por los niveles genéricos.
9
15
  */
10
- export enum TenantType {
11
- RETAIL = 'retail',
12
- AGENTS = 'agents',
13
- }
16
+ export enum TenantType {}
14
17
 
15
18
  interface TenantTypeDef {
16
19
  displayName: string;
@@ -20,46 +23,32 @@ interface TenantTypeDef {
20
23
  tableSuffix: Partial<Record<PermissionScope, string>>;
21
24
  }
22
25
 
23
- /** @deprecated DEC-RBAC-062/063: se consolida en niveles genéricos (LEVEL_n) data-driven. Migración de tenants pendiente; no usar en código nuevo. */
24
- export const TENANT_TYPES: Record<TenantType, TenantTypeDef> = {
25
- [TenantType.RETAIL]: {
26
- displayName: 'Retail',
27
- levels: [PermissionScope.RETAILER, PermissionScope.STORE],
28
- tableSuffix: {
29
- [PermissionScope.RETAILER]: 'SharedRetailer',
30
- [PermissionScope.STORE]: 'SharedStore',
31
- },
32
- },
33
- // Fiado Agents — un único nivel GROUP debajo de TENANT.
34
- [TenantType.AGENTS]: {
35
- displayName: 'Agents',
36
- levels: [PermissionScope.GROUP],
37
- tableSuffix: { [PermissionScope.GROUP]: 'SharedGroup' },
38
- },
39
- };
26
+ /**
27
+ * Registro de tipos de tenant de dominio — VACÍO tras la purga (v4.0.0). Las jerarquías de
28
+ * niveles se definen como data por aplicación (LEVEL_n), no acá.
29
+ */
30
+ export const TENANT_TYPES: Record<TenantType, TenantTypeDef> = {};
40
31
 
41
- /** @deprecated DEC-RBAC-062/063: se consolida en niveles genéricos (LEVEL_n) data-driven. Migración de tenants pendiente; no usar en código nuevo. */
42
32
  export function levelsOf(type: TenantType): PermissionScope[] {
43
33
  return TENANT_TYPES[type].levels;
44
34
  }
45
35
 
46
- /** @deprecated DEC-RBAC-062/063: se consolida en niveles genéricos (LEVEL_n) data-driven. Migración de tenants pendiente; no usar en código nuevo. */
47
36
  export function tableSuffixForLevel(type: TenantType, level: PermissionScope): string | undefined {
48
37
  return TENANT_TYPES[type].tableSuffix[level];
49
38
  }
50
39
 
51
40
  /**
52
- * Orden global de scopes para ORDENAR (ej. UI): PLATFORM, TENANT + niveles de cada tipo.
53
- * ⚠️ NO usar para COBERTURA de autorización: es un orden total que cruzaría ramas
54
- * (sugeriría falsamente que RETAILER cubre GROUP). La cobertura se decide con una relación
55
- * explícita por niveles — ver `canAccess`/`scopeCovers` en @fiado/gateway-adapter (DEC-RBAC-010).
41
+ * Orden global de scopes para ORDENAR (ej. UI): PLATFORM, TENANT + niveles genéricos.
42
+ * ⚠️ NO usar para COBERTURA de autorización: es un orden total que cruzaría ramas.
43
+ * La cobertura se decide con una relación explícita por niveles — ver `canAccess`/`scopeCovers`
44
+ * en @fiado/gateway-adapter (DEC-RBAC-010).
56
45
  */
57
46
  export function scopeRankOrder(): PermissionScope[] {
58
47
  const order: PermissionScope[] = [PermissionScope.PLATFORM, PermissionScope.TENANT];
59
48
  for (const def of Object.values(TENANT_TYPES)) {
60
49
  for (const lvl of def.levels) if (!order.includes(lvl)) order.push(lvl);
61
50
  }
62
- // DEC-RBAC-032: niveles genéricos al final del orden total (UI/ranking). Append-only, después de los legacy.
51
+ // DEC-RBAC-032: niveles genéricos al final del orden total (UI/ranking). Append-only.
63
52
  for (const lvl of [PermissionScope.LEVEL_1, PermissionScope.LEVEL_2, PermissionScope.LEVEL_3]) {
64
53
  if (!order.includes(lvl)) order.push(lvl);
65
54
  }
@@ -1,7 +0,0 @@
1
- declare const ALLOWED_MFA_TYPES: readonly ["SOFTWARE_TOKEN_MFA"];
2
- export type AllowedMfaType = (typeof ALLOWED_MFA_TYPES)[number];
3
- export declare class MfaPoolConfig {
4
- requireMfa: boolean;
5
- mfaTypes: AllowedMfaType[];
6
- }
7
- export {};
@@ -1,20 +0,0 @@
1
- import { PoolKind } from '../../rbac/enums/PoolKind';
2
- /**
3
- * Shape del `PoolConfigRow` expuesto al caller (BFF M18 / otros lambdas Fiado).
4
- * Refleja la configuración de un Cognito User Pool registrado en la tabla
5
- * `PoolConfigs_GT` del lambda `cognito-backoffice-connector`.
6
- */
7
- export declare class PoolConfigResponse {
8
- userPoolId: string;
9
- userPoolArn: string;
10
- region: string;
11
- poolKind: PoolKind;
12
- displayName: string;
13
- appClients: Record<string, {
14
- clientId: string;
15
- clientName: string;
16
- }>;
17
- status: 'active' | 'deprecated';
18
- createdAt: number;
19
- updatedAt: number;
20
- }
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PoolConfigResponse = void 0;
4
- /**
5
- * Shape del `PoolConfigRow` expuesto al caller (BFF M18 / otros lambdas Fiado).
6
- * Refleja la configuración de un Cognito User Pool registrado en la tabla
7
- * `PoolConfigs_GT` del lambda `cognito-backoffice-connector`.
8
- */
9
- class PoolConfigResponse {
10
- }
11
- exports.PoolConfigResponse = PoolConfigResponse;
@@ -1,4 +0,0 @@
1
- import { PoolConfigResponse } from './PoolConfigResponse';
2
- export declare class PoolsListResponse {
3
- pools: PoolConfigResponse[];
4
- }
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PoolsListResponse = void 0;
4
- class PoolsListResponse {
5
- }
6
- exports.PoolsListResponse = PoolsListResponse;
@@ -1,17 +0,0 @@
1
- import { ValidatorConstraintInterface, ValidationArguments } from 'class-validator';
2
- /**
3
- * Cross-field validator: si `requireMfa: true`, entonces `mfaTypes` debe tener
4
- * al menos 1 elemento. Si `requireMfa: false`, `mfaTypes` puede ser vacío.
5
- *
6
- * Razón: cuando el pool nace con MFA habilitado, el connector llama
7
- * `SetUserPoolMfaConfigCommand` con la lista de tipos del DTO. Si el array
8
- * llega vacío con `requireMfa: true`, el SDK rechaza con InvalidParameterException
9
- * y el pool queda en estado inconsistente (MfaConfiguration:'ON' sin tipos).
10
- * Mejor rechazar en validación del DTO antes de tocar AWS.
11
- *
12
- * Ver pivote v1.4.1 TD-017 cerrado + spec doc §1 R3.
13
- */
14
- export declare class MfaTypesRequiresOne implements ValidatorConstraintInterface {
15
- validate(mfaTypes: unknown, args: ValidationArguments): boolean;
16
- defaultMessage(): string;
17
- }
@@ -1,39 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.MfaTypesRequiresOne = void 0;
10
- const class_validator_1 = require("class-validator");
11
- /**
12
- * Cross-field validator: si `requireMfa: true`, entonces `mfaTypes` debe tener
13
- * al menos 1 elemento. Si `requireMfa: false`, `mfaTypes` puede ser vacío.
14
- *
15
- * Razón: cuando el pool nace con MFA habilitado, el connector llama
16
- * `SetUserPoolMfaConfigCommand` con la lista de tipos del DTO. Si el array
17
- * llega vacío con `requireMfa: true`, el SDK rechaza con InvalidParameterException
18
- * y el pool queda en estado inconsistente (MfaConfiguration:'ON' sin tipos).
19
- * Mejor rechazar en validación del DTO antes de tocar AWS.
20
- *
21
- * Ver pivote v1.4.1 TD-017 cerrado + spec doc §1 R3.
22
- */
23
- let MfaTypesRequiresOne = class MfaTypesRequiresOne {
24
- validate(mfaTypes, args) {
25
- const obj = args.object;
26
- if (obj.requireMfa === true) {
27
- return Array.isArray(mfaTypes) && mfaTypes.length >= 1;
28
- }
29
- // requireMfa: false → cualquier mfaTypes pasa.
30
- return true;
31
- }
32
- defaultMessage() {
33
- return 'mfaTypes requiere al menos un tipo cuando requireMfa=true';
34
- }
35
- };
36
- exports.MfaTypesRequiresOne = MfaTypesRequiresOne;
37
- exports.MfaTypesRequiresOne = MfaTypesRequiresOne = __decorate([
38
- (0, class_validator_1.ValidatorConstraint)({ name: 'MfaTypesRequiresOneWhenMfaRequired', async: false })
39
- ], MfaTypesRequiresOne);
@@ -1,16 +0,0 @@
1
- /**
2
- * Tipo de User Pool de Cognito desde la perspectiva del modelo RBAC Fiado.
3
- *
4
- * Origen: spec del proyecto `cognito-backoffice-connector` (Fase 0, componente 01
5
- * documento `docs/superpowers/specs/2026-05-26-cognito-connector-decisiones-pendientes-design.md`).
6
- *
7
- * Decisión (TD-003): el proyecto converge en estos 2 valores. El documento componente 03
8
- * lista 3 valores (incluyendo una variante adicional) pero queda como outlier — la
9
- * decisión vigente en los 6 docs restantes y en el plan de implementación es 2 valores:
10
- * - BACKOFFICE_PLATFORM — pool del backoffice de plataforma (cross-tenant)
11
- * - BACKOFFICE_TENANT — pool por tenant (multi-tenant isolation)
12
- */
13
- export declare enum PoolKind {
14
- BACKOFFICE_PLATFORM = "BACKOFFICE_PLATFORM",
15
- BACKOFFICE_TENANT = "BACKOFFICE_TENANT"
16
- }
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PoolKind = void 0;
4
- /**
5
- * Tipo de User Pool de Cognito desde la perspectiva del modelo RBAC Fiado.
6
- *
7
- * Origen: spec del proyecto `cognito-backoffice-connector` (Fase 0, componente 01
8
- * documento `docs/superpowers/specs/2026-05-26-cognito-connector-decisiones-pendientes-design.md`).
9
- *
10
- * Decisión (TD-003): el proyecto converge en estos 2 valores. El documento componente 03
11
- * lista 3 valores (incluyendo una variante adicional) pero queda como outlier — la
12
- * decisión vigente en los 6 docs restantes y en el plan de implementación es 2 valores:
13
- * - BACKOFFICE_PLATFORM — pool del backoffice de plataforma (cross-tenant)
14
- * - BACKOFFICE_TENANT — pool por tenant (multi-tenant isolation)
15
- */
16
- var PoolKind;
17
- (function (PoolKind) {
18
- PoolKind["BACKOFFICE_PLATFORM"] = "BACKOFFICE_PLATFORM";
19
- PoolKind["BACKOFFICE_TENANT"] = "BACKOFFICE_TENANT";
20
- })(PoolKind || (exports.PoolKind = PoolKind = {}));
@@ -1 +0,0 @@
1
- export * from './enums/PoolKind';
package/bin/rbac/index.js DELETED
@@ -1,17 +0,0 @@
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("./enums/PoolKind"), exports);
@@ -1,5 +0,0 @@
1
- export declare class CancelFundingReferenceRequest {
2
- fundingId: string;
3
- directoryId: string;
4
- idempotencyKey: string;
5
- }
@@ -1,31 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.CancelFundingReferenceRequest = void 0;
13
- const class_validator_1 = require("class-validator");
14
- class CancelFundingReferenceRequest {
15
- }
16
- exports.CancelFundingReferenceRequest = CancelFundingReferenceRequest;
17
- __decorate([
18
- (0, class_validator_1.IsString)(),
19
- (0, class_validator_1.MaxLength)(64),
20
- __metadata("design:type", String)
21
- ], CancelFundingReferenceRequest.prototype, "fundingId", void 0);
22
- __decorate([
23
- (0, class_validator_1.IsString)(),
24
- (0, class_validator_1.MaxLength)(64),
25
- __metadata("design:type", String)
26
- ], CancelFundingReferenceRequest.prototype, "directoryId", void 0);
27
- __decorate([
28
- (0, class_validator_1.IsString)(),
29
- (0, class_validator_1.MaxLength)(64),
30
- __metadata("design:type", String)
31
- ], CancelFundingReferenceRequest.prototype, "idempotencyKey", void 0);
@@ -1,7 +0,0 @@
1
- import { BenefitPaymentStatusEnum } from "../../benefitCenter/enums/BenefitPaymentStatusEnum";
2
- import { WalletFundingErrorCodeEnum } from "../enums/WalletFundingErrorCodeEnum";
3
- export declare class CancelFundingReferenceResponse {
4
- fundingId: string;
5
- status: BenefitPaymentStatusEnum;
6
- errorCode?: WalletFundingErrorCodeEnum;
7
- }
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CancelFundingReferenceResponse = void 0;
4
- class CancelFundingReferenceResponse {
5
- }
6
- exports.CancelFundingReferenceResponse = CancelFundingReferenceResponse;
@@ -1,11 +0,0 @@
1
- /**
2
- * Request del cancel via Centro de Beneficios (spec 13 v2.0).
3
- * `fundingId` viaja en el path, `directoryId` se resuelve del JWT.
4
- * `providerModuleName` permite al marketplace rutear al publisher correcto
5
- * sin tener que persistir el mapping (el wallet-app sabe el moduleName
6
- * porque vino en la respuesta del authorize).
7
- */
8
- export declare class CancelFundingRequest {
9
- idempotencyKey: string;
10
- providerModuleName: string;
11
- }
@@ -1,14 +0,0 @@
1
- import { BenefitPaymentStatusEnum } from "../../benefitCenter/enums/BenefitPaymentStatusEnum";
2
- import { WalletFundingErrorCodeEnum } from "../enums/WalletFundingErrorCodeEnum";
3
- /**
4
- * Response del cancel via Centro de Beneficios (spec 13 v2.0).
5
- * `status` reusa `BenefitPaymentStatusEnum` (APPROVED = cancel aceptado;
6
- * REJECTED = no se pudo) para consistencia con `CancelFundingReferenceResponse`
7
- * (marketplace ↔ connector). Idempotente: re-cancelar devuelve APPROVED.
8
- */
9
- export declare class CancelFundingResponse {
10
- fundingId: string;
11
- status: BenefitPaymentStatusEnum;
12
- errorCode?: WalletFundingErrorCodeEnum;
13
- message?: string;
14
- }
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CancelFundingResponse = void 0;
4
- /**
5
- * Response del cancel via Centro de Beneficios (spec 13 v2.0).
6
- * `status` reusa `BenefitPaymentStatusEnum` (APPROVED = cancel aceptado;
7
- * REJECTED = no se pudo) para consistencia con `CancelFundingReferenceResponse`
8
- * (marketplace ↔ connector). Idempotente: re-cancelar devuelve APPROVED.
9
- */
10
- class CancelFundingResponse {
11
- }
12
- exports.CancelFundingResponse = CancelFundingResponse;
@@ -1,3 +0,0 @@
1
- export declare class CancelWalletFundingRequest {
2
- idempotencyKey: string;
3
- }
@@ -1,21 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.CancelWalletFundingRequest = void 0;
13
- const class_validator_1 = require("class-validator");
14
- class CancelWalletFundingRequest {
15
- }
16
- exports.CancelWalletFundingRequest = CancelWalletFundingRequest;
17
- __decorate([
18
- (0, class_validator_1.IsString)(),
19
- (0, class_validator_1.MaxLength)(64),
20
- __metadata("design:type", String)
21
- ], CancelWalletFundingRequest.prototype, "idempotencyKey", void 0);
@@ -1,7 +0,0 @@
1
- import { BenefitPaymentStatusEnum } from "../../benefitCenter/enums/BenefitPaymentStatusEnum";
2
- import { WalletFundingErrorCodeEnum } from "../enums/WalletFundingErrorCodeEnum";
3
- export declare class CancelWalletFundingResponse {
4
- status: BenefitPaymentStatusEnum;
5
- errorCode?: WalletFundingErrorCodeEnum;
6
- fundingId?: string;
7
- }
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CancelWalletFundingResponse = void 0;
4
- class CancelWalletFundingResponse {
5
- }
6
- exports.CancelWalletFundingResponse = CancelWalletFundingResponse;