@fiado/api-invoker 4.51.0 → 4.52.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.
- package/bin/authentication/AuthenticationApi.d.ts +6 -2
- package/bin/authentication/AuthenticationApi.js +18 -0
- package/bin/authentication/interfaces/IAuthenticationApi.d.ts +24 -0
- package/bin/authentication/interfaces/LegacyApiResponse.d.ts +7 -0
- package/bin/authentication/interfaces/LegacyApiResponse.js +1 -0
- package/package.json +1 -1
- package/src/authentication/AuthenticationApi.ts +29 -3
- package/src/authentication/index.ts +1 -4
- package/src/authentication/interfaces/IAuthenticationApi.ts +41 -1
- package/src/authentication/interfaces/LegacyApiResponse.ts +11 -0
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import { IHttpRequest } from "@fiado/http-client";
|
|
1
|
+
import type { IHttpRequest } from "@fiado/http-client";
|
|
2
2
|
import { SignUpAdditionalRequest, SignUpUserBackofficeRequest } from "@fiado/type-kit/bin/authentication/index.js";
|
|
3
|
-
import { IAuthenticationApi } from "./interfaces/IAuthenticationApi.js";
|
|
3
|
+
import { AgentSignInStatusInput, AgentSignUpProspectInput, IAuthenticationApi } from "./interfaces/IAuthenticationApi.js";
|
|
4
|
+
import { LegacyApiResponse } from "./interfaces/LegacyApiResponse.js";
|
|
4
5
|
export declare class AuthenticationApi implements IAuthenticationApi {
|
|
5
6
|
private httpRequest;
|
|
6
7
|
constructor(httpRequest: IHttpRequest);
|
|
7
8
|
signUpAdditionalCard(createAdditionalCard: SignUpAdditionalRequest): Promise<any>;
|
|
8
9
|
deleteAuthSessionByDirectoryId(directoryId: string): Promise<any>;
|
|
9
10
|
signUpBackofficeBulk(input: SignUpUserBackofficeRequest[]): Promise<any>;
|
|
11
|
+
agentSignInStatus(input: AgentSignInStatusInput, actorEmail: string): Promise<LegacyApiResponse<unknown>>;
|
|
12
|
+
agentSignUpProspect(input: AgentSignUpProspectInput, actorEmail: string): Promise<LegacyApiResponse<unknown>>;
|
|
13
|
+
agentGetSignUpByPhone(phoneNumber: string): Promise<LegacyApiResponse<unknown>>;
|
|
10
14
|
}
|
|
@@ -31,6 +31,24 @@ let AuthenticationApi = class AuthenticationApi {
|
|
|
31
31
|
const operation = "postSignUpBackofficeBulk";
|
|
32
32
|
return await this.httpRequest.post(url, input, { 'operationName': operation });
|
|
33
33
|
}
|
|
34
|
+
async agentSignInStatus(input, actorEmail) {
|
|
35
|
+
const url = `${process.env.AUTH_LAMBDA_URL}`;
|
|
36
|
+
const operation = "postSignInPhoneNumberAgent";
|
|
37
|
+
return await this.httpRequest.post(url, { ...input, actorEmail }, { 'operationName': operation });
|
|
38
|
+
}
|
|
39
|
+
async agentSignUpProspect(input, actorEmail) {
|
|
40
|
+
const url = `${process.env.AUTH_LAMBDA_URL}`;
|
|
41
|
+
const operation = "agentPostSignUp";
|
|
42
|
+
return await this.httpRequest.post(url, { ...input, actorEmail }, { 'operationName': operation });
|
|
43
|
+
}
|
|
44
|
+
async agentGetSignUpByPhone(phoneNumber) {
|
|
45
|
+
if (!phoneNumber) {
|
|
46
|
+
throw new Error("phoneNumber is required.");
|
|
47
|
+
}
|
|
48
|
+
const url = `${process.env.AUTH_LAMBDA_URL}`;
|
|
49
|
+
const operation = "agentGetSignUpByPhoneNumber";
|
|
50
|
+
return await this.httpRequest.post(url, { pathParameters: { phoneNumber } }, { 'operationName': operation });
|
|
51
|
+
}
|
|
34
52
|
};
|
|
35
53
|
AuthenticationApi = __decorate([
|
|
36
54
|
injectable(),
|
|
@@ -1,6 +1,30 @@
|
|
|
1
1
|
import { DirectoryBatchSummaryResponse, SignUpAdditionalRequest, SignUpUserBackofficeRequest } from "@fiado/type-kit/bin/authentication/index.js";
|
|
2
|
+
import { LegacyApiResponse } from "./LegacyApiResponse.js";
|
|
3
|
+
export interface AgentSignInStatusInput {
|
|
4
|
+
phoneNumber: string;
|
|
5
|
+
app: string;
|
|
6
|
+
platform: string;
|
|
7
|
+
version: string;
|
|
8
|
+
ip?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface AgentSignUpProspectInput {
|
|
11
|
+
name: string;
|
|
12
|
+
phoneNumber: string;
|
|
13
|
+
countryOfBirth: string;
|
|
14
|
+
countryOfDomicile: string;
|
|
15
|
+
email: string;
|
|
16
|
+
secondaryPhoneNumber?: string;
|
|
17
|
+
referralCode?: string | null;
|
|
18
|
+
stateOfBirth?: string | null;
|
|
19
|
+
otpCode?: string | null;
|
|
20
|
+
MEX_DebitAccountWish?: boolean;
|
|
21
|
+
USA_DebitAccountWish?: boolean;
|
|
22
|
+
}
|
|
2
23
|
export interface IAuthenticationApi {
|
|
3
24
|
signUpAdditionalCard(createAdditionalCard: SignUpAdditionalRequest): Promise<any>;
|
|
4
25
|
deleteAuthSessionByDirectoryId(directoryId: string): Promise<any>;
|
|
5
26
|
signUpBackofficeBulk(input: SignUpUserBackofficeRequest[]): Promise<DirectoryBatchSummaryResponse>;
|
|
27
|
+
agentSignInStatus(input: AgentSignInStatusInput, actorEmail: string): Promise<LegacyApiResponse<unknown>>;
|
|
28
|
+
agentSignUpProspect(input: AgentSignUpProspectInput, actorEmail: string): Promise<LegacyApiResponse<unknown>>;
|
|
29
|
+
agentGetSignUpByPhone(phoneNumber: string): Promise<LegacyApiResponse<unknown>>;
|
|
6
30
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fiado/api-invoker",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.52.0",
|
|
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
|
"type": "module",
|
|
6
6
|
"main": "bin/index.js",
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { IHttpRequest } from "@fiado/http-client";
|
|
1
|
+
import type { IHttpRequest } from "@fiado/http-client";
|
|
2
2
|
import { SignUpAdditionalRequest, SignUpUserBackofficeRequest } from "@fiado/type-kit/bin/authentication/index.js";
|
|
3
3
|
import { inject, injectable } from "inversify";
|
|
4
|
-
import { IAuthenticationApi } from "./interfaces/IAuthenticationApi.js";
|
|
4
|
+
import { AgentSignInStatusInput, AgentSignUpProspectInput, IAuthenticationApi } from "./interfaces/IAuthenticationApi.js";
|
|
5
|
+
import { LegacyApiResponse } from "./interfaces/LegacyApiResponse.js";
|
|
5
6
|
|
|
6
7
|
@injectable()
|
|
7
8
|
export class AuthenticationApi implements IAuthenticationApi {
|
|
@@ -27,4 +28,29 @@ export class AuthenticationApi implements IAuthenticationApi {
|
|
|
27
28
|
const operation = "postSignUpBackofficeBulk";
|
|
28
29
|
return await this.httpRequest.post(url, input, { 'operationName': operation });
|
|
29
30
|
}
|
|
30
|
-
|
|
31
|
+
|
|
32
|
+
async agentSignInStatus(input: AgentSignInStatusInput, actorEmail: string): Promise<LegacyApiResponse<unknown>> {
|
|
33
|
+
const url = `${process.env.AUTH_LAMBDA_URL}`;
|
|
34
|
+
const operation = "postSignInPhoneNumberAgent";
|
|
35
|
+
|
|
36
|
+
return await this.httpRequest.post<LegacyApiResponse<unknown>>(url, { ...input, actorEmail }, { 'operationName': operation });
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async agentSignUpProspect(input: AgentSignUpProspectInput, actorEmail: string): Promise<LegacyApiResponse<unknown>> {
|
|
40
|
+
const url = `${process.env.AUTH_LAMBDA_URL}`;
|
|
41
|
+
const operation = "agentPostSignUp";
|
|
42
|
+
|
|
43
|
+
return await this.httpRequest.post<LegacyApiResponse<unknown>>(url, { ...input, actorEmail }, { 'operationName': operation });
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
async agentGetSignUpByPhone(phoneNumber: string): Promise<LegacyApiResponse<unknown>> {
|
|
47
|
+
if (!phoneNumber) {
|
|
48
|
+
throw new Error("phoneNumber is required.");
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const url = `${process.env.AUTH_LAMBDA_URL}`;
|
|
52
|
+
const operation = "agentGetSignUpByPhoneNumber";
|
|
53
|
+
|
|
54
|
+
return await this.httpRequest.post<LegacyApiResponse<unknown>>(url, { pathParameters: { phoneNumber } }, { 'operationName': operation });
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -1,4 +1,32 @@
|
|
|
1
1
|
import { DirectoryBatchSummaryResponse, SignUpAdditionalRequest, SignUpUserBackofficeRequest } from "@fiado/type-kit/bin/authentication/index.js";
|
|
2
|
+
import { LegacyApiResponse } from "./LegacyApiResponse.js";
|
|
3
|
+
|
|
4
|
+
// Input del estado de cuenta del cliente (endpoint de agente, se despacha por operationName).
|
|
5
|
+
// Interfaz LOCAL a propósito: NO se agrega al @fiado/type-kit.
|
|
6
|
+
export interface AgentSignInStatusInput {
|
|
7
|
+
phoneNumber: string;
|
|
8
|
+
app: string;
|
|
9
|
+
platform: string;
|
|
10
|
+
version: string;
|
|
11
|
+
ip?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// Input del alta de prospecto (endpoint de agente, se despacha por operationName).
|
|
15
|
+
// `email` es el email del PROSPECTO; el email del AGENTE viaja aparte como actorEmail.
|
|
16
|
+
// Interfaz LOCAL a propósito: NO se agrega al @fiado/type-kit.
|
|
17
|
+
export interface AgentSignUpProspectInput {
|
|
18
|
+
name: string;
|
|
19
|
+
phoneNumber: string;
|
|
20
|
+
countryOfBirth: string;
|
|
21
|
+
countryOfDomicile: string;
|
|
22
|
+
email: string;
|
|
23
|
+
secondaryPhoneNumber?: string;
|
|
24
|
+
referralCode?: string | null;
|
|
25
|
+
stateOfBirth?: string | null;
|
|
26
|
+
otpCode?: string | null;
|
|
27
|
+
MEX_DebitAccountWish?: boolean;
|
|
28
|
+
USA_DebitAccountWish?: boolean;
|
|
29
|
+
}
|
|
2
30
|
|
|
3
31
|
export interface IAuthenticationApi {
|
|
4
32
|
|
|
@@ -6,4 +34,16 @@ export interface IAuthenticationApi {
|
|
|
6
34
|
deleteAuthSessionByDirectoryId(directoryId: string): Promise<any>;
|
|
7
35
|
|
|
8
36
|
signUpBackofficeBulk(input: SignUpUserBackofficeRequest[]): Promise<DirectoryBatchSummaryResponse>;
|
|
9
|
-
|
|
37
|
+
|
|
38
|
+
// Endpoints de agente — se despachan por header operationName y devuelven el ENVELOPE legacy
|
|
39
|
+
// COMPLETO (LegacyApiResponse) para que el proxy (people-business) lo re-emita campo por campo (drop-in).
|
|
40
|
+
|
|
41
|
+
// operationName: postSignInPhoneNumberAgent — body { ...input, actorEmail }
|
|
42
|
+
agentSignInStatus(input: AgentSignInStatusInput, actorEmail: string): Promise<LegacyApiResponse<unknown>>;
|
|
43
|
+
|
|
44
|
+
// operationName: agentPostSignUp — body { ...input, actorEmail } (input.email = prospecto; actorEmail = agente)
|
|
45
|
+
agentSignUpProspect(input: AgentSignUpProspectInput, actorEmail: string): Promise<LegacyApiResponse<unknown>>;
|
|
46
|
+
|
|
47
|
+
// operationName: agentGetSignUpByPhoneNumber — body { pathParameters: { phoneNumber } }
|
|
48
|
+
agentGetSignUpByPhone(phoneNumber: string): Promise<LegacyApiResponse<unknown>>;
|
|
49
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Envelope de respuesta de los lambdas legacy Fiado (@fiado/request-handler + @fiado/backend-toolkit):
|
|
2
|
+
// el body HTTP es { code, description, msg, data, date }. Los métodos que pegan a endpoints legacy
|
|
3
|
+
// devuelven este envelope COMPLETO (httpRequest.post retorna response.data = el body), NO solo `data`.
|
|
4
|
+
// Tiparlo así evita el doble-wrap en el consumidor (que re-emite el envelope campo por campo para ser drop-in).
|
|
5
|
+
export interface LegacyApiResponse<T> {
|
|
6
|
+
code: string;
|
|
7
|
+
description?: string | null;
|
|
8
|
+
msg?: string | null;
|
|
9
|
+
data: T;
|
|
10
|
+
date?: string;
|
|
11
|
+
}
|