@fiado/api-invoker 1.5.24 → 1.5.27
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.
- package/bin/container.config.js +2 -0
- package/bin/index.d.ts +1 -0
- package/bin/index.js +1 -0
- package/bin/notificationWebsockets/queue/NotificationWSMessagePublisher.js +7 -1
- package/bin/people-business/api/PeopleBusinessApi.d.ts +21 -0
- package/bin/people-business/api/PeopleBusinessApi.js +41 -0
- package/bin/people-business/api/interfaces/IPeopleBusinessApi.d.ts +16 -0
- package/bin/people-business/api/interfaces/IPeopleBusinessApi.js +2 -0
- package/bin/people-business/index.d.ts +2 -0
- package/bin/people-business/index.js +18 -0
- package/package.json +2 -2
- package/src/container.config.ts +4 -0
- package/src/index.ts +2 -1
- package/src/notificationWebsockets/queue/NotificationWSMessagePublisher.ts +4 -1
- package/src/people-business/api/PeopleBusinessApi.ts +32 -0
- package/src/people-business/api/interfaces/IPeopleBusinessApi.ts +8 -0
- package/src/people-business/index.ts +2 -0
package/bin/container.config.js
CHANGED
|
@@ -68,6 +68,7 @@ const referral_business_1 = require("./referral-business");
|
|
|
68
68
|
const event_history_business_1 = require("./event-history-business");
|
|
69
69
|
const ReportProcessorBusinessApi_1 = __importDefault(require("./report-processor-business/api/ReportProcessorBusinessApi"));
|
|
70
70
|
const NotificationWSMessagePublisher_1 = __importDefault(require("./notificationWebsockets/queue/NotificationWSMessagePublisher"));
|
|
71
|
+
const PeopleBusinessApi_1 = __importDefault(require("./people-business/api/PeopleBusinessApi"));
|
|
71
72
|
exports.apiInvokerBindings = new inversify_1.ContainerModule((bind) => {
|
|
72
73
|
// UTILS bindings
|
|
73
74
|
bind("InvokerUtils").to(InvokerUtils_1.InvokerUtils);
|
|
@@ -134,4 +135,5 @@ exports.apiInvokerBindings = new inversify_1.ContainerModule((bind) => {
|
|
|
134
135
|
bind("IReferralBusinessApi").to(referral_business_1.ReferralBusinessApi);
|
|
135
136
|
bind("IEventHistoryApi").to(event_history_business_1.EventHistoryApi);
|
|
136
137
|
bind("IReportProcessorBusinessApi").to(ReportProcessorBusinessApi_1.default);
|
|
138
|
+
bind("IPeopleBusinessApi").to(PeopleBusinessApi_1.default);
|
|
137
139
|
});
|
package/bin/index.d.ts
CHANGED
package/bin/index.js
CHANGED
|
@@ -71,3 +71,4 @@ __exportStar(require("./referral-business"), exports);
|
|
|
71
71
|
__exportStar(require("./event-history-business"), exports);
|
|
72
72
|
__exportStar(require("./report-processor-business"), exports);
|
|
73
73
|
__exportStar(require("./notificationWebsockets"), exports);
|
|
74
|
+
__exportStar(require("./people-business"), exports);
|
|
@@ -8,9 +8,13 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
11
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
15
|
const client_sqs_1 = require("@aws-sdk/client-sqs");
|
|
13
16
|
const inversify_1 = require("inversify");
|
|
17
|
+
const crypto_1 = __importDefault(require("crypto"));
|
|
14
18
|
let NotificationWSMessagePublisher = class NotificationWSMessagePublisher {
|
|
15
19
|
constructor() {
|
|
16
20
|
this.NOTIFICATION_WS_MESSAGES_QUEUE = process.env.NOTIFICATION_WS_MESSAGES_QUEUE;
|
|
@@ -20,7 +24,9 @@ let NotificationWSMessagePublisher = class NotificationWSMessagePublisher {
|
|
|
20
24
|
const client = new client_sqs_1.SQSClient();
|
|
21
25
|
const sendMessageRequest = {
|
|
22
26
|
QueueUrl: this.NOTIFICATION_WS_MESSAGES_QUEUE,
|
|
23
|
-
MessageBody: JSON.stringify(message)
|
|
27
|
+
MessageBody: JSON.stringify(message),
|
|
28
|
+
MessageGroupId: "NotificationWSGroup",
|
|
29
|
+
MessageDeduplicationId: crypto_1.default.randomUUID()
|
|
24
30
|
};
|
|
25
31
|
const command = new client_sqs_1.SendMessageCommand(sendMessageRequest);
|
|
26
32
|
await client.send(command);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { IHttpRequest } from "@fiado/http-client";
|
|
2
|
+
import { IPeopleBusinessApi } from "./interfaces/IPeopleBusinessApi";
|
|
3
|
+
import FiadoApiResponse from "@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse";
|
|
4
|
+
import { CPStatusEnum } from "@fiado/type-kit/bin/identity";
|
|
5
|
+
export default class PeopleBusinessApi implements IPeopleBusinessApi {
|
|
6
|
+
private httpRequest;
|
|
7
|
+
private readonly baseUrl;
|
|
8
|
+
constructor(httpRequest: IHttpRequest);
|
|
9
|
+
getByCPStatus(params: {
|
|
10
|
+
index?: string;
|
|
11
|
+
pageSize?: number;
|
|
12
|
+
cpStatus: CPStatusEnum;
|
|
13
|
+
sort?: "ascending" | "descending";
|
|
14
|
+
}): Promise<FiadoApiResponse<{
|
|
15
|
+
items: {
|
|
16
|
+
people: any;
|
|
17
|
+
accountRequirementControl: any;
|
|
18
|
+
}[];
|
|
19
|
+
index: string | null;
|
|
20
|
+
}>>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
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 PeopleBusinessApi = class PeopleBusinessApi {
|
|
17
|
+
constructor(httpRequest) {
|
|
18
|
+
this.httpRequest = httpRequest;
|
|
19
|
+
this.baseUrl = process.env.PEOPLE_BUSINESS_LAMBDA_URL || "";
|
|
20
|
+
}
|
|
21
|
+
getByCPStatus(params) {
|
|
22
|
+
const queryParamsArray = [];
|
|
23
|
+
if (params.index) {
|
|
24
|
+
queryParamsArray.push(`index=${params.index}`);
|
|
25
|
+
}
|
|
26
|
+
if (params.pageSize) {
|
|
27
|
+
queryParamsArray.push(`pageSize=${params.pageSize}`);
|
|
28
|
+
}
|
|
29
|
+
if (params.sort) {
|
|
30
|
+
queryParamsArray.push(`sort=${params.sort}`);
|
|
31
|
+
}
|
|
32
|
+
const queryString = queryParamsArray.length > 0 ? '?' + queryParamsArray.join('&') : '';
|
|
33
|
+
return this.httpRequest.get(`${this.baseUrl}private/people/get/cpstatus/${params.cpStatus}${queryString}`);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
PeopleBusinessApi = __decorate([
|
|
37
|
+
(0, inversify_1.injectable)(),
|
|
38
|
+
__param(0, (0, inversify_1.inject)("IHttpRequest")),
|
|
39
|
+
__metadata("design:paramtypes", [Object])
|
|
40
|
+
], PeopleBusinessApi);
|
|
41
|
+
exports.default = PeopleBusinessApi;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { CPStatusEnum } from "@fiado/type-kit/bin/identity";
|
|
2
|
+
import FiadoApiResponse from "@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse";
|
|
3
|
+
export interface IPeopleBusinessApi {
|
|
4
|
+
getByCPStatus(params: {
|
|
5
|
+
index: string;
|
|
6
|
+
pageSize: number;
|
|
7
|
+
cpStatus: CPStatusEnum;
|
|
8
|
+
sort: "ascending" | "descending";
|
|
9
|
+
}): Promise<FiadoApiResponse<{
|
|
10
|
+
items: {
|
|
11
|
+
people: any;
|
|
12
|
+
accountRequirementControl: any;
|
|
13
|
+
}[];
|
|
14
|
+
index: string | null;
|
|
15
|
+
}>>;
|
|
16
|
+
}
|
|
@@ -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/PeopleBusinessApi"), exports);
|
|
18
|
+
__exportStar(require("./api/interfaces/IPeopleBusinessApi"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fiado/api-invoker",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.27",
|
|
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.1.
|
|
19
|
+
"@fiado/type-kit": "^2.1.18",
|
|
20
20
|
"dotenv": "^16.4.7",
|
|
21
21
|
"inversify": "^6.2.2",
|
|
22
22
|
"reflect-metadata": "^0.2.2"
|
package/src/container.config.ts
CHANGED
|
@@ -88,6 +88,8 @@ import ReportProcessorBusinessApi from "./report-processor-business/api/ReportPr
|
|
|
88
88
|
import { IReportProcessorBusinessApi } from "./report-processor-business";
|
|
89
89
|
import { INotificationWSMessagesPublisher } from "./notificationWebsockets";
|
|
90
90
|
import NotificationWSMessagePublisher from "./notificationWebsockets/queue/NotificationWSMessagePublisher";
|
|
91
|
+
import PeopleBusinessApi from "./people-business/api/PeopleBusinessApi";
|
|
92
|
+
import { IPeopleBusinessApi } from "./people-business";
|
|
91
93
|
|
|
92
94
|
export const apiInvokerBindings = new ContainerModule((bind: interfaces.Bind) => {
|
|
93
95
|
// UTILS bindings
|
|
@@ -156,4 +158,6 @@ export const apiInvokerBindings = new ContainerModule((bind: interfaces.Bind) =>
|
|
|
156
158
|
bind<IReferralBusinessApi>("IReferralBusinessApi").to(ReferralBusinessApi);
|
|
157
159
|
bind<IEventHistoryApi>("IEventHistoryApi").to(EventHistoryApi);
|
|
158
160
|
bind<IReportProcessorBusinessApi>("IReportProcessorBusinessApi").to(ReportProcessorBusinessApi);
|
|
161
|
+
bind<IPeopleBusinessApi>("IPeopleBusinessApi").to(PeopleBusinessApi);
|
|
162
|
+
|
|
159
163
|
});
|
package/src/index.ts
CHANGED
|
@@ -54,4 +54,5 @@ export * from "./payroll-business";
|
|
|
54
54
|
export * from "./referral-business";
|
|
55
55
|
export * from "./event-history-business";
|
|
56
56
|
export * from "./report-processor-business";
|
|
57
|
-
export * from "./notificationWebsockets";
|
|
57
|
+
export * from "./notificationWebsockets";
|
|
58
|
+
export * from "./people-business";
|
|
@@ -2,6 +2,7 @@ import {INotificationWSMessagesPublisher} from "./interfaces/INotificationWSMess
|
|
|
2
2
|
import {NotificationWSQueueMessageRequest} from "@fiado/type-kit/bin/notificationWS";
|
|
3
3
|
import {SendMessageCommand, SendMessageRequest, SQSClient} from "@aws-sdk/client-sqs";
|
|
4
4
|
import {injectable} from "inversify";
|
|
5
|
+
import crypto from "crypto";
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
@injectable()
|
|
@@ -16,7 +17,9 @@ export default class NotificationWSMessagePublisher implements INotificationWSMe
|
|
|
16
17
|
const client: SQSClient = new SQSClient();
|
|
17
18
|
const sendMessageRequest: SendMessageRequest = {
|
|
18
19
|
QueueUrl: this.NOTIFICATION_WS_MESSAGES_QUEUE,
|
|
19
|
-
MessageBody: JSON.stringify(message)
|
|
20
|
+
MessageBody: JSON.stringify(message),
|
|
21
|
+
MessageGroupId: "NotificationWSGroup",
|
|
22
|
+
MessageDeduplicationId: crypto.randomUUID()
|
|
20
23
|
};
|
|
21
24
|
const command: SendMessageCommand = new SendMessageCommand(sendMessageRequest);
|
|
22
25
|
await client.send(command);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { inject, injectable } from "inversify";
|
|
2
|
+
import { IHttpRequest } from "@fiado/http-client";
|
|
3
|
+
import { IPeopleBusinessApi } from "./interfaces/IPeopleBusinessApi";
|
|
4
|
+
import FiadoApiResponse from "@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse";
|
|
5
|
+
import { CPStatusEnum } from "@fiado/type-kit/bin/identity";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@injectable()
|
|
9
|
+
export default class PeopleBusinessApi implements IPeopleBusinessApi {
|
|
10
|
+
|
|
11
|
+
private readonly baseUrl = process.env.PEOPLE_BUSINESS_LAMBDA_URL || "";
|
|
12
|
+
|
|
13
|
+
constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
getByCPStatus(params: { index?: string; pageSize?: number; cpStatus: CPStatusEnum; sort?: "ascending" | "descending"; }): Promise<FiadoApiResponse<{ items: { people: any; accountRequirementControl: any; }[]; index: string | null; }>> {
|
|
17
|
+
const queryParamsArray = [];
|
|
18
|
+
if (params.index) {
|
|
19
|
+
queryParamsArray.push(`index=${params.index}`);
|
|
20
|
+
}
|
|
21
|
+
if (params.pageSize) {
|
|
22
|
+
queryParamsArray.push(`pageSize=${params.pageSize}`);
|
|
23
|
+
}
|
|
24
|
+
if (params.sort) {
|
|
25
|
+
queryParamsArray.push(`sort=${params.sort}`);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const queryString = queryParamsArray.length > 0 ? '?' + queryParamsArray.join('&') : '';
|
|
29
|
+
return this.httpRequest.get(`${this.baseUrl}private/people/get/cpstatus/${params.cpStatus}${queryString}`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CPStatusEnum } from "@fiado/type-kit/bin/identity";
|
|
2
|
+
import FiadoApiResponse from "@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export interface IPeopleBusinessApi {
|
|
6
|
+
getByCPStatus(params: { index: string; pageSize: number; cpStatus: CPStatusEnum; sort: "ascending" | "descending"; }): Promise<FiadoApiResponse<{ items: {people: any, accountRequirementControl: any}[]; index: string | null; }>>;
|
|
7
|
+
|
|
8
|
+
}
|