@fiado/api-invoker 3.0.8 → 3.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.
- package/bin/container.config.js +3 -0
- package/bin/index.d.ts +1 -0
- package/bin/index.js +1 -0
- package/bin/teams-connector/index.d.ts +2 -0
- package/bin/teams-connector/index.js +18 -0
- package/bin/teams-connector/queue/TeamsNotificationPublisher.d.ts +6 -0
- package/bin/teams-connector/queue/TeamsNotificationPublisher.js +33 -0
- package/bin/teams-connector/queue/interfaces/ITeamsNotificationPublisher.d.ts +4 -0
- package/bin/teams-connector/queue/interfaces/ITeamsNotificationPublisher.js +2 -0
- package/package.json +2 -2
- package/src/container.config.ts +6 -0
- package/src/index.ts +1 -1
- package/src/teams-connector/index.ts +2 -0
- package/src/teams-connector/queue/TeamsNotificationPublisher.ts +23 -0
- package/src/teams-connector/queue/interfaces/ITeamsNotificationPublisher.ts +5 -0
package/bin/container.config.js
CHANGED
|
@@ -88,6 +88,7 @@ const CreditStatementPublisher_1 = __importDefault(require("./credit-engine/queu
|
|
|
88
88
|
const CreditReconciliationPublisher_1 = __importDefault(require("./credit-engine/queue/CreditReconciliationPublisher"));
|
|
89
89
|
const CreditLienCollectionPublisher_1 = __importDefault(require("./credit-engine/queue/CreditLienCollectionPublisher"));
|
|
90
90
|
const PlatformErrorEventsPublisher_1 = __importDefault(require("./platform-error-events/queue/PlatformErrorEventsPublisher"));
|
|
91
|
+
const TeamsNotificationPublisher_1 = __importDefault(require("./teams-connector/queue/TeamsNotificationPublisher"));
|
|
91
92
|
exports.apiInvokerBindings = new inversify_1.ContainerModule((bind) => {
|
|
92
93
|
// UTILS bindings
|
|
93
94
|
bind("InvokerUtils").to(InvokerUtils_1.InvokerUtils);
|
|
@@ -176,4 +177,6 @@ exports.apiInvokerBindings = new inversify_1.ContainerModule((bind) => {
|
|
|
176
177
|
bind("ICreditLienCollectionPublisher").to(CreditLienCollectionPublisher_1.default);
|
|
177
178
|
// Platform error events - SQS publisher
|
|
178
179
|
bind("IPlatformErrorEventsPublisher").to(PlatformErrorEventsPublisher_1.default);
|
|
180
|
+
// Teams connector - SQS publisher
|
|
181
|
+
bind("ITeamsNotificationPublisher").to(TeamsNotificationPublisher_1.default);
|
|
179
182
|
});
|
package/bin/index.d.ts
CHANGED
package/bin/index.js
CHANGED
|
@@ -80,3 +80,4 @@ __exportStar(require("./credit-payment"), exports);
|
|
|
80
80
|
__exportStar(require("./document-generator"), exports);
|
|
81
81
|
__exportStar(require("./commission-business"), exports);
|
|
82
82
|
__exportStar(require("./platform-error-events"), exports);
|
|
83
|
+
__exportStar(require("./teams-connector"), exports);
|
|
@@ -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("./queue/TeamsNotificationPublisher"), exports);
|
|
18
|
+
__exportStar(require("./queue/interfaces/ITeamsNotificationPublisher"), exports);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ITeamsNotificationPublisher } from "./interfaces/ITeamsNotificationPublisher";
|
|
2
|
+
import { TeamsNotificationRequest } from "@fiado/type-kit/bin/teamsConnector";
|
|
3
|
+
export default class TeamsNotificationPublisher implements ITeamsNotificationPublisher {
|
|
4
|
+
private readonly TEAMS_NOTIFICATION_QUEUE;
|
|
5
|
+
publish(message: TeamsNotificationRequest): Promise<void>;
|
|
6
|
+
}
|
|
@@ -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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
const client_sqs_1 = require("@aws-sdk/client-sqs");
|
|
10
|
+
const inversify_1 = require("inversify");
|
|
11
|
+
let TeamsNotificationPublisher = class TeamsNotificationPublisher {
|
|
12
|
+
constructor() {
|
|
13
|
+
this.TEAMS_NOTIFICATION_QUEUE = process.env.TEAMS_NOTIFICATION_QUEUE;
|
|
14
|
+
}
|
|
15
|
+
async publish(message) {
|
|
16
|
+
try {
|
|
17
|
+
const client = new client_sqs_1.SQSClient();
|
|
18
|
+
const sendMessageRequest = {
|
|
19
|
+
QueueUrl: this.TEAMS_NOTIFICATION_QUEUE,
|
|
20
|
+
MessageBody: JSON.stringify(message)
|
|
21
|
+
};
|
|
22
|
+
const command = new client_sqs_1.SendMessageCommand(sendMessageRequest);
|
|
23
|
+
await client.send(command);
|
|
24
|
+
}
|
|
25
|
+
catch (error) {
|
|
26
|
+
throw new Error(`Error publishing message to TeamsNotificationQueue${': ' + error.message}`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
TeamsNotificationPublisher = __decorate([
|
|
31
|
+
(0, inversify_1.injectable)()
|
|
32
|
+
], TeamsNotificationPublisher);
|
|
33
|
+
exports.default = TeamsNotificationPublisher;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fiado/api-invoker",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.9",
|
|
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": "^3.0.
|
|
19
|
+
"@fiado/type-kit": "^3.0.16",
|
|
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
|
@@ -127,6 +127,9 @@ import CreditLienCollectionPublisher from "./credit-engine/queue/CreditLienColle
|
|
|
127
127
|
// Platform error events - SQS publisher
|
|
128
128
|
import { IPlatformErrorEventsPublisher } from "./platform-error-events";
|
|
129
129
|
import PlatformErrorEventsPublisher from "./platform-error-events/queue/PlatformErrorEventsPublisher";
|
|
130
|
+
// Teams connector - SQS publisher
|
|
131
|
+
import { ITeamsNotificationPublisher } from "./teams-connector";
|
|
132
|
+
import TeamsNotificationPublisher from "./teams-connector/queue/TeamsNotificationPublisher";
|
|
130
133
|
|
|
131
134
|
export const apiInvokerBindings = new ContainerModule((bind: interfaces.Bind) => {
|
|
132
135
|
// UTILS bindings
|
|
@@ -220,4 +223,7 @@ export const apiInvokerBindings = new ContainerModule((bind: interfaces.Bind) =>
|
|
|
220
223
|
|
|
221
224
|
// Platform error events - SQS publisher
|
|
222
225
|
bind<IPlatformErrorEventsPublisher>("IPlatformErrorEventsPublisher").to(PlatformErrorEventsPublisher);
|
|
226
|
+
|
|
227
|
+
// Teams connector - SQS publisher
|
|
228
|
+
bind<ITeamsNotificationPublisher>("ITeamsNotificationPublisher").to(TeamsNotificationPublisher);
|
|
223
229
|
});
|
package/src/index.ts
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { SendMessageCommand, SendMessageRequest, SQSClient } from "@aws-sdk/client-sqs";
|
|
2
|
+
import { ITeamsNotificationPublisher } from "./interfaces/ITeamsNotificationPublisher";
|
|
3
|
+
import { TeamsNotificationRequest } from "@fiado/type-kit/bin/teamsConnector";
|
|
4
|
+
import { injectable } from "inversify";
|
|
5
|
+
|
|
6
|
+
@injectable()
|
|
7
|
+
export default class TeamsNotificationPublisher implements ITeamsNotificationPublisher {
|
|
8
|
+
private readonly TEAMS_NOTIFICATION_QUEUE = process.env.TEAMS_NOTIFICATION_QUEUE;
|
|
9
|
+
|
|
10
|
+
async publish(message: TeamsNotificationRequest): Promise<void> {
|
|
11
|
+
try {
|
|
12
|
+
const client: SQSClient = new SQSClient();
|
|
13
|
+
const sendMessageRequest: SendMessageRequest = {
|
|
14
|
+
QueueUrl: this.TEAMS_NOTIFICATION_QUEUE,
|
|
15
|
+
MessageBody: JSON.stringify(message)
|
|
16
|
+
};
|
|
17
|
+
const command: SendMessageCommand = new SendMessageCommand(sendMessageRequest);
|
|
18
|
+
await client.send(command);
|
|
19
|
+
} catch (error) {
|
|
20
|
+
throw new Error(`Error publishing message to TeamsNotificationQueue${': ' + error.message}`);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|