@jmlq/auth 0.0.1-alpha.27 → 0.0.1-alpha.29
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.
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { IAuthServiceContainer } from "../../infrastructure";
|
|
1
|
+
import type { IAuthServiceContainer } from "../../infrastructure";
|
|
2
|
+
import type { ChangePasswordRequest, LoginRequest, LogoutRequest, RefreshTokenRequest, RegisterUserRequest, RequestPasswordResetRequest, ResetPasswordRequest } from "../dtos/request";
|
|
3
|
+
import type { ChangePasswordResponse, LoginResponse, LogoutResponse, RefreshTokenResponse, RegisterUserResponse, RequestPasswordResetResponse, ResetPasswordResponse } from "../dtos/response";
|
|
2
4
|
/**
|
|
3
5
|
* Facade delgada para integrar @jmlq/auth en hosts (APIs externas).
|
|
4
6
|
*
|
|
@@ -9,15 +11,21 @@ import { IAuthServiceContainer } from "../../infrastructure";
|
|
|
9
11
|
* No hace:
|
|
10
12
|
* - Validaciones de negocio.
|
|
11
13
|
* - Conocimiento de Express, TypeORM, jose, etc.
|
|
14
|
+
*
|
|
15
|
+
* Nota de tipado:
|
|
16
|
+
* - Cada use-case.execute(...) retorna Promise<T>.
|
|
17
|
+
* - Por eso aquí exponemos Promise<T> (NO Promise<Promise<T>>).
|
|
18
|
+
* - Para evitar fragilidad y ruido, tipamos con DTOs públicos (request/response),
|
|
19
|
+
* no con "index access types" sobre el container.
|
|
12
20
|
*/
|
|
13
21
|
export declare class AuthFacade {
|
|
14
22
|
private readonly container;
|
|
15
23
|
constructor(container: IAuthServiceContainer);
|
|
16
|
-
registerUser(request:
|
|
17
|
-
loginWithPassword(request:
|
|
18
|
-
refreshToken(request:
|
|
19
|
-
logout(request:
|
|
20
|
-
changePassword(request:
|
|
21
|
-
requestPasswordReset(request:
|
|
22
|
-
resetPassword(request:
|
|
24
|
+
registerUser(request: RegisterUserRequest): Promise<RegisterUserResponse>;
|
|
25
|
+
loginWithPassword(request: LoginRequest): Promise<LoginResponse>;
|
|
26
|
+
refreshToken(request: RefreshTokenRequest): Promise<RefreshTokenResponse>;
|
|
27
|
+
logout(request: LogoutRequest): Promise<LogoutResponse>;
|
|
28
|
+
changePassword(request: ChangePasswordRequest): Promise<ChangePasswordResponse>;
|
|
29
|
+
requestPasswordReset(request: RequestPasswordResetRequest): Promise<RequestPasswordResetResponse>;
|
|
30
|
+
resetPassword(request: ResetPasswordRequest): Promise<ResetPasswordResponse>;
|
|
23
31
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
//src/application/facades/auth.facade.ts
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
4
|
exports.AuthFacade = void 0;
|
|
4
5
|
/**
|
|
@@ -11,6 +12,12 @@ exports.AuthFacade = void 0;
|
|
|
11
12
|
* No hace:
|
|
12
13
|
* - Validaciones de negocio.
|
|
13
14
|
* - Conocimiento de Express, TypeORM, jose, etc.
|
|
15
|
+
*
|
|
16
|
+
* Nota de tipado:
|
|
17
|
+
* - Cada use-case.execute(...) retorna Promise<T>.
|
|
18
|
+
* - Por eso aquí exponemos Promise<T> (NO Promise<Promise<T>>).
|
|
19
|
+
* - Para evitar fragilidad y ruido, tipamos con DTOs públicos (request/response),
|
|
20
|
+
* no con "index access types" sobre el container.
|
|
14
21
|
*/
|
|
15
22
|
class AuthFacade {
|
|
16
23
|
constructor(container) {
|
|
@@ -19,28 +26,28 @@ class AuthFacade {
|
|
|
19
26
|
// -------------------------
|
|
20
27
|
// Identity / Auth flows
|
|
21
28
|
// -------------------------
|
|
22
|
-
|
|
29
|
+
registerUser(request) {
|
|
23
30
|
return this.container.registerUserUseCase.execute(request);
|
|
24
31
|
}
|
|
25
|
-
|
|
32
|
+
loginWithPassword(request) {
|
|
26
33
|
return this.container.loginWithPasswordUseCase.execute(request);
|
|
27
34
|
}
|
|
28
|
-
|
|
35
|
+
refreshToken(request) {
|
|
29
36
|
return this.container.refreshTokenUseCase.execute(request);
|
|
30
37
|
}
|
|
31
|
-
|
|
38
|
+
logout(request) {
|
|
32
39
|
return this.container.logoutUseCase.execute(request);
|
|
33
40
|
}
|
|
34
|
-
|
|
41
|
+
changePassword(request) {
|
|
35
42
|
return this.container.changePasswordUseCase.execute(request);
|
|
36
43
|
}
|
|
37
44
|
// -------------------------
|
|
38
45
|
// Password reset flows
|
|
39
46
|
// -------------------------
|
|
40
|
-
|
|
47
|
+
requestPasswordReset(request) {
|
|
41
48
|
return this.container.requestPasswordResetUseCase.execute(request);
|
|
42
49
|
}
|
|
43
|
-
|
|
50
|
+
resetPassword(request) {
|
|
44
51
|
return this.container.resetPasswordUseCase.execute(request);
|
|
45
52
|
}
|
|
46
53
|
}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -14,7 +14,9 @@ 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.readNonEmptyString = exports.InvalidJwtPayloadError = exports.normalizeJwtPayload = void 0;
|
|
17
|
+
exports.readNonEmptyString = exports.InvalidJwtPayloadError = exports.normalizeJwtPayload = exports.optionalAudience = void 0;
|
|
18
|
+
var helpers_1 = require("./domain/services/helpers");
|
|
19
|
+
Object.defineProperty(exports, "optionalAudience", { enumerable: true, get: function () { return helpers_1.optionalAudience; } });
|
|
18
20
|
/**
|
|
19
21
|
* Contrato público (JWT payload):
|
|
20
22
|
* - Los plugins devuelven payload verificado criptográficamente como unknown.
|
|
@@ -34,8 +36,8 @@ __exportStar(require("./domain/ports"), exports);
|
|
|
34
36
|
// Entities
|
|
35
37
|
__exportStar(require("./domain/entities"), exports);
|
|
36
38
|
// Helpers
|
|
37
|
-
var
|
|
38
|
-
Object.defineProperty(exports, "readNonEmptyString", { enumerable: true, get: function () { return
|
|
39
|
+
var helpers_2 = require("./domain/services/helpers");
|
|
40
|
+
Object.defineProperty(exports, "readNonEmptyString", { enumerable: true, get: function () { return helpers_2.readNonEmptyString; } });
|
|
39
41
|
// VOs
|
|
40
42
|
__exportStar(require("./domain/object-values"), exports);
|
|
41
43
|
// Props (JWT generation inputs, etc.)
|