@fiado/api-invoker 1.2.35 → 1.2.37
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 +2 -2
- package/bin/cognitoConnector/CognitoConnectorV2.js +10 -12
- package/bin/cognitoConnector/index.d.ts +1 -1
- package/bin/cognitoConnector/index.js +1 -1
- package/bin/cognitoConnector/interfaces/ICognitoV2Api.d.ts +46 -0
- package/bin/cognitoConnector/interfaces/ICognitoV2Api.js +2 -0
- package/package.json +1 -1
- package/src/cognitoConnector/CognitoConnectorV2.ts +13 -14
- package/src/cognitoConnector/index.ts +1 -1
- package/src/cognitoConnector/interfaces/{ICognitoConnectorApiV2.ts → ICognitoV2Api.ts} +1 -1
|
@@ -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
|
-
import { HealthcheckResponse,
|
|
4
|
-
export declare class CognitoApi implements
|
|
3
|
+
import { HealthcheckResponse, ICognitoV2Api } from "./interfaces/ICognitoV2Api";
|
|
4
|
+
export declare class CognitoApi implements ICognitoV2Api {
|
|
5
5
|
private httpRequest;
|
|
6
6
|
private readonly baseUrl;
|
|
7
7
|
constructor(httpRequest: IHttpRequest);
|
|
@@ -17,49 +17,47 @@ const inversify_1 = require("inversify");
|
|
|
17
17
|
let CognitoApi = class CognitoApi {
|
|
18
18
|
constructor(httpRequest) {
|
|
19
19
|
this.httpRequest = httpRequest;
|
|
20
|
-
// Puedes usar la variable de entorno que quieras;
|
|
21
|
-
// en este caso, la llamamos COGNITO_CONNECTOR_LAMBDA_URL
|
|
22
20
|
this.baseUrl = process.env.COGNITO_CONNECTOR_LAMBDA_URL || "";
|
|
23
21
|
}
|
|
24
22
|
async healthcheck() {
|
|
25
|
-
const url = `${this.baseUrl}
|
|
23
|
+
const url = `${this.baseUrl}healthcheck`;
|
|
26
24
|
return this.httpRequest.get(url);
|
|
27
25
|
}
|
|
28
26
|
async signUp(request) {
|
|
29
|
-
const url = `${this.baseUrl}
|
|
27
|
+
const url = `${this.baseUrl}cognito/signUp`;
|
|
30
28
|
return this.httpRequest.post(url, request);
|
|
31
29
|
}
|
|
32
30
|
async signUpConfirm(request) {
|
|
33
|
-
const url = `${this.baseUrl}
|
|
31
|
+
const url = `${this.baseUrl}cognito/signUp/confirm`;
|
|
34
32
|
// Como el endpoint retorna un 200 vacío, devuelves void
|
|
35
33
|
await this.httpRequest.post(url, request);
|
|
36
34
|
}
|
|
37
35
|
async signIn(request) {
|
|
38
|
-
const url = `${this.baseUrl}
|
|
36
|
+
const url = `${this.baseUrl}cognito/signIn`;
|
|
39
37
|
return this.httpRequest.post(url, request);
|
|
40
38
|
}
|
|
41
39
|
async signOut() {
|
|
42
|
-
const url = `${this.baseUrl}
|
|
40
|
+
const url = `${this.baseUrl}cognito/signOut`;
|
|
43
41
|
await this.httpRequest.post(url, {});
|
|
44
42
|
}
|
|
45
43
|
async changePassword(request) {
|
|
46
|
-
const url = `${this.baseUrl}
|
|
44
|
+
const url = `${this.baseUrl}cognito/user/changePassword`;
|
|
47
45
|
await this.httpRequest.post(url, request);
|
|
48
46
|
}
|
|
49
47
|
async getUser(request) {
|
|
50
|
-
const url = `${this.baseUrl}
|
|
48
|
+
const url = `${this.baseUrl}cognito/user`;
|
|
51
49
|
return this.httpRequest.post(url, request);
|
|
52
50
|
}
|
|
53
51
|
async refreshToken(request) {
|
|
54
|
-
const url = `${this.baseUrl}
|
|
52
|
+
const url = `${this.baseUrl}cognito/refreshToken`;
|
|
55
53
|
return this.httpRequest.post(url, request);
|
|
56
54
|
}
|
|
57
55
|
async respondToAuthChallenge(request) {
|
|
58
|
-
const url = `${this.baseUrl}
|
|
56
|
+
const url = `${this.baseUrl}cognito/respondToAuthChallenge`;
|
|
59
57
|
return this.httpRequest.post(url, request);
|
|
60
58
|
}
|
|
61
59
|
async resetPassword(request) {
|
|
62
|
-
const url = `${this.baseUrl}
|
|
60
|
+
const url = `${this.baseUrl}cognito/resetPassword`;
|
|
63
61
|
await this.httpRequest.post(url, request);
|
|
64
62
|
}
|
|
65
63
|
};
|
|
@@ -16,4 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./interfaces/ICognitoConnectorApi"), exports);
|
|
18
18
|
__exportStar(require("./CognitoConnectorApi"), exports);
|
|
19
|
-
__exportStar(require("./interfaces/
|
|
19
|
+
__exportStar(require("./interfaces/ICognitoV2Api"), exports);
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ChangePasswordRequest, GetUserRequest, GetUserResponse, RefreshTokenRequest, RefreshTokenResponse, RespondToAuthChallengeRequest, SetPasswordRequest, SignInRequest, SignInResponse, SignUpConfirmRequest, SignUpRequest, SignUpResponse } from "@fiado/type-kit/bin/cognitoConnector";
|
|
2
|
+
export interface ICognitoV2Api {
|
|
3
|
+
/**
|
|
4
|
+
* Healthcheck for the cognito-connector
|
|
5
|
+
*/
|
|
6
|
+
healthcheck(): Promise<HealthcheckResponse>;
|
|
7
|
+
/**
|
|
8
|
+
* Create a new user in Cognito
|
|
9
|
+
*/
|
|
10
|
+
signUp(request: SignUpRequest): Promise<SignUpResponse>;
|
|
11
|
+
/**
|
|
12
|
+
* Confirm sign-up for a user in Cognito
|
|
13
|
+
*/
|
|
14
|
+
signUpConfirm(request: SignUpConfirmRequest): Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* Sign in a user
|
|
17
|
+
*/
|
|
18
|
+
signIn(request: SignInRequest): Promise<SignInResponse>;
|
|
19
|
+
/**
|
|
20
|
+
* Sign out a user
|
|
21
|
+
*/
|
|
22
|
+
signOut(): Promise<void>;
|
|
23
|
+
/**
|
|
24
|
+
* Change a user's password
|
|
25
|
+
*/
|
|
26
|
+
changePassword(request: ChangePasswordRequest): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Retrieve user details
|
|
29
|
+
*/
|
|
30
|
+
getUser(request: GetUserRequest): Promise<GetUserResponse>;
|
|
31
|
+
/**
|
|
32
|
+
* Refresh a user's tokens
|
|
33
|
+
*/
|
|
34
|
+
refreshToken(request: RefreshTokenRequest): Promise<RefreshTokenResponse>;
|
|
35
|
+
/**
|
|
36
|
+
* Respond to an auth challenge
|
|
37
|
+
*/
|
|
38
|
+
respondToAuthChallenge(request: RespondToAuthChallengeRequest): Promise<any>;
|
|
39
|
+
/**
|
|
40
|
+
* Reset a user's password
|
|
41
|
+
*/
|
|
42
|
+
resetPassword(request: SetPasswordRequest): Promise<void>;
|
|
43
|
+
}
|
|
44
|
+
export interface HealthcheckResponse {
|
|
45
|
+
status: string;
|
|
46
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fiado/api-invoker",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.37",
|
|
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",
|
|
@@ -14,66 +14,65 @@ import {
|
|
|
14
14
|
RespondToAuthChallengeRequest,
|
|
15
15
|
SetPasswordRequest
|
|
16
16
|
} from "@fiado/type-kit/bin/cognitoConnector";
|
|
17
|
-
import { HealthcheckResponse,
|
|
17
|
+
import { HealthcheckResponse, ICognitoV2Api } from "./interfaces/ICognitoV2Api";
|
|
18
18
|
|
|
19
19
|
@injectable()
|
|
20
|
-
export class CognitoApi implements
|
|
20
|
+
export class CognitoApi implements ICognitoV2Api {
|
|
21
21
|
private readonly baseUrl: string;
|
|
22
22
|
|
|
23
23
|
constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {
|
|
24
|
-
|
|
25
|
-
// en este caso, la llamamos COGNITO_CONNECTOR_LAMBDA_URL
|
|
24
|
+
|
|
26
25
|
this.baseUrl = process.env.COGNITO_CONNECTOR_LAMBDA_URL || "";
|
|
27
26
|
}
|
|
28
27
|
|
|
29
28
|
async healthcheck(): Promise<HealthcheckResponse> {
|
|
30
|
-
const url = `${this.baseUrl}
|
|
29
|
+
const url = `${this.baseUrl}healthcheck`;
|
|
31
30
|
return this.httpRequest.get(url);
|
|
32
31
|
}
|
|
33
32
|
|
|
34
33
|
async signUp(request: SignUpRequest): Promise<SignUpResponse> {
|
|
35
|
-
const url = `${this.baseUrl}
|
|
34
|
+
const url = `${this.baseUrl}cognito/signUp`;
|
|
36
35
|
return this.httpRequest.post(url, request);
|
|
37
36
|
}
|
|
38
37
|
|
|
39
38
|
async signUpConfirm(request: SignUpConfirmRequest): Promise<void> {
|
|
40
|
-
const url = `${this.baseUrl}
|
|
39
|
+
const url = `${this.baseUrl}cognito/signUp/confirm`;
|
|
41
40
|
// Como el endpoint retorna un 200 vacío, devuelves void
|
|
42
41
|
await this.httpRequest.post(url, request);
|
|
43
42
|
}
|
|
44
43
|
|
|
45
44
|
async signIn(request: SignInRequest): Promise<SignInResponse> {
|
|
46
|
-
const url = `${this.baseUrl}
|
|
45
|
+
const url = `${this.baseUrl}cognito/signIn`;
|
|
47
46
|
return this.httpRequest.post(url, request);
|
|
48
47
|
}
|
|
49
48
|
|
|
50
49
|
async signOut(): Promise<void> {
|
|
51
|
-
const url = `${this.baseUrl}
|
|
50
|
+
const url = `${this.baseUrl}cognito/signOut`;
|
|
52
51
|
await this.httpRequest.post(url, {});
|
|
53
52
|
}
|
|
54
53
|
|
|
55
54
|
async changePassword(request: ChangePasswordRequest): Promise<void> {
|
|
56
|
-
const url = `${this.baseUrl}
|
|
55
|
+
const url = `${this.baseUrl}cognito/user/changePassword`;
|
|
57
56
|
await this.httpRequest.post(url, request);
|
|
58
57
|
}
|
|
59
58
|
|
|
60
59
|
async getUser(request: GetUserRequest): Promise<GetUserResponse> {
|
|
61
|
-
const url = `${this.baseUrl}
|
|
60
|
+
const url = `${this.baseUrl}cognito/user`;
|
|
62
61
|
return this.httpRequest.post(url, request);
|
|
63
62
|
}
|
|
64
63
|
|
|
65
64
|
async refreshToken(request: RefreshTokenRequest): Promise<RefreshTokenResponse> {
|
|
66
|
-
const url = `${this.baseUrl}
|
|
65
|
+
const url = `${this.baseUrl}cognito/refreshToken`;
|
|
67
66
|
return this.httpRequest.post(url, request);
|
|
68
67
|
}
|
|
69
68
|
|
|
70
69
|
async respondToAuthChallenge(request: RespondToAuthChallengeRequest): Promise<any> {
|
|
71
|
-
const url = `${this.baseUrl}
|
|
70
|
+
const url = `${this.baseUrl}cognito/respondToAuthChallenge`;
|
|
72
71
|
return this.httpRequest.post(url, request);
|
|
73
72
|
}
|
|
74
73
|
|
|
75
74
|
async resetPassword(request: SetPasswordRequest): Promise<void> {
|
|
76
|
-
const url = `${this.baseUrl}
|
|
75
|
+
const url = `${this.baseUrl}cognito/resetPassword`;
|
|
77
76
|
await this.httpRequest.post(url, request);
|
|
78
77
|
}
|
|
79
78
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ChangePasswordRequest, GetUserRequest, GetUserResponse, RefreshTokenRequest, RefreshTokenResponse, RespondToAuthChallengeRequest, SetPasswordRequest, SignInRequest, SignInResponse, SignUpConfirmRequest, SignUpRequest, SignUpResponse } from "@fiado/type-kit/bin/cognitoConnector";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
export interface
|
|
4
|
+
export interface ICognitoV2Api {
|
|
5
5
|
/**
|
|
6
6
|
* Healthcheck for the cognito-connector
|
|
7
7
|
*/
|