@fiado/api-invoker 1.0.29 → 1.0.31

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.
Files changed (51) hide show
  1. package/README.md +64 -64
  2. package/bin/account-fiadoinc/AccountFiadoIncApi.d.ts +10 -0
  3. package/bin/account-fiadoinc/AccountFiadoIncApi.js +31 -0
  4. package/bin/account-fiadoinc/index.d.ts +1 -0
  5. package/bin/account-fiadoinc/index.js +1 -0
  6. package/bin/account-fiadoinc/interfaces/IAccountFiadoIncApi.d.ts +2 -1
  7. package/bin/account-fiadosa/AccountFiadoSAApi.d.ts +10 -0
  8. package/bin/account-fiadosa/AccountFiadoSAApi.js +31 -0
  9. package/bin/account-fiadosa/index.d.ts +1 -0
  10. package/bin/account-fiadosa/index.js +1 -0
  11. package/bin/account-fiadosa/interfaces/IAccountFiadoSAApi.d.ts +2 -1
  12. package/bin/account-pagoconfiado/AccountPagoConfiadoApi.d.ts +10 -0
  13. package/bin/account-pagoconfiado/AccountPagoConfiadoApi.js +31 -0
  14. package/bin/account-pagoconfiado/index.d.ts +1 -0
  15. package/bin/account-pagoconfiado/index.js +1 -0
  16. package/bin/account-pagoconfiado/interfaces/IAccountPagoConfiadoApi.d.ts +2 -1
  17. package/bin/container.config.js +8 -0
  18. package/package.json +28 -28
  19. package/src/account-fiadoinc/AccountFiadoIncApi.ts +18 -0
  20. package/src/account-fiadoinc/index.ts +2 -3
  21. package/src/account-fiadoinc/interfaces/IAccountFiadoIncApi.ts +6 -7
  22. package/src/account-fiadosa/AccountFiadoSAApi.ts +18 -0
  23. package/src/account-fiadosa/index.ts +2 -2
  24. package/src/account-fiadosa/interfaces/IAccountFiadoSAApi.ts +6 -8
  25. package/src/account-pagoconfiado/AccountPagoConfiadoApi.ts +18 -0
  26. package/src/account-pagoconfiado/index.ts +2 -2
  27. package/src/account-pagoconfiado/interfaces/IAccountPagoConfiadoApi.ts +6 -7
  28. package/src/address/AddressApi.ts +46 -47
  29. package/src/address/index.ts +3 -3
  30. package/src/address/interfaces/IAddressApi.ts +30 -30
  31. package/src/container.config.ts +28 -17
  32. package/src/directory/DirectoryApi.ts +27 -27
  33. package/src/directory/index.ts +3 -3
  34. package/src/directory/interfaces/IDirectoryApi.ts +14 -14
  35. package/src/identity/IdentityApi.ts +47 -47
  36. package/src/identity/index.ts +3 -3
  37. package/src/identity/interfaces/IIdentityApi.ts +33 -33
  38. package/src/index.ts +14 -14
  39. package/src/notificationMessages/index.ts +1 -1
  40. package/src/notificationMessages/queue/NotificationMessagePublisher.ts +22 -22
  41. package/src/notificationMessages/queue/interfaces/INotificationMessagesPublisher.ts +4 -4
  42. package/src/pomelo/api/PomeloApi.ts +95 -95
  43. package/src/pomelo/api/interfaces/IPomeloApi.ts +7 -7
  44. package/src/pomelo/index.ts +1 -1
  45. package/src/sessionActivity/index.ts +2 -2
  46. package/src/sessionActivity/queue/SessionActivityPublisher.ts +22 -22
  47. package/src/sessionActivity/queue/interfaces/ISessionActivityPublisher.ts +4 -4
  48. package/src/tern/api/TernApi.ts +47 -47
  49. package/src/tern/api/interfaces/ITernApi.ts +12 -12
  50. package/src/tern/index.ts +1 -1
  51. package/tsconfig.json +21 -21
package/README.md CHANGED
@@ -1,64 +1,64 @@
1
- # fiado-api-invoker
2
-
3
- `fiado-api-invoker` es una librería diseñada para facilitar la invocación de APIs privadas de AWS Lambda a través de API Gateway dentro de la misma VPC. Esta librería simplifica el proceso de configuración y llamada a servicios, permitiendo a los desarrolladores centrarse en la lógica de negocio.
4
-
5
-
6
- ## Configuración
7
-
8
- Antes de usar la librería, asegúrate de configurar la URL base del API Gateway privado que corresponda por ejemplo si vas a usar los servicios del Lambda `Directory` se puede hacer estableciendo la variable de entorno `DIRECTORY_LAMBDA_URL`.
9
-
10
-
11
- ## Instalación
12
- ```bash
13
- `npm install fiado-api-invoker @fiado/http-client`
14
- ```
15
-
16
- ## Configuración del Contenedor de InversifyJS
17
-
18
- ```typescript
19
- import { Container } from "inversify";
20
- import { IHttpRequest, AxiosHttpRequest } from "@fiado/http-client";
21
- import { apiInvokerContainer } from '@fiado/api-invoker';
22
-
23
- // Crea el contenedor principal de tu aplicación
24
- const container = new Container();
25
-
26
- // Aplica las configuraciones de vinculación de fiado-gateway-adapter al contenedor
27
- container.load(gatewayAdapterBindings);
28
-
29
- // Registro del cliente HTTP
30
- container.bind<IHttpRequest>("IHttpRequest").to(AxiosHttpRequest);
31
-
32
- // Exporta el contenedor para su uso en toda tu aplicación
33
- export { container };
34
-
35
-
36
- ```
37
-
38
-
39
- ## Uso de IDirectoryApi en Servicios del Proyecto
40
-
41
- Para utilizar `fiado-api-invoker`, necesitas configurar el contenedor de InversifyJS en tu aplicación. Aquí te mostramos cómo registrar las dependencias necesarias:
42
-
43
- ```typescript
44
- import { inject, injectable } from "inversify";
45
- import { IDirectoryApi } from "fiado-api-invoker";
46
- import { log } from "@fiado/logger";
47
-
48
- @injectable()
49
- export class SomeService {
50
- constructor(@inject("IDirectoryApi") private directoryApi: IDirectoryApi) {}
51
-
52
- public async fetchDirectoryDetails(directoryIds: string[]): Promise<void> {
53
- try {
54
- const details = await this.directoryApi.getByIds(directoryIds);
55
- log.info(details);
56
-
57
- } catch (error) {
58
- log.error("Error fetching directory details:", error);
59
- }
60
- }
61
- }
62
- ```
63
-
64
-
1
+ # fiado-api-invoker
2
+
3
+ `fiado-api-invoker` es una librería diseñada para facilitar la invocación de APIs privadas de AWS Lambda a través de API Gateway dentro de la misma VPC. Esta librería simplifica el proceso de configuración y llamada a servicios, permitiendo a los desarrolladores centrarse en la lógica de negocio.
4
+
5
+
6
+ ## Configuración
7
+
8
+ Antes de usar la librería, asegúrate de configurar la URL base del API Gateway privado que corresponda por ejemplo si vas a usar los servicios del Lambda `Directory` se puede hacer estableciendo la variable de entorno `DIRECTORY_LAMBDA_URL`.
9
+
10
+
11
+ ## Instalación
12
+ ```bash
13
+ `npm install fiado-api-invoker @fiado/http-client`
14
+ ```
15
+
16
+ ## Configuración del Contenedor de InversifyJS
17
+
18
+ ```typescript
19
+ import { Container } from "inversify";
20
+ import { IHttpRequest, AxiosHttpRequest } from "@fiado/http-client";
21
+ import { apiInvokerContainer } from '@fiado/api-invoker';
22
+
23
+ // Crea el contenedor principal de tu aplicación
24
+ const container = new Container();
25
+
26
+ // Aplica las configuraciones de vinculación de fiado-gateway-adapter al contenedor
27
+ container.load(gatewayAdapterBindings);
28
+
29
+ // Registro del cliente HTTP
30
+ container.bind<IHttpRequest>("IHttpRequest").to(AxiosHttpRequest);
31
+
32
+ // Exporta el contenedor para su uso en toda tu aplicación
33
+ export { container };
34
+
35
+
36
+ ```
37
+
38
+
39
+ ## Uso de IDirectoryApi en Servicios del Proyecto
40
+
41
+ Para utilizar `fiado-api-invoker`, necesitas configurar el contenedor de InversifyJS en tu aplicación. Aquí te mostramos cómo registrar las dependencias necesarias:
42
+
43
+ ```typescript
44
+ import { inject, injectable } from "inversify";
45
+ import { IDirectoryApi } from "fiado-api-invoker";
46
+ import { log } from "@fiado/logger";
47
+
48
+ @injectable()
49
+ export class SomeService {
50
+ constructor(@inject("IDirectoryApi") private directoryApi: IDirectoryApi) {}
51
+
52
+ public async fetchDirectoryDetails(directoryIds: string[]): Promise<void> {
53
+ try {
54
+ const details = await this.directoryApi.getByIds(directoryIds);
55
+ log.info(details);
56
+
57
+ } catch (error) {
58
+ log.error("Error fetching directory details:", error);
59
+ }
60
+ }
61
+ }
62
+ ```
63
+
64
+
@@ -0,0 +1,10 @@
1
+ import { IAccountFiadoIncApi } from "./interfaces/IAccountFiadoIncApi";
2
+ import { AccountCreateRequest, AccountCreateResponse } from "@fiado/type-kit/bin/account";
3
+ import { IHttpRequest } from "@fiado/http-client";
4
+ import { ApiGatewayResponse } from "@fiado/gateway-adapter";
5
+ export default class AccountFiadoIncApi implements IAccountFiadoIncApi {
6
+ private httpRequest;
7
+ private readonly baseUrl;
8
+ constructor(httpRequest: IHttpRequest);
9
+ createAccount(data: AccountCreateRequest): Promise<ApiGatewayResponse<AccountCreateResponse>>;
10
+ }
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const inversify_1 = require("inversify");
16
+ let AccountFiadoIncApi = class AccountFiadoIncApi {
17
+ constructor(httpRequest) {
18
+ this.httpRequest = httpRequest;
19
+ this.baseUrl = process.env.ACCOUNT_FIADOINC_LAMBDA_URL || "";
20
+ }
21
+ async createAccount(data) {
22
+ const url = `${this.baseUrl}`;
23
+ return await this.httpRequest.post(url, data);
24
+ }
25
+ };
26
+ AccountFiadoIncApi = __decorate([
27
+ (0, inversify_1.injectable)(),
28
+ __param(0, (0, inversify_1.inject)("IHttpRequest")),
29
+ __metadata("design:paramtypes", [Object])
30
+ ], AccountFiadoIncApi);
31
+ exports.default = AccountFiadoIncApi;
@@ -1 +1,2 @@
1
1
  export * from './interfaces/IAccountFiadoIncApi';
2
+ export * from './AccountFiadoIncApi';
@@ -15,3 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./interfaces/IAccountFiadoIncApi"), exports);
18
+ __exportStar(require("./AccountFiadoIncApi"), exports);
@@ -1,4 +1,5 @@
1
1
  import { AccountCreateRequest, AccountCreateResponse } from "@fiado/type-kit/bin/account";
2
+ import { ApiGatewayResponse } from "@fiado/gateway-adapter";
2
3
  export interface IAccountFiadoIncApi {
3
- createAccount(data: AccountCreateRequest): Promise<AccountCreateResponse>;
4
+ createAccount(data: AccountCreateRequest): Promise<ApiGatewayResponse<AccountCreateResponse>>;
4
5
  }
@@ -0,0 +1,10 @@
1
+ import { IAccountFiadoSAApi } from "./interfaces/IAccountFiadoSAApi";
2
+ import { AccountCreateRequest, AccountCreateResponse } from "@fiado/type-kit/bin/account";
3
+ import { ApiGatewayResponse } from "@fiado/gateway-adapter";
4
+ import { IHttpRequest } from "@fiado/http-client";
5
+ export default class AccountFiadoSAApi implements IAccountFiadoSAApi {
6
+ private httpRequest;
7
+ private readonly baseUrl;
8
+ constructor(httpRequest: IHttpRequest);
9
+ createAccount(data: AccountCreateRequest): Promise<ApiGatewayResponse<AccountCreateResponse>>;
10
+ }
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const inversify_1 = require("inversify");
16
+ let AccountFiadoSAApi = class AccountFiadoSAApi {
17
+ constructor(httpRequest) {
18
+ this.httpRequest = httpRequest;
19
+ this.baseUrl = process.env.ACCOUNT_FIADOSA_LAMBDA_URL || "";
20
+ }
21
+ async createAccount(data) {
22
+ const url = `${this.baseUrl}`;
23
+ return await this.httpRequest.post(url, data);
24
+ }
25
+ };
26
+ AccountFiadoSAApi = __decorate([
27
+ (0, inversify_1.injectable)(),
28
+ __param(0, (0, inversify_1.inject)("IHttpRequest")),
29
+ __metadata("design:paramtypes", [Object])
30
+ ], AccountFiadoSAApi);
31
+ exports.default = AccountFiadoSAApi;
@@ -1 +1,2 @@
1
1
  export * from './interfaces/IAccountFiadoSAApi';
2
+ export * from './AccountFiadoSAApi';
@@ -15,3 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./interfaces/IAccountFiadoSAApi"), exports);
18
+ __exportStar(require("./AccountFiadoSAApi"), exports);
@@ -1,4 +1,5 @@
1
1
  import { AccountCreateRequest, AccountCreateResponse } from "@fiado/type-kit/bin/account";
2
+ import { ApiGatewayResponse } from "@fiado/gateway-adapter";
2
3
  export interface IAccountFiadoSAApi {
3
- createAccount(data: AccountCreateRequest): Promise<AccountCreateResponse>;
4
+ createAccount(data: AccountCreateRequest): Promise<ApiGatewayResponse<AccountCreateResponse>>;
4
5
  }
@@ -0,0 +1,10 @@
1
+ import { IAccountPagoConfiadoApi } from "./interfaces/IAccountPagoConfiadoApi";
2
+ import { AccountCreateRequest, AccountCreateResponse } from "@fiado/type-kit/bin/account";
3
+ import { ApiGatewayResponse } from "@fiado/gateway-adapter";
4
+ import { IHttpRequest } from "@fiado/http-client";
5
+ export default class AccountPagoConfiadoApi implements IAccountPagoConfiadoApi {
6
+ private httpRequest;
7
+ private readonly baseUrl;
8
+ constructor(httpRequest: IHttpRequest);
9
+ createAccount(data: AccountCreateRequest): Promise<ApiGatewayResponse<AccountCreateResponse>>;
10
+ }
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const inversify_1 = require("inversify");
16
+ let AccountPagoConfiadoApi = class AccountPagoConfiadoApi {
17
+ constructor(httpRequest) {
18
+ this.httpRequest = httpRequest;
19
+ this.baseUrl = process.env.ACCOUNT_PAGOCONFIADO_LAMBDA_URL || "";
20
+ }
21
+ async createAccount(data) {
22
+ const url = `${this.baseUrl}`;
23
+ return await this.httpRequest.post(url, data);
24
+ }
25
+ };
26
+ AccountPagoConfiadoApi = __decorate([
27
+ (0, inversify_1.injectable)(),
28
+ __param(0, (0, inversify_1.inject)("IHttpRequest")),
29
+ __metadata("design:paramtypes", [Object])
30
+ ], AccountPagoConfiadoApi);
31
+ exports.default = AccountPagoConfiadoApi;
@@ -1 +1,2 @@
1
1
  export * from './interfaces/IAccountPagoConfiadoApi';
2
+ export * from './AccountPagoConfiadoApi';
@@ -15,3 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./interfaces/IAccountPagoConfiadoApi"), exports);
18
+ __exportStar(require("./AccountPagoConfiadoApi"), exports);
@@ -1,4 +1,5 @@
1
1
  import { AccountCreateRequest, AccountCreateResponse } from "@fiado/type-kit/bin/account";
2
+ import { ApiGatewayResponse } from "@fiado/gateway-adapter";
2
3
  export interface IAccountPagoConfiadoApi {
3
- createAccount(data: AccountCreateRequest): Promise<AccountCreateResponse>;
4
+ createAccount(data: AccountCreateRequest): Promise<ApiGatewayResponse<AccountCreateResponse>>;
4
5
  }
@@ -10,10 +10,18 @@ const identity_1 = require("./identity");
10
10
  const NotificationMessagePublisher_1 = __importDefault(require("./notificationMessages/queue/NotificationMessagePublisher"));
11
11
  const TernApi_1 = __importDefault(require("./tern/api/TernApi"));
12
12
  const PomeloApi_1 = __importDefault(require("./pomelo/api/PomeloApi"));
13
+ const address_1 = require("./address");
14
+ const AccountFiadoIncApi_1 = __importDefault(require("./account-fiadoinc/AccountFiadoIncApi"));
15
+ const AccountPagoConfiadoApi_1 = __importDefault(require("./account-pagoconfiado/AccountPagoConfiadoApi"));
16
+ const AccountFiadoSAApi_1 = __importDefault(require("./account-fiadosa/AccountFiadoSAApi"));
13
17
  exports.apiInvokerBindings = new inversify_1.ContainerModule((bind) => {
14
18
  bind("IDirectoryApi").to(directory_1.DirectoryApi);
15
19
  bind("IIdentityApi").to(identity_1.IdentityApi);
20
+ bind("IAddressApi").to(address_1.AddressApi);
16
21
  bind("ITernApi").to(TernApi_1.default);
17
22
  bind("IPomeloApi").to(PomeloApi_1.default);
23
+ bind("IAccountFiadoIncApi").to(AccountFiadoIncApi_1.default);
24
+ bind("IAccountPagoConfiadoApi").to(AccountPagoConfiadoApi_1.default);
25
+ bind("IAccountFiadoSAApi").to(AccountFiadoSAApi_1.default);
18
26
  bind("INotificationMessagesPublisher").to(NotificationMessagePublisher_1.default);
19
27
  });
package/package.json CHANGED
@@ -1,28 +1,28 @@
1
- {
2
- "name": "@fiado/api-invoker",
3
- "version": "1.0.29",
4
- "description": "Sirve como un puente entre diferentes funciones lambda, facilitando la comunicación entre ellas a traves de invocaciones http",
5
- "main": "bin/index.js",
6
- "types": "bin/index.d.ts",
7
- "scripts": {
8
- "test": "test",
9
- "build": "tsc"
10
- },
11
- "keywords": [],
12
- "author": "Fiado Inc",
13
- "license": "ISC",
14
- "dependencies": {
15
- "@aws-sdk/client-sqs": "^3.572.0",
16
- "@fiado/api-invoker": "^1.0.19",
17
- "@fiado/gateway-adapter": "^1.0.30",
18
- "@fiado/http-client": "^1.0.1",
19
- "@fiado/type-kit": "^1.0.71",
20
- "dotenv": "^16.4.5",
21
- "inversify": "^6.0.2",
22
- "reflect-metadata": "^0.2.1",
23
- "typescript": "^5.4.3"
24
- },
25
- "devDependencies": {
26
- "@types/node": "^20.12.7"
27
- }
28
- }
1
+ {
2
+ "name": "@fiado/api-invoker",
3
+ "version": "1.0.31",
4
+ "description": "Sirve como un puente entre diferentes funciones lambda, facilitando la comunicación entre ellas a traves de invocaciones http",
5
+ "main": "bin/index.js",
6
+ "types": "bin/index.d.ts",
7
+ "scripts": {
8
+ "test": "test",
9
+ "build": "tsc"
10
+ },
11
+ "keywords": [],
12
+ "author": "Fiado Inc",
13
+ "license": "ISC",
14
+ "dependencies": {
15
+ "@aws-sdk/client-sqs": "^3.572.0",
16
+ "@fiado/api-invoker": "^1.0.19",
17
+ "@fiado/gateway-adapter": "^1.0.30",
18
+ "@fiado/http-client": "^1.0.1",
19
+ "@fiado/type-kit": "^1.0.71",
20
+ "dotenv": "^16.4.5",
21
+ "inversify": "^6.0.2",
22
+ "reflect-metadata": "^0.2.1",
23
+ "typescript": "^5.4.3"
24
+ },
25
+ "devDependencies": {
26
+ "@types/node": "^20.12.7"
27
+ }
28
+ }
@@ -0,0 +1,18 @@
1
+ import {IAccountFiadoIncApi} from "./interfaces/IAccountFiadoIncApi";
2
+ import {AccountCreateRequest, AccountCreateResponse} from "@fiado/type-kit/bin/account";
3
+ import {inject, injectable} from "inversify";
4
+ import {IHttpRequest} from "@fiado/http-client";
5
+ import {ApiGatewayResponse} from "@fiado/gateway-adapter";
6
+
7
+ @injectable()
8
+ export default class AccountFiadoIncApi implements IAccountFiadoIncApi {
9
+ private readonly baseUrl = process.env.ACCOUNT_FIADOINC_LAMBDA_URL || "";
10
+
11
+ constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {
12
+ }
13
+
14
+ async createAccount(data: AccountCreateRequest): Promise<ApiGatewayResponse<AccountCreateResponse>> {
15
+ const url = `${this.baseUrl}`;
16
+ return await this.httpRequest.post(url, data);
17
+ }
18
+ }
@@ -1,3 +1,2 @@
1
-
2
-
3
- export * from './interfaces/IAccountFiadoIncApi';
1
+ export * from './interfaces/IAccountFiadoIncApi';
2
+ export * from './AccountFiadoIncApi';
@@ -1,8 +1,7 @@
1
- import { AccountCreateRequest, AccountCreateResponse } from "@fiado/type-kit/bin/account";
2
-
3
-
4
- export interface IAccountFiadoIncApi {
5
-
6
- createAccount(data: AccountCreateRequest): Promise<AccountCreateResponse>;
7
-
1
+ import { AccountCreateRequest, AccountCreateResponse } from "@fiado/type-kit/bin/account";
2
+ import {ApiGatewayResponse} from "@fiado/gateway-adapter";
3
+
4
+
5
+ export interface IAccountFiadoIncApi {
6
+ createAccount(data: AccountCreateRequest): Promise<ApiGatewayResponse<AccountCreateResponse>>;
8
7
  }
@@ -0,0 +1,18 @@
1
+ import {IAccountFiadoSAApi} from "./interfaces/IAccountFiadoSAApi";
2
+ import {AccountCreateRequest, AccountCreateResponse} from "@fiado/type-kit/bin/account";
3
+ import {ApiGatewayResponse} from "@fiado/gateway-adapter";
4
+ import {inject, injectable} from "inversify";
5
+ import {IHttpRequest} from "@fiado/http-client";
6
+
7
+ @injectable()
8
+ export default class AccountFiadoSAApi implements IAccountFiadoSAApi {
9
+ private readonly baseUrl = process.env.ACCOUNT_FIADOSA_LAMBDA_URL || "";
10
+
11
+ constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {
12
+ }
13
+
14
+ async createAccount(data: AccountCreateRequest): Promise<ApiGatewayResponse<AccountCreateResponse>> {
15
+ const url = `${this.baseUrl}`;
16
+ return await this.httpRequest.post(url, data);
17
+ }
18
+ }
@@ -1,2 +1,2 @@
1
-
2
- export * from './interfaces/IAccountFiadoSAApi';
1
+ export * from './interfaces/IAccountFiadoSAApi';
2
+ export * from './AccountFiadoSAApi';
@@ -1,9 +1,7 @@
1
- import { AccountCreateRequest, AccountCreateResponse } from "@fiado/type-kit/bin/account";
2
-
3
-
4
-
5
- export interface IAccountFiadoSAApi {
6
-
7
- createAccount(data: AccountCreateRequest): Promise<AccountCreateResponse>;
8
-
1
+ import {AccountCreateRequest, AccountCreateResponse} from "@fiado/type-kit/bin/account";
2
+ import {ApiGatewayResponse} from "@fiado/gateway-adapter";
3
+
4
+
5
+ export interface IAccountFiadoSAApi {
6
+ createAccount(data: AccountCreateRequest): Promise<ApiGatewayResponse<AccountCreateResponse>>;
9
7
  }
@@ -0,0 +1,18 @@
1
+ import {IAccountPagoConfiadoApi} from "./interfaces/IAccountPagoConfiadoApi";
2
+ import {AccountCreateRequest, AccountCreateResponse} from "@fiado/type-kit/bin/account";
3
+ import {ApiGatewayResponse} from "@fiado/gateway-adapter";
4
+ import {inject, injectable} from "inversify";
5
+ import {IHttpRequest} from "@fiado/http-client";
6
+
7
+ @injectable()
8
+ export default class AccountPagoConfiadoApi implements IAccountPagoConfiadoApi {
9
+ private readonly baseUrl = process.env.ACCOUNT_PAGOCONFIADO_LAMBDA_URL || "";
10
+
11
+ constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {
12
+ }
13
+
14
+ async createAccount(data: AccountCreateRequest): Promise<ApiGatewayResponse<AccountCreateResponse>> {
15
+ const url = `${this.baseUrl}`;
16
+ return await this.httpRequest.post(url, data);
17
+ }
18
+ }
@@ -1,2 +1,2 @@
1
-
2
- export * from './interfaces/IAccountPagoConfiadoApi';
1
+ export * from './interfaces/IAccountPagoConfiadoApi';
2
+ export * from './AccountPagoConfiadoApi';
@@ -1,8 +1,7 @@
1
- import { AccountCreateRequest, AccountCreateResponse } from "@fiado/type-kit/bin/account";
2
-
3
-
4
- export interface IAccountPagoConfiadoApi {
5
-
6
- createAccount(data: AccountCreateRequest): Promise<AccountCreateResponse>;
7
-
1
+ import {AccountCreateRequest, AccountCreateResponse} from "@fiado/type-kit/bin/account";
2
+ import {ApiGatewayResponse} from "@fiado/gateway-adapter";
3
+
4
+
5
+ export interface IAccountPagoConfiadoApi {
6
+ createAccount(data: AccountCreateRequest): Promise<ApiGatewayResponse<AccountCreateResponse>>;
8
7
  }
@@ -1,48 +1,47 @@
1
- import { IHttpRequest } from "@fiado/http-client";
2
- import { AddressCreateRequest, AddressResponse, 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
-
11
- private readonly baseUrl = process.env.ADDRESS_LAMBDA_URL || "";
12
- constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) { }
13
-
14
- async getByDirectoryId(directoryId: string): Promise<AddressResponse[]> {
15
-
16
- this.validateBaseUrl();
17
- this.validateDirectoryId(directoryId);
18
-
19
- const url = `${this.baseUrl}/users/${directoryId}`;
20
-
21
- return await this.httpRequest.post(`${url}`, null);
22
- }
23
-
24
- async create(directoryId: string, address: AddressCreateRequest): Promise<void> {
25
- this.validateBaseUrl();
26
- this.validateDirectoryId(directoryId);
27
- const url = `${this.baseUrl}/users/${directoryId}`;
28
- await this.httpRequest.post<void>(url, address);
29
- }
30
-
31
- async getAddressLocationShipping(input: AddressShippingCardRequest): Promise<AddressShippingCardResponse> {
32
- this.validateBaseUrl();
33
- const url = `${this.baseUrl}/shipping`;
34
- return await this.httpRequest.post<AddressShippingCardResponse>(url, input);
35
- }
36
-
37
- private validateBaseUrl() {
38
- if (!this.baseUrl) {
39
- throw new Error("Environment variable ADDRESS_LAMBDA_URL value not found");
40
- }
41
- }
42
-
43
- private validateDirectoryId(directoryId: string) {
44
- if (!directoryId) {
45
- throw new Error("Directory ID is required.");
46
- }
47
- }
1
+ import { IHttpRequest } from "@fiado/http-client";
2
+ import { AddressCreateRequest, AddressResponse, 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<AddressResponse[]> {
14
+
15
+ this.validateBaseUrl();
16
+ this.validateDirectoryId(directoryId);
17
+
18
+ const url = `${this.baseUrl}/users/${directoryId}`;
19
+
20
+ return await this.httpRequest.post(`${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
+ }
48
47
  }
@@ -1,4 +1,4 @@
1
-
2
-
3
- export * from './interfaces/IAddressApi';
1
+
2
+
3
+ export * from './interfaces/IAddressApi';
4
4
  export * from './AddressApi';