@fiado/api-invoker 1.2.36 → 1.2.38
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/bin/cognitoConnector/CognitoConnectorV2.d.ts +1 -1
- package/bin/cognitoConnector/CognitoConnectorV2.js +12 -15
- package/bin/cognitoConnector/index.d.ts +1 -0
- package/bin/cognitoConnector/index.js +1 -0
- package/package.json +1 -1
- package/src/cognitoConnector/CognitoConnectorV2.ts +13 -17
- package/src/cognitoConnector/index.ts +1 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IHttpRequest } from "@fiado/http-client";
|
|
2
2
|
import { SignUpRequest, SignUpResponse, SignUpConfirmRequest, SignInRequest, SignInResponse, ChangePasswordRequest, GetUserRequest, GetUserResponse, RefreshTokenRequest, RefreshTokenResponse, RespondToAuthChallengeRequest, SetPasswordRequest } from "@fiado/type-kit/bin/cognitoConnector";
|
|
3
3
|
import { HealthcheckResponse, ICognitoV2Api } from "./interfaces/ICognitoV2Api";
|
|
4
|
-
export
|
|
4
|
+
export default class CognitoApi implements ICognitoV2Api {
|
|
5
5
|
private httpRequest;
|
|
6
6
|
private readonly baseUrl;
|
|
7
7
|
constructor(httpRequest: IHttpRequest);
|
|
@@ -12,60 +12,57 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
12
12
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.CognitoApi = void 0;
|
|
16
15
|
const inversify_1 = require("inversify");
|
|
17
16
|
let CognitoApi = class CognitoApi {
|
|
18
17
|
constructor(httpRequest) {
|
|
19
18
|
this.httpRequest = httpRequest;
|
|
20
|
-
// Puedes usar la variable de entorno que quieras;
|
|
21
|
-
// en este caso, la llamamos COGNITO_CONNECTOR_LAMBDA_URL
|
|
22
19
|
this.baseUrl = process.env.COGNITO_CONNECTOR_LAMBDA_URL || "";
|
|
23
20
|
}
|
|
24
21
|
async healthcheck() {
|
|
25
|
-
const url = `${this.baseUrl}
|
|
22
|
+
const url = `${this.baseUrl}healthcheck`;
|
|
26
23
|
return this.httpRequest.get(url);
|
|
27
24
|
}
|
|
28
25
|
async signUp(request) {
|
|
29
|
-
const url = `${this.baseUrl}
|
|
26
|
+
const url = `${this.baseUrl}cognito/signUp`;
|
|
30
27
|
return this.httpRequest.post(url, request);
|
|
31
28
|
}
|
|
32
29
|
async signUpConfirm(request) {
|
|
33
|
-
const url = `${this.baseUrl}
|
|
30
|
+
const url = `${this.baseUrl}cognito/signUp/confirm`;
|
|
34
31
|
// Como el endpoint retorna un 200 vacío, devuelves void
|
|
35
32
|
await this.httpRequest.post(url, request);
|
|
36
33
|
}
|
|
37
34
|
async signIn(request) {
|
|
38
|
-
const url = `${this.baseUrl}
|
|
35
|
+
const url = `${this.baseUrl}cognito/signIn`;
|
|
39
36
|
return this.httpRequest.post(url, request);
|
|
40
37
|
}
|
|
41
38
|
async signOut() {
|
|
42
|
-
const url = `${this.baseUrl}
|
|
39
|
+
const url = `${this.baseUrl}cognito/signOut`;
|
|
43
40
|
await this.httpRequest.post(url, {});
|
|
44
41
|
}
|
|
45
42
|
async changePassword(request) {
|
|
46
|
-
const url = `${this.baseUrl}
|
|
43
|
+
const url = `${this.baseUrl}cognito/user/changePassword`;
|
|
47
44
|
await this.httpRequest.post(url, request);
|
|
48
45
|
}
|
|
49
46
|
async getUser(request) {
|
|
50
|
-
const url = `${this.baseUrl}
|
|
47
|
+
const url = `${this.baseUrl}cognito/user`;
|
|
51
48
|
return this.httpRequest.post(url, request);
|
|
52
49
|
}
|
|
53
50
|
async refreshToken(request) {
|
|
54
|
-
const url = `${this.baseUrl}
|
|
51
|
+
const url = `${this.baseUrl}cognito/refreshToken`;
|
|
55
52
|
return this.httpRequest.post(url, request);
|
|
56
53
|
}
|
|
57
54
|
async respondToAuthChallenge(request) {
|
|
58
|
-
const url = `${this.baseUrl}
|
|
55
|
+
const url = `${this.baseUrl}cognito/respondToAuthChallenge`;
|
|
59
56
|
return this.httpRequest.post(url, request);
|
|
60
57
|
}
|
|
61
58
|
async resetPassword(request) {
|
|
62
|
-
const url = `${this.baseUrl}
|
|
59
|
+
const url = `${this.baseUrl}cognito/resetPassword`;
|
|
63
60
|
await this.httpRequest.post(url, request);
|
|
64
61
|
}
|
|
65
62
|
};
|
|
66
|
-
|
|
67
|
-
exports.CognitoApi = CognitoApi = __decorate([
|
|
63
|
+
CognitoApi = __decorate([
|
|
68
64
|
(0, inversify_1.injectable)(),
|
|
69
65
|
__param(0, (0, inversify_1.inject)("IHttpRequest")),
|
|
70
66
|
__metadata("design:paramtypes", [Object])
|
|
71
67
|
], CognitoApi);
|
|
68
|
+
exports.default = CognitoApi;
|
|
@@ -17,3 +17,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./interfaces/ICognitoConnectorApi"), exports);
|
|
18
18
|
__exportStar(require("./CognitoConnectorApi"), exports);
|
|
19
19
|
__exportStar(require("./interfaces/ICognitoV2Api"), exports);
|
|
20
|
+
__exportStar(require("./CognitoConnectorV2"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fiado/api-invoker",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.38",
|
|
4
4
|
"description": "Sirve como un puente entre diferentes funciones lambda, facilitando la comunicación entre ellas a través de invocaciones http",
|
|
5
5
|
"main": "bin/index.js",
|
|
6
6
|
"types": "bin/index.d.ts",
|
|
@@ -17,63 +17,59 @@ import {
|
|
|
17
17
|
import { HealthcheckResponse, ICognitoV2Api } from "./interfaces/ICognitoV2Api";
|
|
18
18
|
|
|
19
19
|
@injectable()
|
|
20
|
-
export class CognitoApi implements ICognitoV2Api {
|
|
21
|
-
private readonly baseUrl: string;
|
|
20
|
+
export default class CognitoApi implements ICognitoV2Api {
|
|
22
21
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
// en este caso, la llamamos COGNITO_CONNECTOR_LAMBDA_URL
|
|
26
|
-
this.baseUrl = process.env.COGNITO_CONNECTOR_LAMBDA_URL || "";
|
|
27
|
-
}
|
|
22
|
+
private readonly baseUrl = process.env.COGNITO_CONNECTOR_LAMBDA_URL || "";
|
|
23
|
+
constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) { }
|
|
28
24
|
|
|
29
25
|
async healthcheck(): Promise<HealthcheckResponse> {
|
|
30
|
-
const url = `${this.baseUrl}
|
|
26
|
+
const url = `${this.baseUrl}healthcheck`;
|
|
31
27
|
return this.httpRequest.get(url);
|
|
32
28
|
}
|
|
33
29
|
|
|
34
30
|
async signUp(request: SignUpRequest): Promise<SignUpResponse> {
|
|
35
|
-
const url = `${this.baseUrl}
|
|
31
|
+
const url = `${this.baseUrl}cognito/signUp`;
|
|
36
32
|
return this.httpRequest.post(url, request);
|
|
37
33
|
}
|
|
38
34
|
|
|
39
35
|
async signUpConfirm(request: SignUpConfirmRequest): Promise<void> {
|
|
40
|
-
const url = `${this.baseUrl}
|
|
36
|
+
const url = `${this.baseUrl}cognito/signUp/confirm`;
|
|
41
37
|
// Como el endpoint retorna un 200 vacío, devuelves void
|
|
42
38
|
await this.httpRequest.post(url, request);
|
|
43
39
|
}
|
|
44
40
|
|
|
45
41
|
async signIn(request: SignInRequest): Promise<SignInResponse> {
|
|
46
|
-
const url = `${this.baseUrl}
|
|
42
|
+
const url = `${this.baseUrl}cognito/signIn`;
|
|
47
43
|
return this.httpRequest.post(url, request);
|
|
48
44
|
}
|
|
49
45
|
|
|
50
46
|
async signOut(): Promise<void> {
|
|
51
|
-
const url = `${this.baseUrl}
|
|
47
|
+
const url = `${this.baseUrl}cognito/signOut`;
|
|
52
48
|
await this.httpRequest.post(url, {});
|
|
53
49
|
}
|
|
54
50
|
|
|
55
51
|
async changePassword(request: ChangePasswordRequest): Promise<void> {
|
|
56
|
-
const url = `${this.baseUrl}
|
|
52
|
+
const url = `${this.baseUrl}cognito/user/changePassword`;
|
|
57
53
|
await this.httpRequest.post(url, request);
|
|
58
54
|
}
|
|
59
55
|
|
|
60
56
|
async getUser(request: GetUserRequest): Promise<GetUserResponse> {
|
|
61
|
-
const url = `${this.baseUrl}
|
|
57
|
+
const url = `${this.baseUrl}cognito/user`;
|
|
62
58
|
return this.httpRequest.post(url, request);
|
|
63
59
|
}
|
|
64
60
|
|
|
65
61
|
async refreshToken(request: RefreshTokenRequest): Promise<RefreshTokenResponse> {
|
|
66
|
-
const url = `${this.baseUrl}
|
|
62
|
+
const url = `${this.baseUrl}cognito/refreshToken`;
|
|
67
63
|
return this.httpRequest.post(url, request);
|
|
68
64
|
}
|
|
69
65
|
|
|
70
66
|
async respondToAuthChallenge(request: RespondToAuthChallengeRequest): Promise<any> {
|
|
71
|
-
const url = `${this.baseUrl}
|
|
67
|
+
const url = `${this.baseUrl}cognito/respondToAuthChallenge`;
|
|
72
68
|
return this.httpRequest.post(url, request);
|
|
73
69
|
}
|
|
74
70
|
|
|
75
71
|
async resetPassword(request: SetPasswordRequest): Promise<void> {
|
|
76
|
-
const url = `${this.baseUrl}
|
|
72
|
+
const url = `${this.baseUrl}cognito/resetPassword`;
|
|
77
73
|
await this.httpRequest.post(url, request);
|
|
78
74
|
}
|
|
79
75
|
}
|