@fiado/api-invoker 1.0.19 → 1.0.21

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.
@@ -9,9 +9,11 @@ const directory_1 = require("./directory");
9
9
  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
+ const PomeloApi_1 = __importDefault(require("./pomelo/api/PomeloApi"));
12
13
  exports.apiInvokerBindings = new inversify_1.ContainerModule((bind) => {
13
14
  bind("IDirectoryApi").to(directory_1.DirectoryApi);
14
15
  bind("IIdentityApi").to(identity_1.IdentityApi);
15
16
  bind("ITernApi").to(TernApi_1.default);
17
+ bind("IPomeloApi").to(PomeloApi_1.default);
16
18
  bind("INotificationMessagesPublisher").to(NotificationMessagePublisher_1.default);
17
19
  });
@@ -1,8 +1,11 @@
1
1
  import { IIdentityApi } from "./interfaces/IIdentityApi";
2
2
  import { IHttpRequest } from "@fiado/http-client";
3
+ import { PeopleUpdateRequest } from "@fiado/type-kit/bin/identity";
3
4
  export declare class IdentityApi implements IIdentityApi {
4
5
  private httpRequest;
5
6
  private readonly baseUrl;
6
7
  constructor(httpRequest: IHttpRequest);
7
8
  getPeopleByIds(ids: string[]): Promise<any>;
9
+ updatePeopleById(id: string, data: PeopleUpdateRequest): Promise<void>;
10
+ getProfilePicture(directoryId: string): Promise<any>;
8
11
  }
@@ -31,6 +31,21 @@ let IdentityApi = class IdentityApi {
31
31
  const url = `${this.baseUrl}identities/people?${ids.map(id => `id=${encodeURIComponent(id)}`).join('&')}`;
32
32
  return await this.httpRequest.get(`${url}`);
33
33
  }
34
+ async updatePeopleById(id, data) {
35
+ if (!id) {
36
+ throw new Error("People ID is required.");
37
+ }
38
+ const url = `${this.baseUrl}identities/people/${id}`;
39
+ await this.httpRequest.put(url, data);
40
+ }
41
+ async getProfilePicture(directoryId) {
42
+ if (!directoryId) {
43
+ throw new Error("Directory ID is required.");
44
+ }
45
+ const url = `${this.baseUrl}identities/profile?directoryId=${directoryId}&typeOfDirectoryId=USER`;
46
+ const operationName = "getUserInfoByIds";
47
+ return await this.httpRequest.get(url, { 'operationName': operationName });
48
+ }
34
49
  };
35
50
  exports.IdentityApi = IdentityApi;
36
51
  exports.IdentityApi = IdentityApi = __decorate([
@@ -1,3 +1,4 @@
1
+ import { PeopleUpdateRequest } from "@fiado/type-kit/bin/identity";
1
2
  /**
2
3
  * Interfaz para el servicio Directory que permite operaciones sobre directorios.
3
4
  */
@@ -10,4 +11,19 @@ export interface IIdentityApi {
10
11
  * @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
11
12
  */
12
13
  getPeopleByIds(ids: string[]): Promise<any>;
14
+ /**
15
+ * Actualiza la información de un people.
16
+ * @param id ID de people a actualizar.
17
+ * @param data Datos de people a actualizar.
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
+ updatePeopleById(id: string, data: PeopleUpdateRequest): Promise<void>;
22
+ /**
23
+ * Obtiene la URL de la imagen de perfil de un usuario.
24
+ * @param directoryId ID de directorio del usuario.
25
+ * @returns Una promesa que resuelve a un objeto con la URL de la imagen de perfil.
26
+ * @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
27
+ */
28
+ getProfilePicture(directoryId: string): Promise<any>;
13
29
  }
package/bin/index.d.ts CHANGED
@@ -3,5 +3,6 @@ export * from './identity';
3
3
  export * from './notificationMessages';
4
4
  export * from './sessionActivity';
5
5
  export * from './tern';
6
+ export * from './pomelo';
6
7
  export * from './address';
7
8
  export * from "./container.config";
package/bin/index.js CHANGED
@@ -19,5 +19,6 @@ __exportStar(require("./identity"), exports);
19
19
  __exportStar(require("./notificationMessages"), exports);
20
20
  __exportStar(require("./sessionActivity"), exports);
21
21
  __exportStar(require("./tern"), exports);
22
+ __exportStar(require("./pomelo"), exports);
22
23
  __exportStar(require("./address"), exports);
23
24
  __exportStar(require("./container.config"), exports);
@@ -0,0 +1,9 @@
1
+ import { IPomeloApi } from "./interfaces/IPomeloApi";
2
+ import { IHttpRequest } from "@fiado/http-client";
3
+ import { CreateBankAccountUserInput } from "@fiado/type-kit/bin/account";
4
+ export default class PomeloApi implements IPomeloApi {
5
+ private httpRequest;
6
+ private readonly baseUrl;
7
+ constructor(httpRequest: IHttpRequest);
8
+ createUser(request: CreateBankAccountUserInput): Promise<any>;
9
+ }
@@ -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 PomeloApi = class PomeloApi {
17
+ constructor(httpRequest) {
18
+ this.httpRequest = httpRequest;
19
+ this.baseUrl = process.env.POMELO_LAMBDA_URL || "";
20
+ }
21
+ async createUser(request) {
22
+ const url = `${this.baseUrl}users/create`;
23
+ return await this.httpRequest.post(url, request);
24
+ }
25
+ };
26
+ PomeloApi = __decorate([
27
+ (0, inversify_1.injectable)(),
28
+ __param(0, (0, inversify_1.inject)("IHttpRequest")),
29
+ __metadata("design:paramtypes", [Object])
30
+ ], PomeloApi);
31
+ exports.default = PomeloApi;
@@ -0,0 +1,4 @@
1
+ import { CreateBankAccountUserInput } from "@fiado/type-kit/bin/account";
2
+ export interface IPomeloApi {
3
+ createUser(request: CreateBankAccountUserInput): Promise<any>;
4
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ export * from './api/PomeloApi';
2
+ export * from './api/interfaces/IPomeloApi';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./api/PomeloApi"), exports);
18
+ __exportStar(require("./api/interfaces/IPomeloApi"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiado/api-invoker",
3
- "version": "1.0.19",
3
+ "version": "1.0.21",
4
4
  "description": "Sirve como un puente entre diferentes funciones lambda, facilitando la comunicación entre ellas a traves de invocaciones http",
5
5
  "main": "bin/index.js",
6
6
  "types": "bin/index.d.ts",
@@ -13,10 +13,10 @@
13
13
  "license": "ISC",
14
14
  "dependencies": {
15
15
  "@aws-sdk/client-sqs": "^3.572.0",
16
- "@fiado/api-invoker": "^1.0.5",
16
+ "@fiado/api-invoker": "^1.0.19",
17
17
  "@fiado/gateway-adapter": "^1.0.30",
18
18
  "@fiado/http-client": "^1.0.1",
19
- "@fiado/type-kit": "^1.0.61",
19
+ "@fiado/type-kit": "^1.0.65",
20
20
  "dotenv": "^16.4.5",
21
21
  "inversify": "^6.0.2",
22
22
  "reflect-metadata": "^0.2.1",
@@ -5,10 +5,13 @@ import {INotificationMessagesPublisher} from "./notificationMessages";
5
5
  import NotificationMessagePublisher from "./notificationMessages/queue/NotificationMessagePublisher";
6
6
  import {ITernApi} from "./tern";
7
7
  import TernApi from "./tern/api/TernApi";
8
+ import { IPomeloApi } from "./pomelo";
9
+ import PomeloApi from "./pomelo/api/PomeloApi";
8
10
 
9
11
  export const apiInvokerBindings = new ContainerModule((bind: interfaces.Bind) => {
10
12
  bind<IDirectoryApi>("IDirectoryApi").to(DirectoryApi);
11
13
  bind<IIdentityApi>("IIdentityApi").to(IdentityApi);
12
14
  bind<ITernApi>("ITernApi").to(TernApi);
15
+ bind<IPomeloApi>("IPomeloApi").to(PomeloApi);
13
16
  bind<INotificationMessagesPublisher>("INotificationMessagesPublisher").to(NotificationMessagePublisher);
14
17
  });
@@ -2,15 +2,16 @@ import { inject, injectable } from "inversify";
2
2
  import { IIdentityApi } from "./interfaces/IIdentityApi";
3
3
  import { IHttpRequest } from "@fiado/http-client";
4
4
  import dotenv from 'dotenv';
5
- dotenv.config();
5
+ import { PeopleUpdateRequest } from "@fiado/type-kit/bin/identity";
6
+ dotenv.config();
6
7
 
7
8
  @injectable()
8
9
  export class IdentityApi implements IIdentityApi {
9
10
 
10
11
  private readonly baseUrl = process.env.IDENTITY_LAMBDA_URL || "";
11
-
12
+
12
13
  constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) { }
13
-
14
+
14
15
  async getPeopleByIds(ids: string[]): Promise<any> {
15
16
 
16
17
  if (ids.length === 0) {
@@ -18,8 +19,30 @@ export class IdentityApi implements IIdentityApi {
18
19
  }
19
20
 
20
21
  const url = `${this.baseUrl}identities/people?${ids.map(id => `id=${encodeURIComponent(id)}`).join('&')}`;
21
-
22
22
  return await this.httpRequest.get(`${url}`);
23
+ }
24
+
25
+ async updatePeopleById(id: string, data: PeopleUpdateRequest): Promise<void> {
26
+
27
+ if (!id) {
28
+ throw new Error("People ID is required.")
29
+ }
30
+
31
+ const url = `${this.baseUrl}identities/people/${id}`;
32
+ await this.httpRequest.put<void>(url, data);
33
+
34
+ }
35
+
36
+ async getProfilePicture(directoryId: string): Promise<any> {
37
+
38
+ if (!directoryId) {
39
+ throw new Error("Directory ID is required.")
40
+ }
41
+
42
+ const url = `${this.baseUrl}identities/profile?directoryId=${directoryId}&typeOfDirectoryId=USER`;
43
+ const operationName = "getUserInfoByIds";
44
+
45
+ return await this.httpRequest.get<any>(url, { 'operationName': operationName });
23
46
 
24
47
  }
25
48
  }
@@ -1,3 +1,4 @@
1
+ import { PeopleUpdateRequest } from "@fiado/type-kit/bin/identity";
1
2
 
2
3
  /**
3
4
  * Interfaz para el servicio Directory que permite operaciones sobre directorios.
@@ -11,4 +12,22 @@ export interface IIdentityApi {
11
12
  * @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
12
13
  */
13
14
  getPeopleByIds(ids: string[]): Promise<any>;
15
+
16
+ /**
17
+ * Actualiza la información de un people.
18
+ * @param id ID de people a actualizar.
19
+ * @param data Datos de people a actualizar.
20
+ * @returns Una promesa que resuelve a void.
21
+ * @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
22
+ */
23
+ updatePeopleById(id: string, data: PeopleUpdateRequest): Promise<void>;
24
+
25
+ /**
26
+ * Obtiene la URL de la imagen de perfil de un usuario.
27
+ * @param directoryId ID de directorio del usuario.
28
+ * @returns Una promesa que resuelve a un objeto con la URL de la imagen de perfil.
29
+ * @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
30
+ */
31
+ getProfilePicture(directoryId: string): Promise<any>;
32
+
14
33
  }
package/src/index.ts CHANGED
@@ -3,6 +3,7 @@ export * from './identity';
3
3
  export * from './notificationMessages';
4
4
  export * from './sessionActivity';
5
5
  export * from './tern';
6
+ export * from './pomelo';
6
7
  export * from './address';
7
8
 
8
9
  export * from "./container.config";
@@ -0,0 +1,18 @@
1
+ import {IPomeloApi } from "./interfaces/IPomeloApi";
2
+ import {inject, injectable} from "inversify";
3
+ import {IHttpRequest} from "@fiado/http-client";
4
+ import { CreateBankAccountUserInput } from "@fiado/type-kit/bin/account";
5
+
6
+ @injectable()
7
+ export default class PomeloApi implements IPomeloApi {
8
+ private readonly baseUrl = process.env.POMELO_LAMBDA_URL || "";
9
+
10
+ constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {
11
+ }
12
+
13
+ async createUser(request: CreateBankAccountUserInput): Promise<any> {
14
+ const url: string = `${this.baseUrl}users/create`;
15
+ return await this.httpRequest.post(url, request);
16
+ }
17
+
18
+ }
@@ -0,0 +1,5 @@
1
+ import { CreateBankAccountUserInput } from "@fiado/type-kit/bin/account";
2
+
3
+ export interface IPomeloApi {
4
+ createUser(request: CreateBankAccountUserInput): Promise<any>;
5
+ }
@@ -0,0 +1,2 @@
1
+ export * from './api/PomeloApi';
2
+ export * from './api/interfaces/IPomeloApi';