@fiado/api-invoker 5.21.0 → 5.22.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.
@@ -18,9 +18,14 @@ let ZendeskAlertsPublisher = class ZendeskAlertsPublisher {
18
18
  async publish(message) {
19
19
  try {
20
20
  const client = new SQSClient();
21
+ const queueUrl = this.ZENDESK_ALERTS_QUEUE;
22
+ // Condicional a la URL: la FIFO exige MessageGroupId y la estándar lo rechaza.
23
+ // Serializa por usuario; sin MessageDeduplicationId (la cola dedup por contenido).
24
+ const directoryId = message.payload?.directoryId;
21
25
  const sendMessageRequest = {
22
- QueueUrl: this.ZENDESK_ALERTS_QUEUE,
23
- MessageBody: JSON.stringify(message)
26
+ QueueUrl: queueUrl,
27
+ MessageBody: JSON.stringify(message),
28
+ ...(queueUrl?.endsWith(".fifo") && directoryId ? { MessageGroupId: directoryId } : {})
24
29
  };
25
30
  const command = new SendMessageCommand(sendMessageRequest);
26
31
  await client.send(command);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiado/api-invoker",
3
- "version": "5.21.0",
3
+ "version": "5.22.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",
@@ -24,9 +24,14 @@ export default class ZendeskAlertsPublisher implements IZendeskAlertsPublisher {
24
24
  private async publish(message: IZendeskAlertMessage): Promise<void> {
25
25
  try {
26
26
  const client: SQSClient = new SQSClient();
27
+ const queueUrl = this.ZENDESK_ALERTS_QUEUE;
28
+ // Condicional a la URL: la FIFO exige MessageGroupId y la estándar lo rechaza.
29
+ // Serializa por usuario; sin MessageDeduplicationId (la cola dedup por contenido).
30
+ const directoryId = (message.payload as { directoryId?: string })?.directoryId;
27
31
  const sendMessageRequest: SendMessageRequest = {
28
- QueueUrl: this.ZENDESK_ALERTS_QUEUE,
29
- MessageBody: JSON.stringify(message)
32
+ QueueUrl: queueUrl,
33
+ MessageBody: JSON.stringify(message),
34
+ ...(queueUrl?.endsWith(".fifo") && directoryId ? { MessageGroupId: directoryId } : {})
30
35
  };
31
36
  const command: SendMessageCommand = new SendMessageCommand(sendMessageRequest);
32
37
  await client.send(command);