@fiado/type-kit 3.662.0 → 3.664.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 (72) hide show
  1. package/_test_/unit/cognitoBackofficeConnector/dtos/CreatePoolRequest.allowAdminCreateUserOnly.test.ts +37 -0
  2. package/_test_/unit/cognitoBackofficeConnector/dtos/OtpLoginConnectorDtos.test.ts +90 -0
  3. package/_test_/unit/messagesConnector/otpLoginContract.test.ts +47 -0
  4. package/_test_/unit/platformRbac/customerAccountDtos.test.ts +84 -0
  5. package/_test_/unit/platformRbac/customerPortalContract.test.ts +39 -0
  6. package/_test_/unit/platformRbac/enums/__snapshots__/permissionBits.test.ts.snap +2 -1
  7. package/_test_/unit/platformRbac/enums/retailIntegrationPermission.test.ts +3 -4
  8. package/_test_/unit/platformRbac/loginModeChallengeDtos.test.ts +58 -0
  9. package/bin/cognitoBackofficeConnector/dtos/AppClientConfig.d.ts +3 -4
  10. package/bin/cognitoBackofficeConnector/dtos/AppClientConfig.js +7 -4
  11. package/bin/cognitoBackofficeConnector/dtos/CreatePoolClientResponse.d.ts +1 -1
  12. package/bin/cognitoBackofficeConnector/dtos/CreatePoolClientResponse.js +1 -1
  13. package/bin/cognitoBackofficeConnector/dtos/CreatePoolRequest.d.ts +2 -0
  14. package/bin/cognitoBackofficeConnector/dtos/CreatePoolRequest.js +6 -0
  15. package/bin/cognitoBackofficeConnector/dtos/CreatePoolResponse.d.ts +1 -7
  16. package/bin/cognitoBackofficeConnector/dtos/CreatePoolResponse.js +1 -7
  17. package/bin/cognitoBackofficeConnector/dtos/RefreshTokensRequest.d.ts +2 -0
  18. package/bin/cognitoBackofficeConnector/dtos/RefreshTokensRequest.js +13 -0
  19. package/bin/cognitoBackofficeConnector/dtos/RespondToChallengeRequest.d.ts +1 -0
  20. package/bin/cognitoBackofficeConnector/dtos/RespondToChallengeRequest.js +6 -0
  21. package/bin/cognitoBackofficeConnector/dtos/StartOtpLoginRequest.d.ts +8 -0
  22. package/bin/cognitoBackofficeConnector/dtos/StartOtpLoginRequest.js +48 -0
  23. package/bin/cognitoBackofficeConnector/index.d.ts +1 -0
  24. package/bin/cognitoBackofficeConnector/index.js +1 -0
  25. package/bin/messagesConnector/dtos/OtpLoginStateRequest.d.ts +5 -0
  26. package/bin/messagesConnector/dtos/OtpLoginStateRequest.js +30 -0
  27. package/bin/messagesConnector/dtos/OtpLoginStateResponse.d.ts +5 -0
  28. package/bin/messagesConnector/dtos/OtpLoginStateResponse.js +7 -0
  29. package/bin/messagesConnector/index.d.ts +2 -0
  30. package/bin/messagesConnector/index.js +2 -0
  31. package/bin/platformRbac/application/Application.d.ts +3 -0
  32. package/bin/platformRbac/auth/DefineNextChallengeResponse.d.ts +2 -0
  33. package/bin/platformRbac/auth/DefineNextChallengeResponse.js +6 -0
  34. package/bin/platformRbac/auth/PrepareChallengeRequest.d.ts +3 -0
  35. package/bin/platformRbac/auth/PrepareChallengeRequest.js +11 -0
  36. package/bin/platformRbac/dtos/EnsureCustomerAccountRequest.d.ts +8 -0
  37. package/bin/platformRbac/dtos/EnsureCustomerAccountRequest.js +49 -0
  38. package/bin/platformRbac/dtos/EnsureCustomerAccountResponse.d.ts +5 -0
  39. package/bin/platformRbac/dtos/EnsureCustomerAccountResponse.js +2 -0
  40. package/bin/platformRbac/dtos/OtpLoginRequest.d.ts +5 -0
  41. package/bin/platformRbac/dtos/OtpLoginRequest.js +30 -0
  42. package/bin/platformRbac/dtos/UserProfileResponse.d.ts +2 -0
  43. package/bin/platformRbac/enums/LoginModeEnum.d.ts +4 -0
  44. package/bin/platformRbac/enums/LoginModeEnum.js +8 -0
  45. package/bin/platformRbac/enums/Permission.d.ts +2 -1
  46. package/bin/platformRbac/enums/Permission.js +3 -0
  47. package/bin/platformRbac/index.d.ts +4 -0
  48. package/bin/platformRbac/index.js +3 -0
  49. package/bin/referral-business/dtos/GroupOwnersByGroupIdsResponse.d.ts +2 -0
  50. package/package.json +1 -1
  51. package/src/cognitoBackofficeConnector/dtos/AppClientConfig.ts +3 -4
  52. package/src/cognitoBackofficeConnector/dtos/CreatePoolClientResponse.ts +1 -1
  53. package/src/cognitoBackofficeConnector/dtos/CreatePoolRequest.ts +4 -1
  54. package/src/cognitoBackofficeConnector/dtos/CreatePoolResponse.ts +1 -7
  55. package/src/cognitoBackofficeConnector/dtos/RefreshTokensRequest.ts +4 -1
  56. package/src/cognitoBackofficeConnector/dtos/RespondToChallengeRequest.ts +2 -1
  57. package/src/cognitoBackofficeConnector/dtos/StartOtpLoginRequest.ts +11 -0
  58. package/src/cognitoBackofficeConnector/index.ts +1 -0
  59. package/src/messagesConnector/dtos/OtpLoginStateRequest.ts +8 -0
  60. package/src/messagesConnector/dtos/OtpLoginStateResponse.ts +5 -0
  61. package/src/messagesConnector/index.ts +2 -0
  62. package/src/platformRbac/application/Application.ts +3 -0
  63. package/src/platformRbac/auth/DefineNextChallengeResponse.ts +5 -0
  64. package/src/platformRbac/auth/PrepareChallengeRequest.ts +11 -1
  65. package/src/platformRbac/dtos/EnsureCustomerAccountRequest.ts +12 -0
  66. package/src/platformRbac/dtos/EnsureCustomerAccountResponse.ts +5 -0
  67. package/src/platformRbac/dtos/OtpLoginRequest.ts +8 -0
  68. package/src/platformRbac/dtos/UserProfileResponse.ts +2 -0
  69. package/src/platformRbac/enums/LoginModeEnum.ts +4 -0
  70. package/src/platformRbac/enums/Permission.ts +3 -0
  71. package/src/platformRbac/index.ts +4 -0
  72. package/src/referral-business/dtos/GroupOwnersByGroupIdsResponse.ts +3 -0
@@ -0,0 +1,30 @@
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.OtpLoginStateRequest = void 0;
13
+ const class_transformer_1 = require("class-transformer");
14
+ const class_validator_1 = require("class-validator");
15
+ /** Body de POST /messages/otp/login-state. */
16
+ class OtpLoginStateRequest {
17
+ }
18
+ exports.OtpLoginStateRequest = OtpLoginStateRequest;
19
+ __decorate([
20
+ (0, class_transformer_1.Expose)(),
21
+ (0, class_validator_1.IsString)(),
22
+ (0, class_validator_1.IsNotEmpty)(),
23
+ __metadata("design:type", String)
24
+ ], OtpLoginStateRequest.prototype, "directoryId", void 0);
25
+ __decorate([
26
+ (0, class_transformer_1.Expose)(),
27
+ (0, class_validator_1.IsString)(),
28
+ (0, class_validator_1.IsNotEmpty)(),
29
+ __metadata("design:type", String)
30
+ ], OtpLoginStateRequest.prototype, "typeOfDirectoryId", void 0);
@@ -0,0 +1,5 @@
1
+ /** Respuesta de POST /messages/otp/login-state. `lockedUntil` va en epoch ms. */
2
+ export declare class OtpLoginStateResponse {
3
+ lastFailureCode: 'OTP_NOT_FOUND' | 'OTP_EXPIRED' | 'OTP_ALREADY_USED' | null;
4
+ lockedUntil: number | null;
5
+ }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OtpLoginStateResponse = void 0;
4
+ /** Respuesta de POST /messages/otp/login-state. `lockedUntil` va en epoch ms. */
5
+ class OtpLoginStateResponse {
6
+ }
7
+ exports.OtpLoginStateResponse = OtpLoginStateResponse;
@@ -10,6 +10,8 @@ export * from './dtos/AgentSendNotificationRequest';
10
10
  export * from './dtos/SendMessageResponse';
11
11
  export * from './dtos/VerifyOtpRequest';
12
12
  export * from './dtos/VerifyOtpResponse';
13
+ export * from './dtos/OtpLoginStateRequest';
14
+ export * from './dtos/OtpLoginStateResponse';
13
15
  export * from './dtos/OtpValidatedResponse';
14
16
  export * from './dtos/NotificationResponse';
15
17
  export * from './dtos/NotificationsPageResponse';
@@ -26,6 +26,8 @@ __exportStar(require("./dtos/AgentSendNotificationRequest"), exports);
26
26
  __exportStar(require("./dtos/SendMessageResponse"), exports);
27
27
  __exportStar(require("./dtos/VerifyOtpRequest"), exports);
28
28
  __exportStar(require("./dtos/VerifyOtpResponse"), exports);
29
+ __exportStar(require("./dtos/OtpLoginStateRequest"), exports);
30
+ __exportStar(require("./dtos/OtpLoginStateResponse"), exports);
29
31
  __exportStar(require("./dtos/OtpValidatedResponse"), exports);
30
32
  __exportStar(require("./dtos/NotificationResponse"), exports);
31
33
  __exportStar(require("./dtos/NotificationsPageResponse"), exports);
@@ -3,6 +3,7 @@ import { PrincipalIdentifierEnum } from '../enums/PrincipalIdentifierEnum';
3
3
  import { ApplicationStatus } from '../enums/ApplicationStatus';
4
4
  import type { UserFieldDef } from '../dtos/UserFieldDef';
5
5
  import type { TokenValidationMode } from '../enums/TokenValidationMode';
6
+ import type { LoginModeEnum } from '../enums/LoginModeEnum';
6
7
  export interface LevelDef {
7
8
  level: PermissionScope;
8
9
  displayName: string;
@@ -44,6 +45,8 @@ export interface ApplicationDefaults {
44
45
  * UsernameAttributes del pool): true ⇒ pool con ['email','phone_number']. Heredado al tenant.
45
46
  */
46
47
  allowSecondary?: boolean;
48
+ /** Modo de login que heredan los tenants de esta aplicación; sin valor entran con contraseña. */
49
+ loginMode?: LoginModeEnum | null;
47
50
  /**
48
51
  * DEC-RBAC-111: política de contraseña que heredan los tenants creados desde esta aplicación.
49
52
  *
@@ -1,6 +1,8 @@
1
1
  import { ChallengeNameEnum } from '../enums/ChallengeNameEnum';
2
+ import { LoginModeEnum } from '../enums/LoginModeEnum';
2
3
  export declare class DefineNextChallengeResponse {
3
4
  nextChallenge?: ChallengeNameEnum;
4
5
  issueTokens: boolean;
5
6
  failAuthentication: boolean;
7
+ loginMode?: LoginModeEnum;
6
8
  }
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.DefineNextChallengeResponse = void 0;
13
13
  const class_validator_1 = require("class-validator");
14
14
  const ChallengeNameEnum_1 = require("../enums/ChallengeNameEnum");
15
+ const LoginModeEnum_1 = require("../enums/LoginModeEnum");
15
16
  class DefineNextChallengeResponse {
16
17
  }
17
18
  exports.DefineNextChallengeResponse = DefineNextChallengeResponse;
@@ -28,3 +29,8 @@ __decorate([
28
29
  (0, class_validator_1.IsBoolean)(),
29
30
  __metadata("design:type", Boolean)
30
31
  ], DefineNextChallengeResponse.prototype, "failAuthentication", void 0);
32
+ __decorate([
33
+ (0, class_validator_1.IsOptional)(),
34
+ (0, class_validator_1.IsEnum)(LoginModeEnum_1.LoginModeEnum),
35
+ __metadata("design:type", String)
36
+ ], DefineNextChallengeResponse.prototype, "loginMode", void 0);
@@ -1,7 +1,10 @@
1
1
  import { ChallengeNameEnum } from '../enums/ChallengeNameEnum';
2
+ import { LoginModeEnum } from '../enums/LoginModeEnum';
2
3
  export declare class PrepareChallengeRequest {
3
4
  cognitoSub: string;
4
5
  challengeName: ChallengeNameEnum;
5
6
  email?: string;
6
7
  phone?: string;
8
+ loginMode?: LoginModeEnum;
9
+ isRetry?: boolean;
7
10
  }
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.PrepareChallengeRequest = void 0;
13
13
  const class_validator_1 = require("class-validator");
14
14
  const ChallengeNameEnum_1 = require("../enums/ChallengeNameEnum");
15
+ const LoginModeEnum_1 = require("../enums/LoginModeEnum");
15
16
  class PrepareChallengeRequest {
16
17
  }
17
18
  exports.PrepareChallengeRequest = PrepareChallengeRequest;
@@ -33,3 +34,13 @@ __decorate([
33
34
  (0, class_validator_1.IsString)(),
34
35
  __metadata("design:type", String)
35
36
  ], PrepareChallengeRequest.prototype, "phone", void 0);
37
+ __decorate([
38
+ (0, class_validator_1.IsOptional)(),
39
+ (0, class_validator_1.IsEnum)(LoginModeEnum_1.LoginModeEnum),
40
+ __metadata("design:type", String)
41
+ ], PrepareChallengeRequest.prototype, "loginMode", void 0);
42
+ __decorate([
43
+ (0, class_validator_1.IsOptional)(),
44
+ (0, class_validator_1.IsBoolean)(),
45
+ __metadata("design:type", Boolean)
46
+ ], PrepareChallengeRequest.prototype, "isRetry", void 0);
@@ -0,0 +1,8 @@
1
+ /** Body de POST /internal/tenants/{tenantId}/customer-accounts. */
2
+ export declare class EnsureCustomerAccountRequest {
3
+ phone: string;
4
+ retailCustomerId: string;
5
+ directoryId: string;
6
+ displayName: string;
7
+ createdBy: string;
8
+ }
@@ -0,0 +1,49 @@
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.EnsureCustomerAccountRequest = void 0;
13
+ const class_transformer_1 = require("class-transformer");
14
+ const class_validator_1 = require("class-validator");
15
+ const InputPatterns_1 = require("../../common/constants/InputPatterns");
16
+ /** Body de POST /internal/tenants/{tenantId}/customer-accounts. */
17
+ class EnsureCustomerAccountRequest {
18
+ }
19
+ exports.EnsureCustomerAccountRequest = EnsureCustomerAccountRequest;
20
+ __decorate([
21
+ (0, class_transformer_1.Expose)(),
22
+ (0, class_validator_1.IsString)(),
23
+ (0, class_validator_1.Matches)(InputPatterns_1.PHONE_E164_PATTERN),
24
+ __metadata("design:type", String)
25
+ ], EnsureCustomerAccountRequest.prototype, "phone", void 0);
26
+ __decorate([
27
+ (0, class_transformer_1.Expose)(),
28
+ (0, class_validator_1.IsString)(),
29
+ (0, class_validator_1.IsNotEmpty)(),
30
+ __metadata("design:type", String)
31
+ ], EnsureCustomerAccountRequest.prototype, "retailCustomerId", void 0);
32
+ __decorate([
33
+ (0, class_transformer_1.Expose)(),
34
+ (0, class_validator_1.IsString)(),
35
+ (0, class_validator_1.IsNotEmpty)(),
36
+ __metadata("design:type", String)
37
+ ], EnsureCustomerAccountRequest.prototype, "directoryId", void 0);
38
+ __decorate([
39
+ (0, class_transformer_1.Expose)(),
40
+ (0, class_validator_1.IsString)(),
41
+ (0, class_validator_1.IsNotEmpty)(),
42
+ __metadata("design:type", String)
43
+ ], EnsureCustomerAccountRequest.prototype, "displayName", void 0);
44
+ __decorate([
45
+ (0, class_transformer_1.Expose)(),
46
+ (0, class_validator_1.IsString)(),
47
+ (0, class_validator_1.IsNotEmpty)(),
48
+ __metadata("design:type", String)
49
+ ], EnsureCustomerAccountRequest.prototype, "createdBy", void 0);
@@ -0,0 +1,5 @@
1
+ /** Respuesta de POST /internal/tenants/{tenantId}/customer-accounts. */
2
+ export interface EnsureCustomerAccountResponse {
3
+ outcome: 'CREATED' | 'EXISTING';
4
+ cognitoSub: string;
5
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,5 @@
1
+ /** Body de POST /auth/otp-login. */
2
+ export declare class OtpLoginRequest {
3
+ phone: string;
4
+ tenantId: string;
5
+ }
@@ -0,0 +1,30 @@
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.OtpLoginRequest = void 0;
13
+ const class_transformer_1 = require("class-transformer");
14
+ const class_validator_1 = require("class-validator");
15
+ /** Body de POST /auth/otp-login. */
16
+ class OtpLoginRequest {
17
+ }
18
+ exports.OtpLoginRequest = OtpLoginRequest;
19
+ __decorate([
20
+ (0, class_transformer_1.Expose)(),
21
+ (0, class_validator_1.IsString)(),
22
+ (0, class_validator_1.IsNotEmpty)(),
23
+ __metadata("design:type", String)
24
+ ], OtpLoginRequest.prototype, "phone", void 0);
25
+ __decorate([
26
+ (0, class_transformer_1.Expose)(),
27
+ (0, class_validator_1.IsString)(),
28
+ (0, class_validator_1.IsNotEmpty)(),
29
+ __metadata("design:type", String)
30
+ ], OtpLoginRequest.prototype, "tenantId", void 0);
@@ -6,4 +6,6 @@ export interface UserProfileResponse {
6
6
  email?: string;
7
7
  phone?: string;
8
8
  status?: string;
9
+ retailCustomerId?: string | null;
10
+ directoryId?: string | null;
9
11
  }
@@ -0,0 +1,4 @@
1
+ /** Modo de login de un tenant. Sin valor, el tenant entra con contraseña. */
2
+ export declare enum LoginModeEnum {
3
+ OTP_ONLY = "OTP_ONLY"
4
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LoginModeEnum = void 0;
4
+ /** Modo de login de un tenant. Sin valor, el tenant entra con contraseña. */
5
+ var LoginModeEnum;
6
+ (function (LoginModeEnum) {
7
+ LoginModeEnum["OTP_ONLY"] = "OTP_ONLY";
8
+ })(LoginModeEnum || (exports.LoginModeEnum = LoginModeEnum = {}));
@@ -121,7 +121,8 @@ export declare enum Permission {
121
121
  PLATFORM_INTEGRATION_KEY_REVOKE = "platform.integration.key.revoke",
122
122
  TENANT_INTEGRATION_DIAGNOSTIC = "tenant.integration.diagnostic",
123
123
  TENANT_API_USER_MANAGE = "tenant.api_user.manage",
124
- PLATFORM_RETAIL_INTEGRATION_ACTIVATE = "platform.retail_integration.activate"
124
+ PLATFORM_RETAIL_INTEGRATION_ACTIVATE = "platform.retail_integration.activate",
125
+ CUSTOMER_PORTAL_READ = "customer.portal.read"
125
126
  }
126
127
  /**
127
128
  * Orden CANÓNICO y APPEND-ONLY de los permisos para el bitset del token.
@@ -168,6 +168,8 @@ var Permission;
168
168
  Permission["TENANT_API_USER_MANAGE"] = "tenant.api_user.manage";
169
169
  // Activa la integración de un retailer externo (Zentral); scope PLATFORM.
170
170
  Permission["PLATFORM_RETAIL_INTEGRATION_ACTIVATE"] = "platform.retail_integration.activate";
171
+ // Lectura del portal del cliente.
172
+ Permission["CUSTOMER_PORTAL_READ"] = "customer.portal.read";
171
173
  })(Permission || (exports.Permission = Permission = {}));
172
174
  /**
173
175
  * Orden CANÓNICO y APPEND-ONLY de los permisos para el bitset del token.
@@ -289,6 +291,7 @@ exports.PERMISSION_BIT_ORDER = [
289
291
  Permission.TENANT_INTEGRATION_DIAGNOSTIC,
290
292
  Permission.TENANT_API_USER_MANAGE,
291
293
  Permission.PLATFORM_RETAIL_INTEGRATION_ACTIVATE,
294
+ Permission.CUSTOMER_PORTAL_READ,
292
295
  ];
293
296
  function djb2(input) {
294
297
  let h = 5381;
@@ -11,6 +11,7 @@ export type { EffectivePermissionsResponse } from './dtos/EffectivePermissionsRe
11
11
  export * from './enums/MfaMethodEnum';
12
12
  export * from './enums/TokenValidationMode';
13
13
  export * from './enums/ChallengeNameEnum';
14
+ export * from './enums/LoginModeEnum';
14
15
  export * from './auth/DefineNextChallengeRequest';
15
16
  export * from './auth/DefineNextChallengeResponse';
16
17
  export * from './auth/PrepareChallengeRequest';
@@ -51,6 +52,9 @@ export type { CreateApplicationRequest, UpdateApplicationRequest, UpsertApplicat
51
52
  export type { RoleScopeRecompute, InconsistentAssignment, CascadeTenantFailure, CascadeReport, UpdateApplicationPermissionResponse, RoleSeedDiff, RoleCascadeChange, RoleCascadeReport, } from './application/cascade';
52
53
  export * from './dtos/SelfRegisterStartRequest';
53
54
  export * from './dtos/SelfRegisterVerifyOtpRequest';
55
+ export * from './dtos/EnsureCustomerAccountRequest';
56
+ export type { EnsureCustomerAccountResponse } from './dtos/EnsureCustomerAccountResponse';
57
+ export * from './dtos/OtpLoginRequest';
54
58
  export * from './dtos/SelfRegisterCompleteRequest';
55
59
  export * from './dtos/CreateLevelEntityRequest';
56
60
  export type { CreateLevelEntityResponse } from './dtos/CreateLevelEntityResponse';
@@ -48,6 +48,7 @@ Object.defineProperty(exports, "AccountType", { enumerable: true, get: function
48
48
  __exportStar(require("./enums/MfaMethodEnum"), exports);
49
49
  __exportStar(require("./enums/TokenValidationMode"), exports);
50
50
  __exportStar(require("./enums/ChallengeNameEnum"), exports);
51
+ __exportStar(require("./enums/LoginModeEnum"), exports);
51
52
  __exportStar(require("./auth/DefineNextChallengeRequest"), exports);
52
53
  __exportStar(require("./auth/DefineNextChallengeResponse"), exports);
53
54
  __exportStar(require("./auth/PrepareChallengeRequest"), exports);
@@ -107,6 +108,8 @@ __exportStar(require("./enums/PermissionKind"), exports);
107
108
  // plain (type-only). Consumidos por los endpoints públicos de platform-rbac-business + el gate de perfil.
108
109
  __exportStar(require("./dtos/SelfRegisterStartRequest"), exports);
109
110
  __exportStar(require("./dtos/SelfRegisterVerifyOtpRequest"), exports);
111
+ __exportStar(require("./dtos/EnsureCustomerAccountRequest"), exports);
112
+ __exportStar(require("./dtos/OtpLoginRequest"), exports);
110
113
  __exportStar(require("./dtos/SelfRegisterCompleteRequest"), exports);
111
114
  // Endpoints privados de espejo de jerarquía + alta de usuario (SureKeep F1, scope mirror).
112
115
  // Request DTOs llevan decoradores class-validator → export de valor (se hidratan con plainToInstance);
@@ -4,5 +4,7 @@ export interface GroupOwnerItem {
4
4
  name: string | null;
5
5
  email: string | null;
6
6
  status: string;
7
+ parentDirectoryId?: string | null;
8
+ parentName?: string | null;
7
9
  }
8
10
  export type GroupOwnersByGroupIdsResponse = Record<string, GroupOwnerItem>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiado/type-kit",
3
- "version": "3.662.0",
3
+ "version": "3.664.0",
4
4
  "description": "",
5
5
  "main": "bin/index.js",
6
6
  "types": "bin/index.d.ts",
@@ -14,10 +14,7 @@ export const COGNITO_EXPLICIT_AUTH_FLOWS: readonly string[] = [
14
14
  /** Unidades de vigencia de token; el conector aplica una sola a los tres tokens. */
15
15
  export const COGNITO_TOKEN_VALIDITY_UNITS: readonly string[] = ['seconds', 'minutes', 'hours', 'days'];
16
16
 
17
- /**
18
- * Config de un app client (el del pool nuevo de POST /pools o uno extra de POST /pools/{id}/clients).
19
- * Sin `generateSecret`: el conector fija GenerateSecret false (A21).
20
- */
17
+ /** Config de un app client (el del pool nuevo de POST /pools o uno extra de POST /pools/{id}/clients). */
21
18
  export class AppClientConfig {
22
19
  @Expose() @IsOptional() @IsString() clientName?: string;
23
20
  @Expose() @IsArray() @IsIn(COGNITO_EXPLICIT_AUTH_FLOWS, { each: true }) explicitAuthFlows!: string[];
@@ -29,4 +26,6 @@ export class AppClientConfig {
29
26
  @Expose() @IsOptional() @IsBoolean() enableTokenRevocation?: boolean;
30
27
  /** Atributos que el usuario puede escribir con su propio token. Ausente ⇒ todos (default de Cognito). */
31
28
  @Expose() @IsOptional() @IsArray() @IsString({ each: true }) writeAttributes?: string[];
29
+ /** Crea el client con secreto. Ausente ⇒ sin secreto. */
30
+ @Expose() @IsOptional() @IsBoolean() generateSecret?: boolean;
32
31
  }
@@ -1,4 +1,4 @@
1
- /** Respuesta de POST /pools/{userPoolId}/clients. Sin secret: el client nace con GenerateSecret false. */
1
+ /** Respuesta de POST /pools/{userPoolId}/clients. Nunca expone el secreto del client. */
2
2
  export class CreatePoolClientResponse {
3
3
  appClientId!: string;
4
4
  }
@@ -1,5 +1,5 @@
1
1
  import { Expose, Type } from 'class-transformer';
2
- import { IsArray, IsIn, IsOptional, IsString, ValidateNested } from 'class-validator';
2
+ import { IsArray, IsBoolean, IsIn, IsOptional, IsString, ValidateNested } from 'class-validator';
3
3
  import { PasswordPolicyConfig } from './PasswordPolicyConfig';
4
4
  import { CustomAttributeSpec } from './CustomAttributeSpec';
5
5
  import { AppClientConfig } from './AppClientConfig';
@@ -38,4 +38,7 @@ export class CreatePoolRequest {
38
38
  @IsArray()
39
39
  @IsIn(['email', 'phone_number'], { each: true })
40
40
  usernameAttributes?: Array<'email' | 'phone_number'>;
41
+
42
+ /** Solo un administrador puede crear usuarios en el pool. Ausente ⇒ default de Cognito. */
43
+ @Expose() @IsOptional() @IsBoolean() allowAdminCreateUserOnly?: boolean;
41
44
  }
@@ -1,10 +1,4 @@
1
- /**
2
- * Response del endpoint POST /pools (pivote v1.4.1 stateless).
3
- *
4
- * NO expone `clientSecret` — el SDK Cognito no lo devuelve cuando
5
- * `GenerateSecret: false` (BFF pattern A21). Si aparece consumer B2B/M2M
6
- * que requiera client secret, evaluar con líder + bump major del connector.
7
- */
1
+ /** Respuesta de POST /pools. Nunca expone el secreto del app client. */
8
2
  export class CreatePoolResponse {
9
3
  userPoolId!: string;
10
4
  userPoolArn!: string;
@@ -1,9 +1,12 @@
1
1
  import { Expose } from 'class-transformer';
2
- import { IsNotEmpty, IsString } from 'class-validator';
2
+ import { IsBoolean, IsNotEmpty, IsOptional, IsString } from 'class-validator';
3
3
 
4
4
  export class RefreshTokensRequest {
5
5
  @Expose() @IsString() @IsNotEmpty() userPoolId!: string;
6
6
  @Expose() @IsString() @IsNotEmpty() region!: string;
7
7
  @Expose() @IsString() @IsNotEmpty() clientId!: string;
8
8
  @Expose() @IsString() @IsNotEmpty() refreshToken!: string;
9
+ // Username de Cognito; hace falta para el SECRET_HASH.
10
+ @Expose() @IsOptional() @IsString() @IsNotEmpty() username?: string;
11
+ @Expose() @IsOptional() @IsBoolean() useClientSecret?: boolean;
9
12
  }
@@ -1,5 +1,5 @@
1
1
  import { Expose } from 'class-transformer';
2
- import { IsEnum, IsNotEmpty, IsObject, IsString } from 'class-validator';
2
+ import { IsBoolean, IsEnum, IsNotEmpty, IsObject, IsOptional, IsString } from 'class-validator';
3
3
  import { CognitoChallengeType } from '../enums/CognitoChallengeType';
4
4
 
5
5
  export class RespondToChallengeRequest {
@@ -9,4 +9,5 @@ export class RespondToChallengeRequest {
9
9
  @Expose() @IsEnum(CognitoChallengeType) challengeName!: CognitoChallengeType;
10
10
  @Expose() @IsString() @IsNotEmpty() session!: string;
11
11
  @Expose() @IsObject() challengeResponses!: Record<string, string>;
12
+ @Expose() @IsOptional() @IsBoolean() useClientSecret?: boolean;
12
13
  }
@@ -0,0 +1,11 @@
1
+ import { Expose } from 'class-transformer';
2
+ import { IsBoolean, IsNotEmpty, IsOptional, IsString } from 'class-validator';
3
+
4
+ /** Body de POST /auth/start-otp-login: inicia CUSTOM_AUTH sin SRP ni contraseña. */
5
+ export class StartOtpLoginRequest {
6
+ @Expose() @IsString() @IsNotEmpty() userPoolId!: string;
7
+ @Expose() @IsString() @IsNotEmpty() region!: string;
8
+ @Expose() @IsString() @IsNotEmpty() clientId!: string;
9
+ @Expose() @IsString() @IsNotEmpty() username!: string;
10
+ @Expose() @IsOptional() @IsBoolean() useClientSecret?: boolean;
11
+ }
@@ -23,6 +23,7 @@ export * from './dtos/AuthEventResponse';
23
23
  export * from './dtos/AuthTokensResponse';
24
24
  export * from './dtos/AuthStartLoginRequest';
25
25
  export * from './dtos/AuthStartLoginResponse';
26
+ export * from './dtos/StartOtpLoginRequest';
26
27
  export * from './dtos/InitiateAuthRequest';
27
28
  export * from './dtos/InitiateAuthResponse';
28
29
  export * from './dtos/VerifyPasswordRequest';
@@ -0,0 +1,8 @@
1
+ import { Expose } from 'class-transformer';
2
+ import { IsNotEmpty, IsString } from 'class-validator';
3
+
4
+ /** Body de POST /messages/otp/login-state. */
5
+ export class OtpLoginStateRequest {
6
+ @Expose() @IsString() @IsNotEmpty() directoryId!: string;
7
+ @Expose() @IsString() @IsNotEmpty() typeOfDirectoryId!: string;
8
+ }
@@ -0,0 +1,5 @@
1
+ /** Respuesta de POST /messages/otp/login-state. `lockedUntil` va en epoch ms. */
2
+ export class OtpLoginStateResponse {
3
+ lastFailureCode!: 'OTP_NOT_FOUND' | 'OTP_EXPIRED' | 'OTP_ALREADY_USED' | null;
4
+ lockedUntil!: number | null;
5
+ }
@@ -10,6 +10,8 @@ export * from './dtos/AgentSendNotificationRequest';
10
10
  export * from './dtos/SendMessageResponse';
11
11
  export * from './dtos/VerifyOtpRequest';
12
12
  export * from './dtos/VerifyOtpResponse';
13
+ export * from './dtos/OtpLoginStateRequest';
14
+ export * from './dtos/OtpLoginStateResponse';
13
15
  export * from './dtos/OtpValidatedResponse';
14
16
  export * from './dtos/NotificationResponse';
15
17
  export * from './dtos/NotificationsPageResponse';
@@ -3,6 +3,7 @@ import { PrincipalIdentifierEnum } from '../enums/PrincipalIdentifierEnum';
3
3
  import { ApplicationStatus } from '../enums/ApplicationStatus';
4
4
  import type { UserFieldDef } from '../dtos/UserFieldDef';
5
5
  import type { TokenValidationMode } from '../enums/TokenValidationMode';
6
+ import type { LoginModeEnum } from '../enums/LoginModeEnum';
6
7
 
7
8
  export interface LevelDef {
8
9
  level: PermissionScope; // LEVEL_1 | LEVEL_2 | LEVEL_3
@@ -55,6 +56,8 @@ export interface ApplicationDefaults {
55
56
  * UsernameAttributes del pool): true ⇒ pool con ['email','phone_number']. Heredado al tenant.
56
57
  */
57
58
  allowSecondary?: boolean;
59
+ /** Modo de login que heredan los tenants de esta aplicación; sin valor entran con contraseña. */
60
+ loginMode?: LoginModeEnum | null;
58
61
  /**
59
62
  * DEC-RBAC-111: política de contraseña que heredan los tenants creados desde esta aplicación.
60
63
  *
@@ -1,5 +1,6 @@
1
1
  import { IsBoolean, IsEnum, IsOptional } from 'class-validator';
2
2
  import { ChallengeNameEnum } from '../enums/ChallengeNameEnum';
3
+ import { LoginModeEnum } from '../enums/LoginModeEnum';
3
4
 
4
5
  export class DefineNextChallengeResponse {
5
6
  @IsOptional()
@@ -11,4 +12,8 @@ export class DefineNextChallengeResponse {
11
12
 
12
13
  @IsBoolean()
13
14
  failAuthentication!: boolean;
15
+
16
+ @IsOptional()
17
+ @IsEnum(LoginModeEnum)
18
+ loginMode?: LoginModeEnum;
14
19
  }
@@ -1,5 +1,6 @@
1
- import { IsEmail, IsEnum, IsOptional, IsString, ValidateIf } from 'class-validator';
1
+ import { IsBoolean, IsEmail, IsEnum, IsOptional, IsString, ValidateIf } from 'class-validator';
2
2
  import { ChallengeNameEnum } from '../enums/ChallengeNameEnum';
3
+ import { LoginModeEnum } from '../enums/LoginModeEnum';
3
4
 
4
5
  export class PrepareChallengeRequest {
5
6
  @IsString()
@@ -23,4 +24,13 @@ export class PrepareChallengeRequest {
23
24
  @IsOptional()
24
25
  @IsString()
25
26
  phone?: string;
27
+
28
+ @IsOptional()
29
+ @IsEnum(LoginModeEnum)
30
+ loginMode?: LoginModeEnum;
31
+
32
+ // Indica que la sesión ya trae un SMS_OTP fallido.
33
+ @IsOptional()
34
+ @IsBoolean()
35
+ isRetry?: boolean;
26
36
  }
@@ -0,0 +1,12 @@
1
+ import { Expose } from 'class-transformer';
2
+ import { IsNotEmpty, IsString, Matches } from 'class-validator';
3
+ import { PHONE_E164_PATTERN } from '../../common/constants/InputPatterns';
4
+
5
+ /** Body de POST /internal/tenants/{tenantId}/customer-accounts. */
6
+ export class EnsureCustomerAccountRequest {
7
+ @Expose() @IsString() @Matches(PHONE_E164_PATTERN) phone!: string;
8
+ @Expose() @IsString() @IsNotEmpty() retailCustomerId!: string;
9
+ @Expose() @IsString() @IsNotEmpty() directoryId!: string;
10
+ @Expose() @IsString() @IsNotEmpty() displayName!: string;
11
+ @Expose() @IsString() @IsNotEmpty() createdBy!: string;
12
+ }
@@ -0,0 +1,5 @@
1
+ /** Respuesta de POST /internal/tenants/{tenantId}/customer-accounts. */
2
+ export interface EnsureCustomerAccountResponse {
3
+ outcome: 'CREATED' | 'EXISTING';
4
+ cognitoSub: string;
5
+ }
@@ -0,0 +1,8 @@
1
+ import { Expose } from 'class-transformer';
2
+ import { IsNotEmpty, IsString } from 'class-validator';
3
+
4
+ /** Body de POST /auth/otp-login. */
5
+ export class OtpLoginRequest {
6
+ @Expose() @IsString() @IsNotEmpty() phone!: string;
7
+ @Expose() @IsString() @IsNotEmpty() tenantId!: string;
8
+ }
@@ -6,4 +6,6 @@ export interface UserProfileResponse {
6
6
  email?: string;
7
7
  phone?: string;
8
8
  status?: string;
9
+ retailCustomerId?: string | null;
10
+ directoryId?: string | null;
9
11
  }
@@ -0,0 +1,4 @@
1
+ /** Modo de login de un tenant. Sin valor, el tenant entra con contraseña. */
2
+ export enum LoginModeEnum {
3
+ OTP_ONLY = 'OTP_ONLY',
4
+ }
@@ -167,6 +167,8 @@ export enum Permission {
167
167
  TENANT_API_USER_MANAGE = 'tenant.api_user.manage',
168
168
  // Activa la integración de un retailer externo (Zentral); scope PLATFORM.
169
169
  PLATFORM_RETAIL_INTEGRATION_ACTIVATE = 'platform.retail_integration.activate',
170
+ // Lectura del portal del cliente.
171
+ CUSTOMER_PORTAL_READ = 'customer.portal.read',
170
172
  }
171
173
 
172
174
  /**
@@ -289,6 +291,7 @@ export const PERMISSION_BIT_ORDER: readonly Permission[] = [
289
291
  Permission.TENANT_INTEGRATION_DIAGNOSTIC,
290
292
  Permission.TENANT_API_USER_MANAGE,
291
293
  Permission.PLATFORM_RETAIL_INTEGRATION_ACTIVATE,
294
+ Permission.CUSTOMER_PORTAL_READ,
292
295
  ] as const;
293
296
 
294
297
  function djb2(input: string): number {