@fiado/api-invoker 5.0.0 → 5.1.0
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/kyc/index.d.ts +2 -0
- package/bin/kyc/index.js +2 -0
- package/bin/kyc/queue/RetailKycInboundPublisher.d.ts +6 -0
- package/bin/kyc/queue/RetailKycInboundPublisher.js +32 -0
- package/bin/kyc/queue/interfaces/IRetailKycInboundPublisher.d.ts +12 -0
- package/bin/kyc/queue/interfaces/IRetailKycInboundPublisher.js +1 -0
- package/package.json +2 -2
- package/src/kyc/index.ts +2 -0
- package/src/kyc/queue/RetailKycInboundPublisher.ts +26 -0
- package/src/kyc/queue/interfaces/IRetailKycInboundPublisher.ts +13 -0
package/bin/kyc/index.d.ts
CHANGED
package/bin/kyc/index.js
CHANGED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { KycVerificationChangedV1 } from "@fiado/type-kit/bin/kyc/index.js";
|
|
2
|
+
import { IRetailKycInboundPublisher } from "./interfaces/IRetailKycInboundPublisher.js";
|
|
3
|
+
export declare class RetailKycInboundPublisher implements IRetailKycInboundPublisher {
|
|
4
|
+
private readonly RETAIL_KYC_INBOUND_QUEUE_URL;
|
|
5
|
+
publish(message: KycVerificationChangedV1): Promise<void>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
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;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { SendMessageCommand, SQSClient } from "@aws-sdk/client-sqs";
|
|
8
|
+
import { injectable } from "inversify";
|
|
9
|
+
let RetailKycInboundPublisher = class RetailKycInboundPublisher {
|
|
10
|
+
RETAIL_KYC_INBOUND_QUEUE_URL = process.env.RETAIL_KYC_INBOUND_QUEUE_URL;
|
|
11
|
+
async publish(message) {
|
|
12
|
+
try {
|
|
13
|
+
const client = new SQSClient();
|
|
14
|
+
// Cola ESTÁNDAR (no FIFO): sin MessageGroupId/MessageDeduplicationId. La deduplicación
|
|
15
|
+
// la hace el consumidor con la llave de negocio (directoryId + verificationId + status + result).
|
|
16
|
+
const sendMessageRequest = {
|
|
17
|
+
QueueUrl: this.RETAIL_KYC_INBOUND_QUEUE_URL,
|
|
18
|
+
MessageBody: JSON.stringify(message),
|
|
19
|
+
};
|
|
20
|
+
const command = new SendMessageCommand(sendMessageRequest);
|
|
21
|
+
await client.send(command);
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
25
|
+
throw new Error(`Error publishing message to RetailKycInboundQueue: ${errorMessage}`);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
RetailKycInboundPublisher = __decorate([
|
|
30
|
+
injectable()
|
|
31
|
+
], RetailKycInboundPublisher);
|
|
32
|
+
export { RetailKycInboundPublisher };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { KycVerificationChangedV1 } from "@fiado/type-kit/bin/kyc/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Publisher del resultado del KYC hacia `RetailKycInboundQueue`, que consume
|
|
4
|
+
* `retail-wizard-business` (SureKeep F2).
|
|
5
|
+
*
|
|
6
|
+
* Lo produce `kyc-metamap-webhook` cuando una verificación pasa a COMPLETED. Vive acá —y no como
|
|
7
|
+
* SDK crudo en el webhook— porque la cola es COMPARTIDA cross-lambda: el estándar Fiado publica a una
|
|
8
|
+
* cola compartida vía Publisher de `@fiado/api-invoker` (mismo patrón que `ITransactionPublisher`).
|
|
9
|
+
*/
|
|
10
|
+
export interface IRetailKycInboundPublisher {
|
|
11
|
+
publish(message: KycVerificationChangedV1): Promise<void>;
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fiado/api-invoker",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.1.0",
|
|
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
|
"type": "module",
|
|
6
6
|
"main": "bin/index.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@fiado/gateway-adapter": "^3.9.0",
|
|
35
35
|
"@fiado/http-client": "^2.0.1",
|
|
36
36
|
"@fiado/logger": "^1.1.3",
|
|
37
|
-
"@fiado/type-kit": "^3.
|
|
37
|
+
"@fiado/type-kit": "^3.210.0",
|
|
38
38
|
"dotenv": "^16.4.7"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
package/src/kyc/index.ts
CHANGED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { SendMessageCommand, SendMessageRequest, SQSClient } from "@aws-sdk/client-sqs";
|
|
2
|
+
import { injectable } from "inversify";
|
|
3
|
+
import { KycVerificationChangedV1 } from "@fiado/type-kit/bin/kyc/index.js";
|
|
4
|
+
import { IRetailKycInboundPublisher } from "./interfaces/IRetailKycInboundPublisher.js";
|
|
5
|
+
|
|
6
|
+
@injectable()
|
|
7
|
+
export class RetailKycInboundPublisher implements IRetailKycInboundPublisher {
|
|
8
|
+
private readonly RETAIL_KYC_INBOUND_QUEUE_URL = process.env.RETAIL_KYC_INBOUND_QUEUE_URL;
|
|
9
|
+
|
|
10
|
+
async publish(message: KycVerificationChangedV1): Promise<void> {
|
|
11
|
+
try {
|
|
12
|
+
const client: SQSClient = new SQSClient();
|
|
13
|
+
// Cola ESTÁNDAR (no FIFO): sin MessageGroupId/MessageDeduplicationId. La deduplicación
|
|
14
|
+
// la hace el consumidor con la llave de negocio (directoryId + verificationId + status + result).
|
|
15
|
+
const sendMessageRequest: SendMessageRequest = {
|
|
16
|
+
QueueUrl: this.RETAIL_KYC_INBOUND_QUEUE_URL,
|
|
17
|
+
MessageBody: JSON.stringify(message),
|
|
18
|
+
};
|
|
19
|
+
const command: SendMessageCommand = new SendMessageCommand(sendMessageRequest);
|
|
20
|
+
await client.send(command);
|
|
21
|
+
} catch (error) {
|
|
22
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
23
|
+
throw new Error(`Error publishing message to RetailKycInboundQueue: ${errorMessage}`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { KycVerificationChangedV1 } from "@fiado/type-kit/bin/kyc/index.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Publisher del resultado del KYC hacia `RetailKycInboundQueue`, que consume
|
|
5
|
+
* `retail-wizard-business` (SureKeep F2).
|
|
6
|
+
*
|
|
7
|
+
* Lo produce `kyc-metamap-webhook` cuando una verificación pasa a COMPLETED. Vive acá —y no como
|
|
8
|
+
* SDK crudo en el webhook— porque la cola es COMPARTIDA cross-lambda: el estándar Fiado publica a una
|
|
9
|
+
* cola compartida vía Publisher de `@fiado/api-invoker` (mismo patrón que `ITransactionPublisher`).
|
|
10
|
+
*/
|
|
11
|
+
export interface IRetailKycInboundPublisher {
|
|
12
|
+
publish(message: KycVerificationChangedV1): Promise<void>;
|
|
13
|
+
}
|