@fiado/api-invoker 1.5.21 → 1.5.23

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 (39) hide show
  1. package/bin/account-fiadoinc/queue/TransactionPublisher.d.ts +9 -0
  2. package/bin/account-fiadoinc/queue/TransactionPublisher.js +36 -0
  3. package/bin/account-fiadoinc/queue/interfaces/ITransactionPublisher.d.ts +7 -0
  4. package/bin/account-pagoconfiado/AccountPagoConfiadoApi.d.ts +0 -5
  5. package/bin/account-pagoconfiado/AccountPagoConfiadoApi.js +0 -14
  6. package/bin/account-pagoconfiado/interfaces/IAccountPagoConfiadoApi.d.ts +0 -5
  7. package/bin/activity/ActivityApi.d.ts +17 -0
  8. package/bin/activity/ActivityApi.js +72 -0
  9. package/bin/activity/index.d.ts +2 -0
  10. package/bin/{report-processor-business → activity}/index.js +2 -2
  11. package/bin/activity/interfaces/IActivityApi.d.ts +39 -0
  12. package/bin/authentication/AuthenticationApi.d.ts +1 -2
  13. package/bin/authentication/AuthenticationApi.js +0 -5
  14. package/bin/authentication/interfaces/IAuthenticationApi.d.ts +1 -2
  15. package/bin/event-history-business/EventHistoryApi.js +4 -29
  16. package/bin/index.d.ts +0 -1
  17. package/bin/index.js +0 -1
  18. package/bin/onboarding-business/api/OnboardingBusinessApi.d.ts +0 -1
  19. package/bin/onboarding-business/api/OnboardingBusinessApi.js +0 -4
  20. package/bin/onboarding-business/api/interfaces/IOnboardingBusinessApi.d.ts +0 -1
  21. package/bin/referral-business/PayrollApi.d.ts +9 -0
  22. package/bin/{report-processor-business/api/ReportProcessorBusinessApi.js → referral-business/PayrollApi.js} +13 -7
  23. package/bin/referral-business/ReferralBusinessApi.d.ts +0 -2
  24. package/bin/referral-business/ReferralBusinessApi.js +0 -4
  25. package/bin/referral-business/interfaces/IReferralBusinessApi.d.ts +0 -7
  26. package/package.json +2 -2
  27. package/src/container.config.ts +6 -0
  28. package/src/index.ts +2 -1
  29. package/src/notificationWebsockets/index.ts +2 -0
  30. package/src/notificationWebsockets/queue/NotificationWSMessagePublisher.ts +26 -0
  31. package/src/notificationWebsockets/queue/interfaces/INotificationWSMessagesPublisher.ts +5 -0
  32. package/bin/cognitoConnector/interfaces/ICognitoConnectorApiV2.d.ts +0 -46
  33. package/bin/report-processor-business/api/IReportProcessorBusiness.d.ts +0 -3
  34. package/bin/report-processor-business/api/IReportProcessorBusinessApi.d.ts +0 -6
  35. package/bin/report-processor-business/api/IReportProcessorBusinessApi.js +0 -2
  36. package/bin/report-processor-business/api/ReportProcessorBusinessApi.d.ts +0 -11
  37. package/bin/report-processor-business/index.d.ts +0 -2
  38. /package/bin/{cognitoConnector/interfaces/ICognitoConnectorApiV2.js → account-fiadoinc/queue/interfaces/ITransactionPublisher.js} +0 -0
  39. /package/bin/{report-processor-business/api/IReportProcessorBusiness.js → activity/interfaces/IActivityApi.js} +0 -0
@@ -0,0 +1,9 @@
1
+ import { ITransactionPublisher } from "./interfaces/ITransactionPublisher";
2
+ import { ProviderDocumentUploadRequest } from "@fiado/type-kit/bin/provider";
3
+ export declare class TransactionPublisher implements ITransactionPublisher {
4
+ private readonly FIADO_INC_KYC_MESSAGE_QUEUE;
5
+ publish(message: {
6
+ externalUserId: string;
7
+ input: ProviderDocumentUploadRequest;
8
+ }): Promise<void>;
9
+ }
@@ -0,0 +1,36 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.TransactionPublisher = void 0;
10
+ const client_sqs_1 = require("@aws-sdk/client-sqs");
11
+ const inversify_1 = require("inversify");
12
+ let TransactionPublisher = class TransactionPublisher {
13
+ constructor() {
14
+ this.FIADO_INC_KYC_MESSAGE_QUEUE = process.env.FIADO_INC_KYC_MESSAGE_QUEUE;
15
+ }
16
+ async publish(message) {
17
+ try {
18
+ const client = new client_sqs_1.SQSClient();
19
+ const sendMessageRequest = {
20
+ QueueUrl: this.FIADO_INC_KYC_MESSAGE_QUEUE,
21
+ MessageBody: JSON.stringify(message),
22
+ MessageGroupId: message.externalUserId,
23
+ MessageDeduplicationId: message.externalUserId
24
+ };
25
+ const command = new client_sqs_1.SendMessageCommand(sendMessageRequest);
26
+ await client.send(command);
27
+ }
28
+ catch (error) {
29
+ throw new Error(`Error publishing message to queue ${': ' + error.message}`);
30
+ }
31
+ }
32
+ };
33
+ exports.TransactionPublisher = TransactionPublisher;
34
+ exports.TransactionPublisher = TransactionPublisher = __decorate([
35
+ (0, inversify_1.injectable)()
36
+ ], TransactionPublisher);
@@ -0,0 +1,7 @@
1
+ import { ProviderDocumentUploadRequest } from "@fiado/type-kit/bin/provider";
2
+ export interface ITransactionPublisher {
3
+ publish(params: {
4
+ externalUserId: string;
5
+ input: ProviderDocumentUploadRequest;
6
+ }): Promise<void>;
7
+ }
@@ -14,9 +14,4 @@ export default class AccountPagoConfiadoApi implements IAccountPagoConfiadoApi {
14
14
  update(directoryId: string, data: AccountUpdateRequest): Promise<ApiGatewayResponse<void>>;
15
15
  updateByAccountNumber(accountNumber: string, data: AccountUpdateRequest): Promise<ApiGatewayResponse<void>>;
16
16
  getAccountByAccountNumber(accountNumber: string): Promise<ApiGatewayResponse<void>>;
17
- getAccountListByDateMinorOrEqual(params: {
18
- index?: string | null;
19
- pageSize?: string;
20
- date?: string;
21
- }): Promise<ApiGatewayResponse<any>>;
22
17
  }
@@ -46,20 +46,6 @@ let AccountPagoConfiadoApi = class AccountPagoConfiadoApi {
46
46
  const url = `${this.baseUrl}users/accountNumber/${accountNumber}`;
47
47
  return await this.httpRequest.get(url);
48
48
  }
49
- async getAccountListByDateMinorOrEqual(params) {
50
- let queryParams = [];
51
- if (params.index) {
52
- queryParams.push(`index=${params.index}`);
53
- }
54
- if (params.pageSize) {
55
- queryParams.push(`pageSize=${params.pageSize}`);
56
- }
57
- if (params.date) {
58
- queryParams.push(`date=${params.date}`);
59
- }
60
- const url = `${this.baseUrl}?${queryParams.join('&')}`;
61
- return await this.httpRequest.get(url);
62
- }
63
49
  };
64
50
  AccountPagoConfiadoApi = __decorate([
65
51
  (0, inversify_1.injectable)(),
@@ -9,9 +9,4 @@ export interface IAccountPagoConfiadoApi {
9
9
  updateByAccountNumber(accountNumber: string, data: AccountUpdateRequest): Promise<ApiGatewayResponse<void>>;
10
10
  getAccountByAccountNumber(accountNumber: string): Promise<ApiGatewayResponse<void>>;
11
11
  cancelAccount(directoryId: string, accountNumber?: string, documentNumber?: string): Promise<ApiGatewayResponse<void>>;
12
- getAccountListByDateMinorOrEqual(params: {
13
- index?: string | null;
14
- pageSize?: string;
15
- date?: string;
16
- }): Promise<ApiGatewayResponse<any>>;
17
12
  }
@@ -0,0 +1,17 @@
1
+ import { IHttpRequest } from "@fiado/http-client";
2
+ import { IActivityApi } from './interfaces/IActivityApi';
3
+ import { TypeOfDirectoryId } from '@fiado/type-kit/bin/directory';
4
+ export declare class ActivityApi implements IActivityApi {
5
+ private httpRequest;
6
+ private readonly baseUrl;
7
+ constructor(httpRequest: IHttpRequest);
8
+ getActivities(typeOfActivities: string[]): Promise<any>;
9
+ getActivitiesByDirectoryIdAndTypeOfActivity(directoryId: string, typeOfActivities: string[]): Promise<any>;
10
+ postActivity(params: {
11
+ directoryId: string;
12
+ typeOfDirectoryId: TypeOfDirectoryId;
13
+ typeOfActivity: string;
14
+ amount: string;
15
+ date: string;
16
+ }): Promise<any>;
17
+ }
@@ -0,0 +1,72 @@
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
15
+ return (mod && mod.__esModule) ? mod : { "default": mod };
16
+ };
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.ActivityApi = void 0;
19
+ const dotenv_1 = __importDefault(require("dotenv"));
20
+ const inversify_1 = require("inversify");
21
+ dotenv_1.default.config();
22
+ let ActivityApi = class ActivityApi {
23
+ constructor(httpRequest) {
24
+ this.httpRequest = httpRequest;
25
+ this.baseUrl = process.env.ACTIVITY_LAMBDA_URL || "";
26
+ }
27
+ async getActivities(typeOfActivities) {
28
+ let url = `${this.baseUrl}activities`;
29
+ if (typeOfActivities.length > 0) {
30
+ url = `${this.baseUrl}activities?${typeOfActivities.map(id => `typeOfActivities=${encodeURIComponent(id)}`).join('&')}`;
31
+ }
32
+ const operationName = "getActivities";
33
+ return await this.httpRequest.post(`${url}`, null, { 'operationName': operationName });
34
+ }
35
+ async getActivitiesByDirectoryIdAndTypeOfActivity(directoryId, typeOfActivities) {
36
+ if (directoryId == null || directoryId == undefined || directoryId == "") {
37
+ throw new Error("At least directory ID is required.");
38
+ }
39
+ let url = `${this.baseUrl}activities/directory/${directoryId}`;
40
+ if (typeOfActivities.length > 0) {
41
+ url = `${this.baseUrl}activities/directory/${directoryId}?${typeOfActivities.map(id => `typeOfActivities=${encodeURIComponent(id)}`).join('&')}`;
42
+ }
43
+ const operationName = "getActivitiesByDirectoryIdAndTypeOfActivity";
44
+ return await this.httpRequest.post(`${url}`, null, { 'operationName': operationName });
45
+ }
46
+ async postActivity(params) {
47
+ if (params.directoryId == null || params.directoryId == undefined || params.directoryId == "") {
48
+ throw new Error("At least directory ID is required.");
49
+ }
50
+ if (params.typeOfDirectoryId == null || params.typeOfDirectoryId == undefined) {
51
+ throw new Error("At least typeOfDirectoryId is required.");
52
+ }
53
+ if (params.typeOfActivity == null || params.typeOfActivity == undefined || params.typeOfActivity == "") {
54
+ throw new Error("At least typeOfActivity is required.");
55
+ }
56
+ if (params.amount == null || params.amount == undefined || params.amount == "") {
57
+ throw new Error("At least amount is required.");
58
+ }
59
+ if (params.date == null || params.date == undefined || params.date == "") {
60
+ throw new Error("At least date is required.");
61
+ }
62
+ const url = `${this.baseUrl}/activities/create`;
63
+ const operationName = "postActivity";
64
+ return await this.httpRequest.post(`${url}`, params, { 'operationName': operationName });
65
+ }
66
+ };
67
+ exports.ActivityApi = ActivityApi;
68
+ exports.ActivityApi = ActivityApi = __decorate([
69
+ (0, inversify_1.injectable)(),
70
+ __param(0, (0, inversify_1.inject)("IHttpRequest")),
71
+ __metadata("design:paramtypes", [Object])
72
+ ], ActivityApi);
@@ -0,0 +1,2 @@
1
+ export * from './interfaces/IActivityApi';
2
+ export * from './ActivityApi';
@@ -14,5 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./api/ReportProcessorBusinessApi"), exports);
18
- __exportStar(require("./api/IReportProcessorBusinessApi"), exports);
17
+ __exportStar(require("./interfaces/IActivityApi"), exports);
18
+ __exportStar(require("./ActivityApi"), exports);
@@ -0,0 +1,39 @@
1
+ import { TypeOfDirectoryId } from "@fiado/type-kit/bin/directory";
2
+ /**
3
+ * Interfaz para el servicio Directory que permite operaciones sobre directorios.
4
+ */
5
+ export interface IActivityApi {
6
+ /**
7
+ * Obtiene una lista de entidades de la tabla ActivityDirectory.
8
+ * @param directoryId Directorio que se va a consultar.
9
+ * @param typeOfActivities Array de tipos de actividades (Opcional).
10
+ * @returns Retorna un arreglo de objetos de ActivityDirectory.
11
+ * @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
12
+ */
13
+ getActivitiesByDirectoryIdAndTypeOfActivity(directoryId: string, typeOfActivities: string[]): Promise<any>;
14
+ /**
15
+ * Obtener actividades globales.
16
+ * @param typeOfActivity Tipo de actividad
17
+ * Puede devolver un arreglo vacío si no se encuentran coincidencias.
18
+ * @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
19
+ */
20
+ getActivities(typeOfActivities: string[]): Promise<any>;
21
+ /**
22
+ * Proceso para agregar a las actividades.
23
+ * @param directoryId Directorio
24
+ * @param typeOfDirectoryId Tipo de directorio
25
+ * @param typeOfActivity Tipo de actividad
26
+ * @param amount Monto de la actividad
27
+ * @param date Fecha de la actividad
28
+ * @returns Retorna un objeto de ActivityDirectory.
29
+ * Puede devolver un arreglo vacío si no se encuentran coincidencias.
30
+ * @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
31
+ */
32
+ postActivity(params: {
33
+ directoryId: string;
34
+ typeOfDirectoryId: TypeOfDirectoryId;
35
+ typeOfActivity: string;
36
+ amount: string;
37
+ date: string;
38
+ }): Promise<any>;
39
+ }
@@ -1,10 +1,9 @@
1
1
  import { IHttpRequest } from "@fiado/http-client";
2
- import { SignUpAdditionalRequest, SignUpUserBackofficeRequest } from "@fiado/type-kit/bin/authentication";
2
+ import { SignUpAdditionalRequest } from "@fiado/type-kit/bin/authentication";
3
3
  import { IAuthenticationApi } from "./interfaces/IAuthenticationApi";
4
4
  export declare class AuthenticationApi implements IAuthenticationApi {
5
5
  private httpRequest;
6
6
  constructor(httpRequest: IHttpRequest);
7
7
  signUpAdditionalCard(createAdditionalCard: SignUpAdditionalRequest): Promise<any>;
8
8
  deleteAuthSessionByDirectoryId(directoryId: string): Promise<any>;
9
- signUpBackofficeBulk(input: SignUpUserBackofficeRequest[]): Promise<any>;
10
9
  }
@@ -28,11 +28,6 @@ let AuthenticationApi = class AuthenticationApi {
28
28
  const operation = "deleteAuthSessionByDirectoryId";
29
29
  return await this.httpRequest.post(url, { directoryId }, { 'operationName': operation });
30
30
  }
31
- async signUpBackofficeBulk(input) {
32
- const url = `${process.env.AUTH_LAMBDA_URL}`;
33
- const operation = "postSignUpBackofficeBulk";
34
- return await this.httpRequest.post(url, input, { 'operationName': operation });
35
- }
36
31
  };
37
32
  exports.AuthenticationApi = AuthenticationApi;
38
33
  exports.AuthenticationApi = AuthenticationApi = __decorate([
@@ -1,6 +1,5 @@
1
- import { DirectoryBatchSummaryResponse, SignUpAdditionalRequest, SignUpUserBackofficeRequest } from "@fiado/type-kit/bin/authentication";
1
+ import { SignUpAdditionalRequest } from "@fiado/type-kit/bin/authentication";
2
2
  export interface IAuthenticationApi {
3
3
  signUpAdditionalCard(createAdditionalCard: SignUpAdditionalRequest): Promise<any>;
4
4
  deleteAuthSessionByDirectoryId(directoryId: string): Promise<any>;
5
- signUpBackofficeBulk(input: SignUpUserBackofficeRequest[]): Promise<DirectoryBatchSummaryResponse>;
6
5
  }
@@ -35,21 +35,9 @@ let EventHistoryApi = class EventHistoryApi {
35
35
  * @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
36
36
  */
37
37
  async findDirectoryUserEventsByDirectoryId(directoryId, periodDate, index, pageSize) {
38
- const queryParams = [];
39
- if (directoryId) {
40
- queryParams.push(`directoryId=${directoryId}`);
41
- }
42
- if (periodDate) {
43
- queryParams.push(`periodDate=${periodDate}`);
44
- }
45
- if (pageSize) {
46
- queryParams.push(`pageSize=${pageSize}`);
47
- }
48
- if (index) {
49
- queryParams.push(`index=${index}`);
50
- }
51
- const url = `${this.baseUrl}directoryuser/events/search?${queryParams.join('&')}`;
52
- return await this.httpRequest.get(`${url}`);
38
+ const url = `${this.baseUrl}directoryuser/events/search?directoryId=${directoryId}&periodDate=${periodDate}&index=${index}&pageSize=${pageSize}`;
39
+ const operationName = "findDirectoryUserEventsByDirectoryId";
40
+ return await this.httpRequest.get(`${url}`, null, { 'operationName': operationName });
53
41
  }
54
42
  /**
55
43
  * Crea un evento de cambio asociado a un Directorio o Usuario.
@@ -72,20 +60,7 @@ let EventHistoryApi = class EventHistoryApi {
72
60
  * @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
73
61
  */
74
62
  async findAccountEventsByDirectoryId(directoryId, periodDate, index, pageSize) {
75
- const queryParams = [];
76
- if (directoryId) {
77
- queryParams.push(`directoryId=${directoryId}`);
78
- }
79
- if (periodDate) {
80
- queryParams.push(`periodDate=${periodDate}`);
81
- }
82
- if (pageSize) {
83
- queryParams.push(`pageSize=${pageSize}`);
84
- }
85
- if (index) {
86
- queryParams.push(`index=${index}`);
87
- }
88
- const url = `${this.baseUrl}accounts/events/search?${queryParams.join('&')}`;
63
+ const url = `${this.baseUrl}accounts/events/search?directoryId=${directoryId}&periodDate=${periodDate}&index=${index}&pageSize=${pageSize}`;
89
64
  return await this.httpRequest.get(`${url}`);
90
65
  }
91
66
  /**
package/bin/index.d.ts CHANGED
@@ -53,4 +53,3 @@ export * from "./onboarding-business";
53
53
  export * from "./payroll-business";
54
54
  export * from "./referral-business";
55
55
  export * from "./event-history-business";
56
- export * from "./report-processor-business";
package/bin/index.js CHANGED
@@ -69,4 +69,3 @@ __exportStar(require("./onboarding-business"), exports);
69
69
  __exportStar(require("./payroll-business"), exports);
70
70
  __exportStar(require("./referral-business"), exports);
71
71
  __exportStar(require("./event-history-business"), exports);
72
- __exportStar(require("./report-processor-business"), exports);
@@ -24,5 +24,4 @@ export default class OnboardingBusinessApi implements IOnboardingBusinessApi {
24
24
  index?: string;
25
25
  pageSize?: string;
26
26
  }): Promise<any>;
27
- getBatchByIds(ids: string[]): Promise<any>;
28
27
  }
@@ -90,10 +90,6 @@ let OnboardingBusinessApi = class OnboardingBusinessApi {
90
90
  const url = `${this.baseUrl}private/getList`;
91
91
  return await this.httpRequest.get(`${url}`);
92
92
  }
93
- async getBatchByIds(ids) {
94
- const url = `${this.baseUrl}private/getBatchByIds`;
95
- return await this.httpRequest.get(`${url}`, { ids });
96
- }
97
93
  };
98
94
  OnboardingBusinessApi = __decorate([
99
95
  (0, inversify_1.injectable)(),
@@ -19,5 +19,4 @@ export interface IOnboardingBusinessApi {
19
19
  index?: string;
20
20
  pageSize?: string;
21
21
  }): Promise<any>;
22
- getBatchByIds(ids: string[]): Promise<any>;
23
22
  }
@@ -0,0 +1,9 @@
1
+ import { IHttpRequest } from "@fiado/http-client";
2
+ import { IReferralBusinessApi } from "./interfaces/IReferralBusinessApi";
3
+ import FiadoApiResponse from "@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse";
4
+ export declare class ReferralBusinessApi implements IReferralBusinessApi {
5
+ private httpRequest;
6
+ private readonly baseUrl;
7
+ constructor(httpRequest: IHttpRequest);
8
+ getByDirectoryId(directoryId: string): Promise<FiadoApiResponse<any>>;
9
+ }
@@ -11,21 +11,27 @@ 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 });
18
+ exports.ReferralBusinessApi = void 0;
15
19
  const inversify_1 = require("inversify");
16
- let ReportProcessorBusinessApi = class ReportProcessorBusinessApi {
20
+ const dotenv_1 = __importDefault(require("dotenv"));
21
+ dotenv_1.default.config();
22
+ let ReferralBusinessApi = class ReferralBusinessApi {
17
23
  constructor(httpRequest) {
18
24
  this.httpRequest = httpRequest;
19
- this.baseUrl = process.env.REPORT_PROCESSOR_LAMBDA_URL || "";
25
+ this.baseUrl = process.env.PAYROLL_BUSINESS_LAMBDA_URL || "";
20
26
  }
21
- async processReports(key) {
22
- const url = `${this.baseUrl}/report-link?key=${key}`;
27
+ async getByDirectoryId(directoryId) {
28
+ const url = `${this.baseUrl}private/agents/directoryId/${directoryId}`;
23
29
  return await this.httpRequest.get(url);
24
30
  }
25
31
  };
26
- ReportProcessorBusinessApi = __decorate([
32
+ exports.ReferralBusinessApi = ReferralBusinessApi;
33
+ exports.ReferralBusinessApi = ReferralBusinessApi = __decorate([
27
34
  (0, inversify_1.injectable)(),
28
35
  __param(0, (0, inversify_1.inject)("IHttpRequest")),
29
36
  __metadata("design:paramtypes", [Object])
30
- ], ReportProcessorBusinessApi);
31
- exports.default = ReportProcessorBusinessApi;
37
+ ], ReferralBusinessApi);
@@ -1,7 +1,6 @@
1
1
  import { IHttpRequest } from "@fiado/http-client";
2
2
  import { IReferralBusinessApi } from "./interfaces/IReferralBusinessApi";
3
3
  import FiadoApiResponse from "@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse";
4
- import { Scope } from "@fiado/type-kit/bin/directory/enums/Scope";
5
4
  export declare class ReferralBusinessApi implements IReferralBusinessApi {
6
5
  private httpRequest;
7
6
  private readonly baseUrl;
@@ -14,5 +13,4 @@ export declare class ReferralBusinessApi implements IReferralBusinessApi {
14
13
  groupId?: string;
15
14
  }): Promise<FiadoApiResponse<any>>;
16
15
  getByDirectoryId(directoryId: string): Promise<FiadoApiResponse<any>>;
17
- accountOpeningsBySponsor(newDirectoryId: string, scope: Scope): Promise<FiadoApiResponse<any>>;
18
16
  }
@@ -32,10 +32,6 @@ let ReferralBusinessApi = class ReferralBusinessApi {
32
32
  const url = `${this.baseUrl}private/agents/directoryId/${directoryId}`;
33
33
  return await this.httpRequest.get(url);
34
34
  }
35
- async accountOpeningsBySponsor(newDirectoryId, scope) {
36
- const url = `${this.baseUrl}private/account-openings-by-sponsor/${newDirectoryId}`;
37
- return await this.httpRequest.post(url, { directoryId: newDirectoryId, scope });
38
- }
39
35
  };
40
36
  exports.ReferralBusinessApi = ReferralBusinessApi;
41
37
  exports.ReferralBusinessApi = ReferralBusinessApi = __decorate([
@@ -1,5 +1,4 @@
1
1
  import FiadoApiResponse from "@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse";
2
- import { Scope } from "@fiado/type-kit/bin/directory/enums/Scope";
3
2
  /**
4
3
  * Interfaz para el servicio Payroll que permite operaciones sobre payroll.
5
4
  */
@@ -22,10 +21,4 @@ export interface IReferralBusinessApi {
22
21
  category?: string;
23
22
  groupId?: string;
24
23
  }): Promise<FiadoApiResponse<any>>;
25
- /**
26
- * Registra aperturas de cuenta por patrocinador.
27
- * @param newDirectoryId ID del nuevo directorio.
28
- * @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
29
- */
30
- accountOpeningsBySponsor(newDirectoryId: string, scope: Scope): Promise<FiadoApiResponse<void>>;
31
24
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiado/api-invoker",
3
- "version": "1.5.21",
3
+ "version": "1.5.23",
4
4
  "description": "Sirve como un puente entre diferentes funciones lambda, facilitando la comunicación entre ellas a través de invocaciones http",
5
5
  "main": "bin/index.js",
6
6
  "types": "bin/index.d.ts",
@@ -16,7 +16,7 @@
16
16
  "@fiado/gateway-adapter": "^1.1.50",
17
17
  "@fiado/http-client": "^1.0.7",
18
18
  "@fiado/logger": "^1.0.3",
19
- "@fiado/type-kit": "^2.0.76",
19
+ "@fiado/type-kit": "^2.1.16",
20
20
  "dotenv": "^16.4.7",
21
21
  "inversify": "^6.2.2",
22
22
  "reflect-metadata": "^0.2.2"
@@ -84,6 +84,10 @@ import { IOnboardingBusinessApi } from "./onboarding-business";
84
84
  import { IPayrollApi, PayrollApi } from "./payroll-business";
85
85
  import { IReferralBusinessApi, ReferralBusinessApi } from "./referral-business";
86
86
  import { EventHistoryApi, IEventHistoryApi } from "./event-history-business";
87
+ import ReportProcessorBusinessApi from "./report-processor-business/api/ReportProcessorBusinessApi";
88
+ import { IReportProcessorBusinessApi } from "./report-processor-business";
89
+ import { INotificationWSMessagesPublisher } from "./notificationWebsockets";
90
+ import NotificationWSMessagePublisher from "./notificationWebsockets/queue/NotificationWSMessagePublisher";
87
91
 
88
92
  export const apiInvokerBindings = new ContainerModule((bind: interfaces.Bind) => {
89
93
  // UTILS bindings
@@ -101,6 +105,7 @@ export const apiInvokerBindings = new ContainerModule((bind: interfaces.Bind) =>
101
105
  bind<IAccountPagoConfiadoApi>("IAccountPagoConfiadoApi").to(AccountPagoConfiadoApi);
102
106
  bind<IAccountFiadoSAApi>("IAccountFiadoSAApi").to(AccountFiadoSAApi);
103
107
  bind<INotificationMessagesPublisher>("INotificationMessagesPublisher").to(NotificationMessagePublisher);
108
+ bind<INotificationWSMessagesPublisher>("INotificationWSMessagesPublisher").to(NotificationWSMessagePublisher);
104
109
  bind<ISessionActivityPublisher>("ISessionActivityPublisher").to(SessionActivityPublisher);
105
110
  bind<ITransactionPublisher>("ITransactionPublisher").to(TransactionPublisher);
106
111
  bind<ITransactionApi>("ITransactionApi").to(TransactionApi);
@@ -150,4 +155,5 @@ export const apiInvokerBindings = new ContainerModule((bind: interfaces.Bind) =>
150
155
  bind<IPayrollApi>("IPayrollApi").to(PayrollApi);
151
156
  bind<IReferralBusinessApi>("IReferralBusinessApi").to(ReferralBusinessApi);
152
157
  bind<IEventHistoryApi>("IEventHistoryApi").to(EventHistoryApi);
158
+ bind<IReportProcessorBusinessApi>("IReportProcessorBusinessApi").to(ReportProcessorBusinessApi);
153
159
  });
package/src/index.ts CHANGED
@@ -53,4 +53,5 @@ export * from "./onboarding-business";
53
53
  export * from "./payroll-business";
54
54
  export * from "./referral-business";
55
55
  export * from "./event-history-business";
56
- export * from "./report-processor-business";
56
+ export * from "./report-processor-business";
57
+ export * from "./notificationWebsockets";
@@ -0,0 +1,2 @@
1
+ export * from './queue/NotificationWSMessagePublisher';
2
+ export * from './queue/interfaces/INotificationWSMessagesPublisher';
@@ -0,0 +1,26 @@
1
+ import {INotificationWSMessagesPublisher} from "./interfaces/INotificationWSMessagesPublisher";
2
+ import {NotificationWSQueueMessageRequest} from "@fiado/type-kit/bin/notificationWS";
3
+ import {SendMessageCommand, SendMessageRequest, SQSClient} from "@aws-sdk/client-sqs";
4
+ import {injectable} from "inversify";
5
+
6
+
7
+ @injectable()
8
+ export default class NotificationWSMessagePublisher implements INotificationWSMessagesPublisher {
9
+
10
+ constructor() {}
11
+
12
+ private readonly NOTIFICATION_WS_MESSAGES_QUEUE = process.env.NOTIFICATION_WS_MESSAGES_QUEUE
13
+
14
+ async publish(message: NotificationWSQueueMessageRequest<any>): Promise<void> {
15
+ try {
16
+ const client: SQSClient = new SQSClient();
17
+ const sendMessageRequest: SendMessageRequest = {
18
+ QueueUrl: this.NOTIFICATION_WS_MESSAGES_QUEUE,
19
+ MessageBody: JSON.stringify(message)
20
+ };
21
+ const command: SendMessageCommand = new SendMessageCommand(sendMessageRequest);
22
+ await client.send(command);
23
+ } catch (error) {
24
+ throw new Error(`Error publishing message to queue ${': ' + error.message}`);
25
+ }
26
+ }}
@@ -0,0 +1,5 @@
1
+ import { NotificationWSQueueMessageRequest } from "@fiado/type-kit/bin/notificationWS";
2
+
3
+ export interface INotificationWSMessagesPublisher {
4
+ publish(message: NotificationWSQueueMessageRequest<any>): Promise<void>;
5
+ }
@@ -1,46 +0,0 @@
1
- import { ChangePasswordRequest, GetUserRequest, GetUserResponse, RefreshTokenRequest, RefreshTokenResponse, RespondToAuthChallengeRequest, SetPasswordRequest, SignInRequest, SignInResponse, SignUpConfirmRequest, SignUpRequest, SignUpResponse } from "@fiado/type-kit/bin/cognitoConnector";
2
- export interface ICognitoApi {
3
- /**
4
- * Healthcheck for the cognito-connector
5
- */
6
- healthcheck(): Promise<HealthcheckResponse>;
7
- /**
8
- * Create a new user in Cognito
9
- */
10
- signUp(request: SignUpRequest): Promise<SignUpResponse>;
11
- /**
12
- * Confirm sign-up for a user in Cognito
13
- */
14
- signUpConfirm(request: SignUpConfirmRequest): Promise<void>;
15
- /**
16
- * Sign in a user
17
- */
18
- signIn(request: SignInRequest): Promise<SignInResponse>;
19
- /**
20
- * Sign out a user
21
- */
22
- signOut(): Promise<void>;
23
- /**
24
- * Change a user's password
25
- */
26
- changePassword(request: ChangePasswordRequest): Promise<void>;
27
- /**
28
- * Retrieve user details
29
- */
30
- getUser(request: GetUserRequest): Promise<GetUserResponse>;
31
- /**
32
- * Refresh a user's tokens
33
- */
34
- refreshToken(request: RefreshTokenRequest): Promise<RefreshTokenResponse>;
35
- /**
36
- * Respond to an auth challenge
37
- */
38
- respondToAuthChallenge(request: RespondToAuthChallengeRequest): Promise<any>;
39
- /**
40
- * Reset a user's password
41
- */
42
- resetPassword(request: SetPasswordRequest): Promise<void>;
43
- }
44
- export interface HealthcheckResponse {
45
- status: string;
46
- }
@@ -1,3 +0,0 @@
1
- export interface IReportProcessorBusiness {
2
- processReports(key: string): Promise<void>;
3
- }
@@ -1,6 +0,0 @@
1
- export interface IReportProcessorBusinessApi {
2
- processReports(key: string): Promise<{
3
- url: string;
4
- expiresInSeconds: number;
5
- }>;
6
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,11 +0,0 @@
1
- import { IHttpRequest } from "@fiado/http-client";
2
- import { IReportProcessorBusinessApi } from "./IReportProcessorBusinessApi";
3
- export default class ReportProcessorBusinessApi implements IReportProcessorBusinessApi {
4
- private httpRequest;
5
- private readonly baseUrl;
6
- constructor(httpRequest: IHttpRequest);
7
- processReports(key: string): Promise<{
8
- url: string;
9
- expiresInSeconds: number;
10
- }>;
11
- }
@@ -1,2 +0,0 @@
1
- export * from './api/ReportProcessorBusinessApi';
2
- export * from './api/IReportProcessorBusinessApi';