@fiado/api-invoker 1.0.36 → 1.0.38

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/bin/index.d.ts CHANGED
@@ -5,6 +5,7 @@ export * from './sessionActivity';
5
5
  export * from './tern';
6
6
  export * from './pomelo';
7
7
  export * from './address';
8
+ export * from './stpAccount';
8
9
  export * from "./container.config";
9
10
  export * from "./account-fiadoinc";
10
11
  export * from "./account-fiadosa";
package/bin/index.js CHANGED
@@ -21,6 +21,7 @@ __exportStar(require("./sessionActivity"), exports);
21
21
  __exportStar(require("./tern"), exports);
22
22
  __exportStar(require("./pomelo"), exports);
23
23
  __exportStar(require("./address"), exports);
24
+ __exportStar(require("./stpAccount"), exports);
24
25
  __exportStar(require("./container.config"), exports);
25
26
  __exportStar(require("./account-fiadoinc"), exports);
26
27
  __exportStar(require("./account-fiadosa"), exports);
@@ -0,0 +1,9 @@
1
+ import { ISTPAccountApi } from "./interfaces/ISTPAccountApi";
2
+ import { IHttpRequest } from "@fiado/http-client";
3
+ import { CreateBankAccountRequest } from "@fiado/type-kit/bin/account";
4
+ export default class PomeloApi implements ISTPAccountApi {
5
+ private httpRequest;
6
+ private readonly baseUrl;
7
+ constructor(httpRequest: IHttpRequest);
8
+ createAccount(request: CreateBankAccountRequest): Promise<any>;
9
+ }
@@ -0,0 +1,33 @@
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.STP_ACCOUNT_LAMBDA_URL || "";
20
+ }
21
+ //ACCOUNT
22
+ // //USER
23
+ async createAccount(request) {
24
+ const url = `${this.baseUrl}account/create`;
25
+ return await this.httpRequest.post(url, request);
26
+ }
27
+ };
28
+ PomeloApi = __decorate([
29
+ (0, inversify_1.injectable)(),
30
+ __param(0, (0, inversify_1.inject)("IHttpRequest")),
31
+ __metadata("design:paramtypes", [Object])
32
+ ], PomeloApi);
33
+ exports.default = PomeloApi;
@@ -0,0 +1,4 @@
1
+ import { CreateBankAccountRequest } from "@fiado/type-kit/bin/account";
2
+ export interface ISTPAccountApi {
3
+ createAccount(request: CreateBankAccountRequest): 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/STPAccountApi';
2
+ export * from './api/interfaces/ISTPAccountApi';
@@ -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/STPAccountApi"), exports);
18
+ __exportStar(require("./api/interfaces/ISTPAccountApi"), exports);
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.38",
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",
@@ -16,7 +16,7 @@
16
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.77",
19
+ "@fiado/type-kit": "^1.0.79",
20
20
  "dotenv": "^16.4.5",
21
21
  "inversify": "^6.0.2",
22
22
  "reflect-metadata": "^0.2.1",
@@ -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
  }
package/src/index.ts CHANGED
@@ -5,6 +5,7 @@ export * from './sessionActivity';
5
5
  export * from './tern';
6
6
  export * from './pomelo';
7
7
  export * from './address';
8
+ export * from './stpAccount'
8
9
  export * from "./container.config";
9
10
  export * from "./account-fiadoinc";
10
11
  export * from "./account-fiadosa";
@@ -0,0 +1,102 @@
1
+ import {ISTPAccountApi } from "./interfaces/ISTPAccountApi";
2
+ import {inject, injectable} from "inversify";
3
+ import {IHttpRequest} from "@fiado/http-client";
4
+ import {CreateBankAccountRequest, CreateBankAccountUserRequest, UpdateBankAccountUserRequest} from "@fiado/type-kit/bin/account";
5
+
6
+
7
+ @injectable()
8
+ export default class PomeloApi implements ISTPAccountApi {
9
+
10
+
11
+ private readonly baseUrl = process.env.STP_ACCOUNT_LAMBDA_URL || "";
12
+
13
+ constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {
14
+ }
15
+
16
+ //ACCOUNT
17
+ // //USER
18
+ async createAccount(request: CreateBankAccountRequest): Promise<any> {
19
+ const url: string = `${this.baseUrl}account/create`;
20
+ return await this.httpRequest.post(url, request);
21
+ }
22
+
23
+
24
+ // //USER
25
+ // async createUser(request: CreateBankAccountUserRequest): Promise<any> {
26
+ // const url: string = `${this.baseUrl}users/create`;
27
+ // return await this.httpRequest.post(url, request);
28
+ // }
29
+
30
+ // public async getUserById(externalUserId: string): Promise<any> {
31
+ // const url: string = `${this.baseUrl}users/${externalUserId}`;
32
+ // return await this.httpRequest.get(url);
33
+ // }
34
+
35
+ // public async updateUser(object: UpdateBankAccountUserRequest): Promise<any> {
36
+ // const url: string = `${this.baseUrl}/users/${object.id}`;
37
+ // return await this.httpRequest.put(url, object);
38
+ // }
39
+
40
+ // //Card
41
+ // public async getCardSensitiveInformation(externalCardId: string, externalUserId?: string): Promise<GetBankAccountSensitiveInformationOutput> {
42
+ // const url: string = `${this.baseUrl}cards/${externalCardId}/sensitive?externalUserId=${externalUserId}`;
43
+ // return await this.httpRequest.get(url);
44
+ // }
45
+
46
+ // public async getCardsById(externalCardId: string): Promise<GetBankAccountCardOutput> {
47
+ // const url: string = `${this.baseUrl}cards?externalCardId=${externalCardId}`;
48
+ // return await this.httpRequest.get(url);
49
+ // }
50
+
51
+ // public async getCardsByUserId(externalUserId: string): Promise<GetBankAccountCardOutput> {
52
+ // const url: string = `${this.baseUrl}cards?externalUserId=${externalUserId}`;
53
+ // return await this.httpRequest.get(url);
54
+ // }
55
+
56
+ // public async createCard(object: CreateBankAccountCardInput): Promise<CreateBankAccountCardOutput> {
57
+ // const url: string = `${this.baseUrl}cards/create`;
58
+ // return await this.httpRequest.post(url, object);
59
+ // }
60
+
61
+ // public async blockCard(object: UpdateBankAccountCardInput): Promise<UpdateBankAccountCardOutput> {
62
+ // const url: string = `${this.baseUrl}cards/${object.cardId}/`;
63
+ // return await this.httpRequest.put(url, object);
64
+ // }
65
+
66
+ // public async changePin(object: UpdateBankAccountCardInput): Promise<UpdateBankAccountCardOutput> {
67
+ // const url: string = `${this.baseUrl}cards/${object.cardId}/`;
68
+ // return await this.httpRequest.put(url, object);
69
+ // }
70
+
71
+ // public async activateCard(object: ActivateBankAccountCardInput): Promise<ActivateBankAccountCardOutput> {
72
+ // const url: string = `${this.baseUrl}cards/activate`;
73
+ // return await this.httpRequest.post(url, object);
74
+ // }
75
+
76
+ // public async updateCard(object: UpdateBankAccountCardInput): Promise<UpdateBankAccountCardOutput> {
77
+ // const url: string = `${this.baseUrl}cards/${object.cardId}/`;
78
+ // return await this.httpRequest.put(url, object);
79
+ // }
80
+
81
+
82
+ // //Shipping
83
+
84
+ // public async createShipment(object: CreateBankAccountCardShippingInput): Promise<any> {
85
+ // const url: string = `${this.baseUrl}shipment/create`;
86
+ // return await this.httpRequest.post(url, object);
87
+ // }
88
+
89
+ // public async getShipment(object: GetBankAccountShippingInput): Promise<GetBankAccountShippingOutput> {
90
+ // const url: string = `${this.baseUrl}shipment/${object.shippingId}`;
91
+ // return await this.httpRequest.get(url);
92
+ // }
93
+
94
+ // public async replaceCardByExternalId(object: ExternalReplaceCardInput): Promise<ExternalReplaceCardOutput> {
95
+ // const url: string = `${this.baseUrl}cards/${object.externalCardId}/replace`;
96
+ // return await this.httpRequest.put(url, object);
97
+ // }
98
+
99
+
100
+
101
+
102
+ }
@@ -0,0 +1,7 @@
1
+ import {CreateBankAccountRequest, CreateBankAccountUserRequest, CreateBankAccountUserResponse, GetBankAccountUserRequest, GetBankAccountUserResponse, UpdateBankAccountUserRequest, UpdateBankAccountUserResponse} from "@fiado/type-kit/bin/account";
2
+
3
+ export interface ISTPAccountApi {
4
+ // updateUser(object: UpdateBankAccountUserRequest): Promise<any>
5
+ // getUserById(externalUserId: string): Promise<any>
6
+ createAccount(request: CreateBankAccountRequest): Promise<any>;
7
+ }
@@ -0,0 +1,2 @@
1
+ export * from './api/STPAccountApi';
2
+ export * from './api/interfaces/ISTPAccountApi';