@fiado/api-invoker 1.0.52 → 1.0.55
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/README.md +64 -64
- package/bin/account-fiadoinc/AccountFiadoIncApi.d.ts +2 -1
- package/bin/account-fiadoinc/AccountFiadoIncApi.js +4 -0
- package/bin/account-fiadoinc/interfaces/IAccountFiadoIncApi.d.ts +2 -1
- package/bin/pomelo/api/PomeloApi.d.ts +3 -2
- package/bin/pomelo/api/PomeloApi.js +7 -3
- package/bin/pomelo/api/interfaces/IPomeloApi.d.ts +2 -1
- package/bin/tern/api/TernApi.d.ts +3 -2
- package/bin/tern/api/TernApi.js +7 -3
- package/bin/tern/api/interfaces/ITernApi.d.ts +3 -2
- package/package.json +28 -28
- package/src/account-fiadoinc/AccountFiadoIncApi.ts +32 -22
- package/src/account-fiadoinc/index.ts +1 -1
- package/src/account-fiadoinc/interfaces/IAccountFiadoIncApi.ts +15 -8
- package/src/account-fiadosa/AccountFiadoSAApi.ts +22 -22
- package/src/account-fiadosa/index.ts +1 -1
- package/src/account-fiadosa/interfaces/IAccountFiadoSAApi.ts +9 -9
- package/src/account-pagoconfiado/AccountPagoConfiadoApi.ts +22 -22
- package/src/account-pagoconfiado/index.ts +2 -2
- package/src/account-pagoconfiado/interfaces/IAccountPagoConfiadoApi.ts +8 -8
- package/src/address/AddressApi.ts +46 -46
- package/src/address/index.ts +3 -3
- package/src/address/interfaces/IAddressApi.ts +30 -30
- package/src/authentication/AuthenticationApi.ts +16 -16
- package/src/authentication/index.ts +4 -4
- package/src/authentication/interfaces/IAuthenticationApi.ts +5 -5
- package/src/container.config.ts +38 -38
- package/src/directory/DirectoryApi.ts +74 -74
- package/src/directory/index.ts +3 -3
- package/src/directory/interfaces/IDirectoryApi.ts +53 -53
- package/src/exchangeRates/ExchangeRatesApi.ts +18 -18
- package/src/exchangeRates/index.ts +1 -1
- package/src/exchangeRates/interfaces/IExchangeRatesApi.ts +5 -5
- package/src/identity/IdentityApi.ts +47 -47
- package/src/identity/index.ts +3 -3
- package/src/identity/interfaces/IIdentityApi.ts +33 -33
- package/src/index.ts +13 -13
- package/src/notificationMessages/index.ts +1 -1
- package/src/notificationMessages/queue/NotificationMessagePublisher.ts +22 -22
- package/src/notificationMessages/queue/interfaces/INotificationMessagesPublisher.ts +4 -4
- package/src/pomelo/api/PomeloApi.ts +99 -94
- package/src/pomelo/api/interfaces/IPomeloApi.ts +27 -27
- package/src/pomelo/index.ts +1 -1
- package/src/sessionActivity/index.ts +2 -2
- package/src/sessionActivity/queue/SessionActivityPublisher.ts +22 -22
- package/src/sessionActivity/queue/interfaces/ISessionActivityPublisher.ts +4 -4
- package/src/stpAccount/api/STPAccountApi.ts +102 -102
- package/src/stpAccount/api/interfaces/ISTPAccountApi.ts +6 -6
- package/src/stpAccount/index.ts +1 -1
- package/src/tern/api/TernApi.ts +85 -80
- package/src/tern/api/interfaces/ITernApi.ts +27 -25
- package/src/tern/index.ts +1 -1
- package/tsconfig.json +21 -21
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
import { IHttpRequest } from "@fiado/http-client";
|
|
2
|
-
import { AddressCreateRequest, AddressShippingCardRequest, AddressShippingCardResponse } from "@fiado/type-kit/bin/address";
|
|
3
|
-
import { inject, injectable } from "inversify";
|
|
4
|
-
import { IAddressApi } from "./interfaces/IAddressApi";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
@injectable()
|
|
8
|
-
export class AddressApi implements IAddressApi {
|
|
9
|
-
|
|
10
|
-
private readonly baseUrl = process.env.ADDRESS_LAMBDA_URL || "";
|
|
11
|
-
constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) { }
|
|
12
|
-
|
|
13
|
-
async getByDirectoryId(directoryId: string): Promise<any> {
|
|
14
|
-
|
|
15
|
-
this.validateBaseUrl();
|
|
16
|
-
this.validateDirectoryId(directoryId);
|
|
17
|
-
|
|
18
|
-
const url = `${this.baseUrl}users/${directoryId}`;
|
|
19
|
-
|
|
20
|
-
return await this.httpRequest.get(`${url}`, null);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
async create(directoryId: string, address: AddressCreateRequest): Promise<void> {
|
|
24
|
-
this.validateBaseUrl();
|
|
25
|
-
this.validateDirectoryId(directoryId);
|
|
26
|
-
const url = `${this.baseUrl}users/${directoryId}`;
|
|
27
|
-
await this.httpRequest.post<void>(url, address);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
async getAddressLocationShipping(input: AddressShippingCardRequest): Promise<AddressShippingCardResponse> {
|
|
31
|
-
this.validateBaseUrl();
|
|
32
|
-
const url = `${this.baseUrl}shipping`;
|
|
33
|
-
return await this.httpRequest.post<AddressShippingCardResponse>(url, input);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
private validateBaseUrl() {
|
|
37
|
-
if (!this.baseUrl) {
|
|
38
|
-
throw new Error("Environment variable ADDRESS_LAMBDA_URL value not found");
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
private validateDirectoryId(directoryId: string) {
|
|
43
|
-
if (!directoryId) {
|
|
44
|
-
throw new Error("Directory ID is required.");
|
|
45
|
-
}
|
|
46
|
-
}
|
|
1
|
+
import { IHttpRequest } from "@fiado/http-client";
|
|
2
|
+
import { AddressCreateRequest, AddressShippingCardRequest, AddressShippingCardResponse } from "@fiado/type-kit/bin/address";
|
|
3
|
+
import { inject, injectable } from "inversify";
|
|
4
|
+
import { IAddressApi } from "./interfaces/IAddressApi";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@injectable()
|
|
8
|
+
export class AddressApi implements IAddressApi {
|
|
9
|
+
|
|
10
|
+
private readonly baseUrl = process.env.ADDRESS_LAMBDA_URL || "";
|
|
11
|
+
constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) { }
|
|
12
|
+
|
|
13
|
+
async getByDirectoryId(directoryId: string): Promise<any> {
|
|
14
|
+
|
|
15
|
+
this.validateBaseUrl();
|
|
16
|
+
this.validateDirectoryId(directoryId);
|
|
17
|
+
|
|
18
|
+
const url = `${this.baseUrl}users/${directoryId}`;
|
|
19
|
+
|
|
20
|
+
return await this.httpRequest.get(`${url}`, null);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
async create(directoryId: string, address: AddressCreateRequest): Promise<void> {
|
|
24
|
+
this.validateBaseUrl();
|
|
25
|
+
this.validateDirectoryId(directoryId);
|
|
26
|
+
const url = `${this.baseUrl}users/${directoryId}`;
|
|
27
|
+
await this.httpRequest.post<void>(url, address);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
async getAddressLocationShipping(input: AddressShippingCardRequest): Promise<AddressShippingCardResponse> {
|
|
31
|
+
this.validateBaseUrl();
|
|
32
|
+
const url = `${this.baseUrl}shipping`;
|
|
33
|
+
return await this.httpRequest.post<AddressShippingCardResponse>(url, input);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
private validateBaseUrl() {
|
|
37
|
+
if (!this.baseUrl) {
|
|
38
|
+
throw new Error("Environment variable ADDRESS_LAMBDA_URL value not found");
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
private validateDirectoryId(directoryId: string) {
|
|
43
|
+
if (!directoryId) {
|
|
44
|
+
throw new Error("Directory ID is required.");
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
47
|
}
|
package/src/address/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export * from './interfaces/IAddressApi';
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
export * from './interfaces/IAddressApi';
|
|
4
4
|
export * from './AddressApi';
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { AddressCreateRequest, AddressResponse, AddressShippingCardRequest, AddressShippingCardResponse } from "@fiado/type-kit/bin/address";
|
|
2
|
-
|
|
3
|
-
export interface IAddressApi {
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Obtiene una lista de direcciones por su ID de directorio.
|
|
7
|
-
* @param directoryId ID de directorio (UUID) a buscar.
|
|
8
|
-
* @returns Una promesa que resuelve a un arreglo de objetos de dirección.
|
|
9
|
-
* Puede devolver un arreglo vacío si no se encuentran coincidencias.
|
|
10
|
-
* @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
|
|
11
|
-
*/
|
|
12
|
-
getByDirectoryId(directoryId: string): Promise<AddressResponse[]>;
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Crea una nueva dirección para un directorio.
|
|
16
|
-
* @param directoryId ID de directorio (UUID) a buscar.
|
|
17
|
-
* @param address Objeto de dirección a crear.
|
|
18
|
-
* @returns Una promesa que resuelve a void.
|
|
19
|
-
* @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
|
|
20
|
-
*/
|
|
21
|
-
create(directoryId: string, address: AddressCreateRequest): Promise<void>;
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Obtiene la dirección de envío de una tarjeta.
|
|
25
|
-
* @param input Objeto de solicitud de dirección de envío.
|
|
26
|
-
* @returns Una promesa que resuelve a un objeto de respuesta de dirección de envío.
|
|
27
|
-
* @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
|
|
28
|
-
*/
|
|
29
|
-
getAddressLocationShipping(input: AddressShippingCardRequest): Promise<AddressShippingCardResponse>;
|
|
30
|
-
|
|
1
|
+
import { AddressCreateRequest, AddressResponse, AddressShippingCardRequest, AddressShippingCardResponse } from "@fiado/type-kit/bin/address";
|
|
2
|
+
|
|
3
|
+
export interface IAddressApi {
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Obtiene una lista de direcciones por su ID de directorio.
|
|
7
|
+
* @param directoryId ID de directorio (UUID) a buscar.
|
|
8
|
+
* @returns Una promesa que resuelve a un arreglo de objetos de dirección.
|
|
9
|
+
* Puede devolver un arreglo vacío si no se encuentran coincidencias.
|
|
10
|
+
* @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
|
|
11
|
+
*/
|
|
12
|
+
getByDirectoryId(directoryId: string): Promise<AddressResponse[]>;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Crea una nueva dirección para un directorio.
|
|
16
|
+
* @param directoryId ID de directorio (UUID) a buscar.
|
|
17
|
+
* @param address Objeto de dirección a crear.
|
|
18
|
+
* @returns Una promesa que resuelve a void.
|
|
19
|
+
* @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
|
|
20
|
+
*/
|
|
21
|
+
create(directoryId: string, address: AddressCreateRequest): Promise<void>;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Obtiene la dirección de envío de una tarjeta.
|
|
25
|
+
* @param input Objeto de solicitud de dirección de envío.
|
|
26
|
+
* @returns Una promesa que resuelve a un objeto de respuesta de dirección de envío.
|
|
27
|
+
* @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
|
|
28
|
+
*/
|
|
29
|
+
getAddressLocationShipping(input: AddressShippingCardRequest): Promise<AddressShippingCardResponse>;
|
|
30
|
+
|
|
31
31
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { IHttpRequest } from "@fiado/http-client";
|
|
2
|
-
import { SignUpAdditionalRequest } from "@fiado/type-kit/bin/authentication";
|
|
3
|
-
import { inject, injectable } from "inversify";
|
|
4
|
-
import { IAuthenticationApi } from "./interfaces/IAuthenticationApi";
|
|
5
|
-
|
|
6
|
-
@injectable()
|
|
7
|
-
export class AuthenticationApi implements IAuthenticationApi {
|
|
8
|
-
|
|
9
|
-
constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) { }
|
|
10
|
-
|
|
11
|
-
async signUpAdditionalCard(createAdditionalCard: SignUpAdditionalRequest): Promise<any> {
|
|
12
|
-
const url = `${process.env.AUTH_LAMBDA_URL}`;
|
|
13
|
-
const operation = "postSignUpAdditionalCard";
|
|
14
|
-
|
|
15
|
-
return await this.httpRequest.post(url, createAdditionalCard, { 'operationName': operation });
|
|
16
|
-
}
|
|
1
|
+
import { IHttpRequest } from "@fiado/http-client";
|
|
2
|
+
import { SignUpAdditionalRequest } from "@fiado/type-kit/bin/authentication";
|
|
3
|
+
import { inject, injectable } from "inversify";
|
|
4
|
+
import { IAuthenticationApi } from "./interfaces/IAuthenticationApi";
|
|
5
|
+
|
|
6
|
+
@injectable()
|
|
7
|
+
export class AuthenticationApi implements IAuthenticationApi {
|
|
8
|
+
|
|
9
|
+
constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) { }
|
|
10
|
+
|
|
11
|
+
async signUpAdditionalCard(createAdditionalCard: SignUpAdditionalRequest): Promise<any> {
|
|
12
|
+
const url = `${process.env.AUTH_LAMBDA_URL}`;
|
|
13
|
+
const operation = "postSignUpAdditionalCard";
|
|
14
|
+
|
|
15
|
+
return await this.httpRequest.post(url, createAdditionalCard, { 'operationName': operation });
|
|
16
|
+
}
|
|
17
17
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export * from './interfaces/IAuthenticationApi';
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export * from './interfaces/IAuthenticationApi';
|
|
5
5
|
export * from './AuthenticationApi';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { SignUpAdditionalRequest } from "@fiado/type-kit/bin/authentication";
|
|
2
|
-
|
|
3
|
-
export interface IAuthenticationApi {
|
|
4
|
-
|
|
5
|
-
signUpAdditionalCard(createAdditionalCard: SignUpAdditionalRequest): Promise<any>;
|
|
1
|
+
import { SignUpAdditionalRequest } from "@fiado/type-kit/bin/authentication";
|
|
2
|
+
|
|
3
|
+
export interface IAuthenticationApi {
|
|
4
|
+
|
|
5
|
+
signUpAdditionalCard(createAdditionalCard: SignUpAdditionalRequest): Promise<any>;
|
|
6
6
|
}
|
package/src/container.config.ts
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import {ContainerModule, interfaces} from "inversify";
|
|
2
|
-
import {DirectoryApi, IDirectoryApi} from "./directory";
|
|
3
|
-
import {IdentityApi, IIdentityApi} from "./identity";
|
|
4
|
-
import {INotificationMessagesPublisher} from "./notificationMessages";
|
|
5
|
-
import NotificationMessagePublisher from "./notificationMessages/queue/NotificationMessagePublisher";
|
|
6
|
-
import {ITernApi} from "./tern";
|
|
7
|
-
import TernApi from "./tern/api/TernApi";
|
|
8
|
-
import {IPomeloApi} from "./pomelo";
|
|
9
|
-
import PomeloApi from "./pomelo/api/PomeloApi";
|
|
10
|
-
import {AddressApi, IAddressApi} from "./address";
|
|
11
|
-
import {IAccountFiadoIncApi} from "./account-fiadoinc";
|
|
12
|
-
import AccountFiadoIncApi from "./account-fiadoinc/AccountFiadoIncApi";
|
|
13
|
-
import {IAccountPagoConfiadoApi} from "./account-pagoconfiado";
|
|
14
|
-
import AccountPagoConfiadoApi from "./account-pagoconfiado/AccountPagoConfiadoApi";
|
|
15
|
-
import {IAccountFiadoSAApi} from "./account-fiadosa";
|
|
16
|
-
import AccountFiadoSAApi from "./account-fiadosa/AccountFiadoSAApi";
|
|
17
|
-
import {ISTPAccountApi} from "./stpAccount";
|
|
18
|
-
import STPAccountApi from "./stpAccount/api/STPAccountApi";
|
|
19
|
-
import {ISessionActivityPublisher, SessionActivityPublisher} from "./sessionActivity";
|
|
20
|
-
import {IExchangeRatesApi} from "./exchangeRates";
|
|
21
|
-
import ExchangeRatesApi from "./exchangeRates/ExchangeRatesApi";
|
|
22
|
-
import { AuthenticationApi, IAuthenticationApi } from "./authentication";
|
|
23
|
-
|
|
24
|
-
export const apiInvokerBindings = new ContainerModule((bind: interfaces.Bind) => {
|
|
25
|
-
bind<IDirectoryApi>("IDirectoryApi").to(DirectoryApi);
|
|
26
|
-
bind<IIdentityApi>("IIdentityApi").to(IdentityApi);
|
|
27
|
-
bind<IAddressApi>("IAddressApi").to(AddressApi);
|
|
28
|
-
bind<IExchangeRatesApi>("IExchangeRatesApi").to(ExchangeRatesApi);
|
|
29
|
-
bind<ITernApi>("ITernApi").to(TernApi);
|
|
30
|
-
bind<IPomeloApi>("IPomeloApi").to(PomeloApi);
|
|
31
|
-
bind<ISTPAccountApi>("ISTPAccountApi").to(STPAccountApi);
|
|
32
|
-
bind<IAccountFiadoIncApi>("IAccountFiadoIncApi").to(AccountFiadoIncApi);
|
|
33
|
-
bind<IAccountPagoConfiadoApi>("IAccountPagoConfiadoApi").to(AccountPagoConfiadoApi);
|
|
34
|
-
bind<IAccountFiadoSAApi>("IAccountFiadoSAApi").to(AccountFiadoSAApi);
|
|
35
|
-
bind<INotificationMessagesPublisher>("INotificationMessagesPublisher").to(NotificationMessagePublisher);
|
|
36
|
-
bind<ISessionActivityPublisher>("ISessionActivityPublisher").to(SessionActivityPublisher);
|
|
37
|
-
bind<IAuthenticationApi>("IAuthenticationApi").to(AuthenticationApi);
|
|
38
|
-
});
|
|
1
|
+
import {ContainerModule, interfaces} from "inversify";
|
|
2
|
+
import {DirectoryApi, IDirectoryApi} from "./directory";
|
|
3
|
+
import {IdentityApi, IIdentityApi} from "./identity";
|
|
4
|
+
import {INotificationMessagesPublisher} from "./notificationMessages";
|
|
5
|
+
import NotificationMessagePublisher from "./notificationMessages/queue/NotificationMessagePublisher";
|
|
6
|
+
import {ITernApi} from "./tern";
|
|
7
|
+
import TernApi from "./tern/api/TernApi";
|
|
8
|
+
import {IPomeloApi} from "./pomelo";
|
|
9
|
+
import PomeloApi from "./pomelo/api/PomeloApi";
|
|
10
|
+
import {AddressApi, IAddressApi} from "./address";
|
|
11
|
+
import {IAccountFiadoIncApi} from "./account-fiadoinc";
|
|
12
|
+
import AccountFiadoIncApi from "./account-fiadoinc/AccountFiadoIncApi";
|
|
13
|
+
import {IAccountPagoConfiadoApi} from "./account-pagoconfiado";
|
|
14
|
+
import AccountPagoConfiadoApi from "./account-pagoconfiado/AccountPagoConfiadoApi";
|
|
15
|
+
import {IAccountFiadoSAApi} from "./account-fiadosa";
|
|
16
|
+
import AccountFiadoSAApi from "./account-fiadosa/AccountFiadoSAApi";
|
|
17
|
+
import {ISTPAccountApi} from "./stpAccount";
|
|
18
|
+
import STPAccountApi from "./stpAccount/api/STPAccountApi";
|
|
19
|
+
import {ISessionActivityPublisher, SessionActivityPublisher} from "./sessionActivity";
|
|
20
|
+
import {IExchangeRatesApi} from "./exchangeRates";
|
|
21
|
+
import ExchangeRatesApi from "./exchangeRates/ExchangeRatesApi";
|
|
22
|
+
import { AuthenticationApi, IAuthenticationApi } from "./authentication";
|
|
23
|
+
|
|
24
|
+
export const apiInvokerBindings = new ContainerModule((bind: interfaces.Bind) => {
|
|
25
|
+
bind<IDirectoryApi>("IDirectoryApi").to(DirectoryApi);
|
|
26
|
+
bind<IIdentityApi>("IIdentityApi").to(IdentityApi);
|
|
27
|
+
bind<IAddressApi>("IAddressApi").to(AddressApi);
|
|
28
|
+
bind<IExchangeRatesApi>("IExchangeRatesApi").to(ExchangeRatesApi);
|
|
29
|
+
bind<ITernApi>("ITernApi").to(TernApi);
|
|
30
|
+
bind<IPomeloApi>("IPomeloApi").to(PomeloApi);
|
|
31
|
+
bind<ISTPAccountApi>("ISTPAccountApi").to(STPAccountApi);
|
|
32
|
+
bind<IAccountFiadoIncApi>("IAccountFiadoIncApi").to(AccountFiadoIncApi);
|
|
33
|
+
bind<IAccountPagoConfiadoApi>("IAccountPagoConfiadoApi").to(AccountPagoConfiadoApi);
|
|
34
|
+
bind<IAccountFiadoSAApi>("IAccountFiadoSAApi").to(AccountFiadoSAApi);
|
|
35
|
+
bind<INotificationMessagesPublisher>("INotificationMessagesPublisher").to(NotificationMessagePublisher);
|
|
36
|
+
bind<ISessionActivityPublisher>("ISessionActivityPublisher").to(SessionActivityPublisher);
|
|
37
|
+
bind<IAuthenticationApi>("IAuthenticationApi").to(AuthenticationApi);
|
|
38
|
+
});
|
|
@@ -1,74 +1,74 @@
|
|
|
1
|
-
import dotenv from 'dotenv';
|
|
2
|
-
import { inject, injectable } from "inversify";
|
|
3
|
-
import { IHttpRequest } from "@fiado/http-client";
|
|
4
|
-
import { IDirectoryApi } from "./interfaces/IDirectoryApi";
|
|
5
|
-
import { Provider } from '@fiado/type-kit/bin/provider';
|
|
6
|
-
|
|
7
|
-
dotenv.config();
|
|
8
|
-
|
|
9
|
-
@injectable()
|
|
10
|
-
export class DirectoryApi implements IDirectoryApi {
|
|
11
|
-
|
|
12
|
-
private readonly baseUrl = process.env.DIRECTORY_LAMBDA_URL || "";
|
|
13
|
-
|
|
14
|
-
constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
public async getByIds(ids: string[]): Promise<any> {
|
|
18
|
-
|
|
19
|
-
if (ids.length === 0) {
|
|
20
|
-
throw new Error("At least one directory ID is required.")
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const url = `${this.baseUrl}?${ids.map(id => `directoryId=${encodeURIComponent(id)}`).join('&')}`;
|
|
24
|
-
const operationName = "getUserInfoByIds";
|
|
25
|
-
|
|
26
|
-
return await this.httpRequest.post(`${url}`, null, { 'operationName': operationName });
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
public async updateExternalUserId(directoryId: string, provider: Provider, externalUserId: string): Promise<void> {
|
|
30
|
-
|
|
31
|
-
const url = `${this.baseUrl}`;
|
|
32
|
-
const operationName = "updateExternalUser";
|
|
33
|
-
|
|
34
|
-
const body = {
|
|
35
|
-
directoryId: directoryId,
|
|
36
|
-
typeOfDirectoryId: "USER",
|
|
37
|
-
provider: provider,
|
|
38
|
-
user: externalUserId
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return await this.httpRequest.post(`${url}`, body, { 'operationName': operationName });
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
public async updateScope(directoryId: string, scope: string[]): Promise<void> {
|
|
45
|
-
|
|
46
|
-
const url = `${this.baseUrl}`;
|
|
47
|
-
const operationName = "updateScope";
|
|
48
|
-
|
|
49
|
-
const body = {
|
|
50
|
-
directoryId: directoryId,
|
|
51
|
-
typeOfDirectoryId: "USER",
|
|
52
|
-
scope: scope
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return await this.httpRequest.post(`${url}`, body, { 'operationName': operationName });
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
public async getByOwnerDirectoryId(ownerDirectoryId: string): Promise<any> {
|
|
59
|
-
|
|
60
|
-
const url = `${this.baseUrl}?ownerDirectoryId=${ownerDirectoryId}`;
|
|
61
|
-
const operationName = "getByOwnerDirectoryId";
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
return await this.httpRequest.post(`${url}`, null, { 'operationName': operationName });
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
public async getByPhoneNumber(phoneNumber: string): Promise<any> {
|
|
68
|
-
|
|
69
|
-
const url = `${this.baseUrl}?phoneNumber=${phoneNumber}`;
|
|
70
|
-
const operationName = "getUserInfoByParams";
|
|
71
|
-
|
|
72
|
-
return await this.httpRequest.post(`${url}`, null, { 'operationName': operationName });
|
|
73
|
-
}
|
|
74
|
-
}
|
|
1
|
+
import dotenv from 'dotenv';
|
|
2
|
+
import { inject, injectable } from "inversify";
|
|
3
|
+
import { IHttpRequest } from "@fiado/http-client";
|
|
4
|
+
import { IDirectoryApi } from "./interfaces/IDirectoryApi";
|
|
5
|
+
import { Provider } from '@fiado/type-kit/bin/provider';
|
|
6
|
+
|
|
7
|
+
dotenv.config();
|
|
8
|
+
|
|
9
|
+
@injectable()
|
|
10
|
+
export class DirectoryApi implements IDirectoryApi {
|
|
11
|
+
|
|
12
|
+
private readonly baseUrl = process.env.DIRECTORY_LAMBDA_URL || "";
|
|
13
|
+
|
|
14
|
+
constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
public async getByIds(ids: string[]): Promise<any> {
|
|
18
|
+
|
|
19
|
+
if (ids.length === 0) {
|
|
20
|
+
throw new Error("At least one directory ID is required.")
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const url = `${this.baseUrl}?${ids.map(id => `directoryId=${encodeURIComponent(id)}`).join('&')}`;
|
|
24
|
+
const operationName = "getUserInfoByIds";
|
|
25
|
+
|
|
26
|
+
return await this.httpRequest.post(`${url}`, null, { 'operationName': operationName });
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
public async updateExternalUserId(directoryId: string, provider: Provider, externalUserId: string): Promise<void> {
|
|
30
|
+
|
|
31
|
+
const url = `${this.baseUrl}`;
|
|
32
|
+
const operationName = "updateExternalUser";
|
|
33
|
+
|
|
34
|
+
const body = {
|
|
35
|
+
directoryId: directoryId,
|
|
36
|
+
typeOfDirectoryId: "USER",
|
|
37
|
+
provider: provider,
|
|
38
|
+
user: externalUserId
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return await this.httpRequest.post(`${url}`, body, { 'operationName': operationName });
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
public async updateScope(directoryId: string, scope: string[]): Promise<void> {
|
|
45
|
+
|
|
46
|
+
const url = `${this.baseUrl}`;
|
|
47
|
+
const operationName = "updateScope";
|
|
48
|
+
|
|
49
|
+
const body = {
|
|
50
|
+
directoryId: directoryId,
|
|
51
|
+
typeOfDirectoryId: "USER",
|
|
52
|
+
scope: scope
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return await this.httpRequest.post(`${url}`, body, { 'operationName': operationName });
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
public async getByOwnerDirectoryId(ownerDirectoryId: string): Promise<any> {
|
|
59
|
+
|
|
60
|
+
const url = `${this.baseUrl}?ownerDirectoryId=${ownerDirectoryId}`;
|
|
61
|
+
const operationName = "getByOwnerDirectoryId";
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
return await this.httpRequest.post(`${url}`, null, { 'operationName': operationName });
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
public async getByPhoneNumber(phoneNumber: string): Promise<any> {
|
|
68
|
+
|
|
69
|
+
const url = `${this.baseUrl}?phoneNumber=${phoneNumber}`;
|
|
70
|
+
const operationName = "getUserInfoByParams";
|
|
71
|
+
|
|
72
|
+
return await this.httpRequest.post(`${url}`, null, { 'operationName': operationName });
|
|
73
|
+
}
|
|
74
|
+
}
|
package/src/directory/index.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export * from './interfaces/IDirectoryApi';
|
|
3
|
-
export * from './DirectoryApi';
|
|
1
|
+
|
|
2
|
+
export * from './interfaces/IDirectoryApi';
|
|
3
|
+
export * from './DirectoryApi';
|
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
import { Provider } from "@fiado/type-kit/bin/provider";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Interfaz para el servicio Directory que permite operaciones sobre directorios.
|
|
5
|
-
*/
|
|
6
|
-
export interface IDirectoryApi {
|
|
7
|
-
/**
|
|
8
|
-
* Obtiene una lista de directorios por sus IDs.
|
|
9
|
-
* @param ids Array de IDs de directorios (UUIDs) a buscar.
|
|
10
|
-
* @returns Una promesa que resuelve a un arreglo de objetos de directorio.
|
|
11
|
-
* Puede devolver un arreglo vacío si no se encuentran coincidencias.
|
|
12
|
-
* @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
|
|
13
|
-
*/
|
|
14
|
-
getByIds(ids: string[]): Promise<any>;
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Actualiza el ID de usuario externo en un directorio.
|
|
18
|
-
* @param directoryId ID del directorio (UUID) a actualizar.
|
|
19
|
-
* @param provider Proveedor de autenticación del usuario.
|
|
20
|
-
* @param externalUserId ID de usuario externo.
|
|
21
|
-
* @returns Una promesa que resuelve a un objeto vacío.
|
|
22
|
-
* @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
updateExternalUserId(directoryId: string, provider: Provider, externalUserId: string): Promise<void>;
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Actualiza el alcance de un directorio.
|
|
29
|
-
* @param directoryId ID del directorio (UUID) a actualizar.
|
|
30
|
-
* @param scope Alcance a actualizar.
|
|
31
|
-
* @returns Una promesa que resuelve a un objeto vacío.
|
|
32
|
-
* @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
|
|
33
|
-
*/
|
|
34
|
-
updateScope(directoryId: string, scope: string[]): Promise<void>;
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Obtiene un directorio por su ID de directorio propietario.
|
|
38
|
-
* @param ownerDirectoryId ID de directorio propietario (UUID) a buscar.
|
|
39
|
-
* @returns Una promesa que resuelve a un objeto de directorio.
|
|
40
|
-
* Puede devolver un objeto vacío si no se encuentra coincidencia.
|
|
41
|
-
* @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
|
|
42
|
-
*/
|
|
43
|
-
getByOwnerDirectoryId(ownerDirectoryId: string): Promise<any>
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Obtiene un directorio por su número de teléfono.
|
|
47
|
-
* @param phoneNumber Número de teléfono a buscar.
|
|
48
|
-
* @returns Una promesa que resuelve a un objeto de directorio.
|
|
49
|
-
* Puede devolver un objeto vacío si no se encuentra coincidencia.
|
|
50
|
-
* @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
|
|
51
|
-
*/
|
|
52
|
-
getByPhoneNumber(phoneNumber: string): Promise<any>
|
|
53
|
-
}
|
|
1
|
+
import { Provider } from "@fiado/type-kit/bin/provider";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Interfaz para el servicio Directory que permite operaciones sobre directorios.
|
|
5
|
+
*/
|
|
6
|
+
export interface IDirectoryApi {
|
|
7
|
+
/**
|
|
8
|
+
* Obtiene una lista de directorios por sus IDs.
|
|
9
|
+
* @param ids Array de IDs de directorios (UUIDs) a buscar.
|
|
10
|
+
* @returns Una promesa que resuelve a un arreglo de objetos de directorio.
|
|
11
|
+
* Puede devolver un arreglo vacío si no se encuentran coincidencias.
|
|
12
|
+
* @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
|
|
13
|
+
*/
|
|
14
|
+
getByIds(ids: string[]): Promise<any>;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Actualiza el ID de usuario externo en un directorio.
|
|
18
|
+
* @param directoryId ID del directorio (UUID) a actualizar.
|
|
19
|
+
* @param provider Proveedor de autenticación del usuario.
|
|
20
|
+
* @param externalUserId ID de usuario externo.
|
|
21
|
+
* @returns Una promesa que resuelve a un objeto vacío.
|
|
22
|
+
* @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
updateExternalUserId(directoryId: string, provider: Provider, externalUserId: string): Promise<void>;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Actualiza el alcance de un directorio.
|
|
29
|
+
* @param directoryId ID del directorio (UUID) a actualizar.
|
|
30
|
+
* @param scope Alcance a actualizar.
|
|
31
|
+
* @returns Una promesa que resuelve a un objeto vacío.
|
|
32
|
+
* @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
|
|
33
|
+
*/
|
|
34
|
+
updateScope(directoryId: string, scope: string[]): Promise<void>;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Obtiene un directorio por su ID de directorio propietario.
|
|
38
|
+
* @param ownerDirectoryId ID de directorio propietario (UUID) a buscar.
|
|
39
|
+
* @returns Una promesa que resuelve a un objeto de directorio.
|
|
40
|
+
* Puede devolver un objeto vacío si no se encuentra coincidencia.
|
|
41
|
+
* @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
|
|
42
|
+
*/
|
|
43
|
+
getByOwnerDirectoryId(ownerDirectoryId: string): Promise<any>
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Obtiene un directorio por su número de teléfono.
|
|
47
|
+
* @param phoneNumber Número de teléfono a buscar.
|
|
48
|
+
* @returns Una promesa que resuelve a un objeto de directorio.
|
|
49
|
+
* Puede devolver un objeto vacío si no se encuentra coincidencia.
|
|
50
|
+
* @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
|
|
51
|
+
*/
|
|
52
|
+
getByPhoneNumber(phoneNumber: string): Promise<any>
|
|
53
|
+
}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import {IExchangeRatesApi} from "./interfaces/IExchangeRatesApi";
|
|
2
|
-
import {inject, injectable} from "inversify";
|
|
3
|
-
import {IHttpRequest} from "@fiado/http-client";
|
|
4
|
-
import GetExchangeRatesRequest from "@fiado/type-kit/bin/exchangeRate/dtos/GetExchangeRatesRequest";
|
|
5
|
-
|
|
6
|
-
@injectable()
|
|
7
|
-
export default class ExchangeRatesApi implements IExchangeRatesApi {
|
|
8
|
-
private readonly baseUrl = process.env.EXCHANGE_RATES_LAMBDA_URL || "";
|
|
9
|
-
|
|
10
|
-
constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
async getExchangeRates(request: GetExchangeRatesRequest): Promise<any> {
|
|
14
|
-
const headers = {
|
|
15
|
-
"operationName": "getExchangeRates"
|
|
16
|
-
}
|
|
17
|
-
return await this.httpRequest.post(this.baseUrl, request, headers);
|
|
18
|
-
}
|
|
1
|
+
import {IExchangeRatesApi} from "./interfaces/IExchangeRatesApi";
|
|
2
|
+
import {inject, injectable} from "inversify";
|
|
3
|
+
import {IHttpRequest} from "@fiado/http-client";
|
|
4
|
+
import GetExchangeRatesRequest from "@fiado/type-kit/bin/exchangeRate/dtos/GetExchangeRatesRequest";
|
|
5
|
+
|
|
6
|
+
@injectable()
|
|
7
|
+
export default class ExchangeRatesApi implements IExchangeRatesApi {
|
|
8
|
+
private readonly baseUrl = process.env.EXCHANGE_RATES_LAMBDA_URL || "";
|
|
9
|
+
|
|
10
|
+
constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
async getExchangeRates(request: GetExchangeRatesRequest): Promise<any> {
|
|
14
|
+
const headers = {
|
|
15
|
+
"operationName": "getExchangeRates"
|
|
16
|
+
}
|
|
17
|
+
return await this.httpRequest.post(this.baseUrl, request, headers);
|
|
18
|
+
}
|
|
19
19
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './interfaces/IExchangeRatesApi';
|
|
1
|
+
export * from './interfaces/IExchangeRatesApi';
|
|
2
2
|
export * from './ExchangeRatesApi';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import GetExchangeRatesRequest from "@fiado/type-kit/bin/exchangeRate/dtos/GetExchangeRatesRequest";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export interface IExchangeRatesApi {
|
|
5
|
-
getExchangeRates(request: GetExchangeRatesRequest): Promise<any>;
|
|
1
|
+
import GetExchangeRatesRequest from "@fiado/type-kit/bin/exchangeRate/dtos/GetExchangeRatesRequest";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export interface IExchangeRatesApi {
|
|
5
|
+
getExchangeRates(request: GetExchangeRatesRequest): Promise<any>;
|
|
6
6
|
}
|