@fiado/api-invoker 1.0.7 → 1.0.9

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.
@@ -4,7 +4,5 @@ export declare class DirectoryApi implements IDirectoryApi {
4
4
  private httpRequest;
5
5
  private readonly baseUrl;
6
6
  constructor(httpRequest: IHttpRequest);
7
- getByIds(ids: string[]): Promise<Array<{
8
- [key: string]: any;
9
- }>>;
7
+ getByIds(ids: string[]): Promise<Array<any>>;
10
8
  }
@@ -30,7 +30,7 @@ let DirectoryApi = class DirectoryApi {
30
30
  }
31
31
  const url = `${this.baseUrl}?${ids.map(id => `directoryId=${encodeURIComponent(id)}`).join('&')}`;
32
32
  const operationName = "getUserInfoByIds";
33
- return await this.httpRequest.post(`${this.baseUrl}`, {}, { 'operationName': operationName });
33
+ return await this.httpRequest.post(`${url}`, null, { 'operationName': operationName });
34
34
  }
35
35
  };
36
36
  exports.DirectoryApi = DirectoryApi;
@@ -11,9 +11,14 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  var __param = (this && this.__param) || function (paramIndex, decorator) {
12
12
  return function (target, key) { decorator(target, key, paramIndex); }
13
13
  };
14
+ var __importDefault = (this && this.__importDefault) || function (mod) {
15
+ return (mod && mod.__esModule) ? mod : { "default": mod };
16
+ };
14
17
  Object.defineProperty(exports, "__esModule", { value: true });
15
18
  exports.IdentityApi = void 0;
16
19
  const inversify_1 = require("inversify");
20
+ const dotenv_1 = __importDefault(require("dotenv"));
21
+ dotenv_1.default.config();
17
22
  let IdentityApi = class IdentityApi {
18
23
  constructor(httpRequest) {
19
24
  this.httpRequest = httpRequest;
@@ -21,10 +26,10 @@ let IdentityApi = class IdentityApi {
21
26
  }
22
27
  async getPeopleByIds(ids) {
23
28
  if (ids.length === 0) {
24
- throw new Error("At least one identity ID is required.");
29
+ throw new Error("At least one people ID is required.");
25
30
  }
26
31
  const url = `${this.baseUrl}identities/people?${ids.map(id => `peopleId=${encodeURIComponent(id)}`).join('&')}`;
27
- return await this.httpRequest.post(`${this.baseUrl}`, {});
32
+ return await this.httpRequest.post(`${url}`, {});
28
33
  }
29
34
  };
30
35
  exports.IdentityApi = IdentityApi;
@@ -9,7 +9,5 @@ export interface IIdentityApi {
9
9
  * Puede devolver un arreglo vacío si no se encuentran coincidencias.
10
10
  * @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
11
11
  */
12
- getPeopleByIds(ids: string[]): Promise<Array<{
13
- [key: string]: any;
14
- }>>;
12
+ getPeopleByIds(ids: string[]): Promise<Array<any>>;
15
13
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiado/api-invoker",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
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",
@@ -1,9 +1,8 @@
1
-
2
1
  import { inject, injectable } from "inversify";
3
2
  import { IDirectoryApi } from "./interfaces/IDirectoryApi";
4
3
  import { IHttpRequest } from "@fiado/http-client";
5
4
  import dotenv from 'dotenv';
6
- dotenv.config();
5
+ dotenv.config();
7
6
 
8
7
  @injectable()
9
8
  export class DirectoryApi implements IDirectoryApi {
@@ -12,7 +11,7 @@ export class DirectoryApi implements IDirectoryApi {
12
11
 
13
12
  constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) { }
14
13
 
15
- public async getByIds(ids: string[]): Promise<Array<{ [key: string]: any }>> {
14
+ public async getByIds(ids: string[]): Promise<Array<any>> {
16
15
 
17
16
  if (ids.length === 0) {
18
17
  throw new Error("At least one directory ID is required.")
@@ -21,6 +20,6 @@ export class DirectoryApi implements IDirectoryApi {
21
20
  const url = `${this.baseUrl}?${ids.map(id => `directoryId=${encodeURIComponent(id)}`).join('&')}`;
22
21
  const operationName = "getUserInfoByIds";
23
22
 
24
- return await this.httpRequest.post(`${this.baseUrl}`, {}, { 'operationName': operationName } );
23
+ return await this.httpRequest.post(`${url}`, null, { 'operationName': operationName });
25
24
  }
26
25
  }
@@ -1,6 +1,8 @@
1
1
  import { inject, injectable } from "inversify";
2
2
  import { IIdentityApi } from "./interfaces/IIdentityApi";
3
3
  import { IHttpRequest } from "@fiado/http-client";
4
+ import dotenv from 'dotenv';
5
+ dotenv.config();
4
6
 
5
7
  @injectable()
6
8
  export class IdentityApi implements IIdentityApi {
@@ -12,12 +14,12 @@ export class IdentityApi implements IIdentityApi {
12
14
  async getPeopleByIds(ids: string[]): Promise<{ [key: string]: any; }[]> {
13
15
 
14
16
  if (ids.length === 0) {
15
- throw new Error("At least one identity ID is required.")
17
+ throw new Error("At least one people ID is required.")
16
18
  }
17
19
 
18
20
  const url = `${this.baseUrl}identities/people?${ids.map(id => `peopleId=${encodeURIComponent(id)}`).join('&')}`;
19
21
 
20
- return await this.httpRequest.post(`${this.baseUrl}`, {} );
22
+ return await this.httpRequest.post(`${url}`, {} );
21
23
 
22
24
  }
23
25
  }
@@ -10,5 +10,5 @@ export interface IIdentityApi {
10
10
  * Puede devolver un arreglo vacío si no se encuentran coincidencias.
11
11
  * @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
12
12
  */
13
- getPeopleByIds(ids: string[]): Promise<Array<{[key: string]: any}>>;
13
+ getPeopleByIds(ids: string[]): Promise<Array<any>>;
14
14
  }