@fiado/api-invoker 1.0.36 → 1.0.37

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.
@@ -1,8 +1,11 @@
1
1
  import { IHttpRequest } from "@fiado/http-client";
2
2
  import { IDirectoryApi } from "./interfaces/IDirectoryApi";
3
+ import { Provider } from '@fiado/type-kit/bin/provider';
3
4
  export declare class DirectoryApi implements IDirectoryApi {
4
5
  private httpRequest;
5
6
  private readonly baseUrl;
6
7
  constructor(httpRequest: IHttpRequest);
7
8
  getByIds(ids: string[]): Promise<any>;
9
+ updateExternalUserId(directoryId: string, provider: Provider, externalUserId: string): Promise<void>;
10
+ updateScope(directoryId: string, scope: string[]): Promise<void>;
8
11
  }
@@ -32,6 +32,27 @@ let DirectoryApi = class DirectoryApi {
32
32
  const operationName = "getUserInfoByIds";
33
33
  return await this.httpRequest.post(`${url}`, null, { 'operationName': operationName });
34
34
  }
35
+ async updateExternalUserId(directoryId, provider, externalUserId) {
36
+ const url = `${this.baseUrl}`;
37
+ const operationName = "updateExternalUser";
38
+ const body = {
39
+ directoryId: directoryId,
40
+ typeOfDirectoryId: "USER",
41
+ provider: provider,
42
+ user: externalUserId
43
+ };
44
+ return await this.httpRequest.post(`${url}`, body, { 'operationName': operationName });
45
+ }
46
+ async updateScope(directoryId, scope) {
47
+ const url = `${this.baseUrl}`;
48
+ const operationName = "updateScope";
49
+ const body = {
50
+ directoryId: directoryId,
51
+ typeOfDirectoryId: "USER",
52
+ scope: scope
53
+ };
54
+ return await this.httpRequest.post(`${url}`, body, { 'operationName': operationName });
55
+ }
35
56
  };
36
57
  exports.DirectoryApi = DirectoryApi;
37
58
  exports.DirectoryApi = DirectoryApi = __decorate([
@@ -1,3 +1,4 @@
1
+ import { Provider } from "@fiado/type-kit/bin/provider";
1
2
  /**
2
3
  * Interfaz para el servicio Directory que permite operaciones sobre directorios.
3
4
  */
@@ -10,4 +11,21 @@ export interface IDirectoryApi {
10
11
  * @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
11
12
  */
12
13
  getByIds(ids: string[]): Promise<any>;
14
+ /**
15
+ * Actualiza el ID de usuario externo en un directorio.
16
+ * @param directoryId ID del directorio (UUID) a actualizar.
17
+ * @param provider Proveedor de autenticación del usuario.
18
+ * @param externalUserId ID de usuario externo.
19
+ * @returns Una promesa que resuelve a un objeto vacío.
20
+ * @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
21
+ */
22
+ updateExternalUserId(directoryId: string, provider: Provider, externalUserId: string): Promise<void>;
23
+ /**
24
+ * Actualiza el alcance de un directorio.
25
+ * @param directoryId ID del directorio (UUID) a actualizar.
26
+ * @param scope Alcance a actualizar.
27
+ * @returns Una promesa que resuelve a un objeto vacío.
28
+ * @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
29
+ */
30
+ updateScope(directoryId: string, scope: string[]): Promise<void>;
13
31
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiado/api-invoker",
3
- "version": "1.0.36",
3
+ "version": "1.0.37",
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,7 +1,8 @@
1
1
  import dotenv from 'dotenv';
2
- import {inject, injectable} from "inversify";
3
- import {IHttpRequest} from "@fiado/http-client";
4
- import {IDirectoryApi} from "./interfaces/IDirectoryApi";
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';
5
6
 
6
7
  dotenv.config();
7
8
 
@@ -22,6 +23,35 @@ export class DirectoryApi implements IDirectoryApi {
22
23
  const url = `${this.baseUrl}?${ids.map(id => `directoryId=${encodeURIComponent(id)}`).join('&')}`;
23
24
  const operationName = "getUserInfoByIds";
24
25
 
25
- return await this.httpRequest.post(`${url}`, null, {'operationName': operationName});
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 });
26
56
  }
27
57
  }
@@ -1,3 +1,4 @@
1
+ import { Provider } from "@fiado/type-kit/bin/provider";
1
2
 
2
3
  /**
3
4
  * Interfaz para el servicio Directory que permite operaciones sobre directorios.
@@ -11,4 +12,24 @@ export interface IDirectoryApi {
11
12
  * @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
12
13
  */
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>;
14
35
  }