legend-transactional 2.3.0 → 2.3.2
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/dist/index.d.mts +14 -14
- package/dist/index.d.ts +14 -14
- package/dist/index.js +20 -22
- package/dist/index.mjs +20 -22
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -477,19 +477,19 @@ interface EventPayload {
|
|
|
477
477
|
/**
|
|
478
478
|
* The event that was received
|
|
479
479
|
*/
|
|
480
|
-
|
|
480
|
+
received_event: string;
|
|
481
481
|
/**
|
|
482
482
|
* Timestamp when the event was received (UNIX timestamp in seconds)
|
|
483
483
|
*/
|
|
484
|
-
|
|
484
|
+
received_at: number;
|
|
485
485
|
/**
|
|
486
486
|
* The queue name from which the event was consumed
|
|
487
487
|
*/
|
|
488
|
-
|
|
488
|
+
queue_name: string;
|
|
489
489
|
/**
|
|
490
490
|
* Optional event identifier for tracking
|
|
491
491
|
*/
|
|
492
|
-
|
|
492
|
+
event_id?: string;
|
|
493
493
|
};
|
|
494
494
|
/**
|
|
495
495
|
* Emitted when an event is successfully processed by a microservice for audit tracking
|
|
@@ -502,19 +502,19 @@ interface EventPayload {
|
|
|
502
502
|
/**
|
|
503
503
|
* The original event that was processed
|
|
504
504
|
*/
|
|
505
|
-
|
|
505
|
+
processed_event: string;
|
|
506
506
|
/**
|
|
507
507
|
* Timestamp when the event was processed (UNIX timestamp in seconds)
|
|
508
508
|
*/
|
|
509
|
-
|
|
509
|
+
processed_at: number;
|
|
510
510
|
/**
|
|
511
511
|
* The queue name where the event was consumed
|
|
512
512
|
*/
|
|
513
|
-
|
|
513
|
+
queue_name: string;
|
|
514
514
|
/**
|
|
515
515
|
* Optional event identifier for tracking
|
|
516
516
|
*/
|
|
517
|
-
|
|
517
|
+
event_id?: string;
|
|
518
518
|
};
|
|
519
519
|
/**
|
|
520
520
|
* Emitted when a message is rejected/nacked and sent to dead letter queue
|
|
@@ -527,27 +527,27 @@ interface EventPayload {
|
|
|
527
527
|
/**
|
|
528
528
|
* The original event that was rejected
|
|
529
529
|
*/
|
|
530
|
-
|
|
530
|
+
rejected_event: string;
|
|
531
531
|
/**
|
|
532
532
|
* Timestamp when the event was rejected (UNIX timestamp in seconds)
|
|
533
533
|
*/
|
|
534
|
-
|
|
534
|
+
rejected_at: number;
|
|
535
535
|
/**
|
|
536
536
|
* The queue name where the event was rejected from
|
|
537
537
|
*/
|
|
538
|
-
|
|
538
|
+
queue_name: string;
|
|
539
539
|
/**
|
|
540
540
|
* Reason for rejection (delay, fibonacci_strategy, etc.)
|
|
541
541
|
*/
|
|
542
|
-
|
|
542
|
+
rejection_reason: 'delay' | 'fibonacci_strategy';
|
|
543
543
|
/**
|
|
544
544
|
* Optional retry count
|
|
545
545
|
*/
|
|
546
|
-
|
|
546
|
+
retry_count?: number;
|
|
547
547
|
/**
|
|
548
548
|
* Optional event identifier for tracking
|
|
549
549
|
*/
|
|
550
|
-
|
|
550
|
+
event_id?: string;
|
|
551
551
|
};
|
|
552
552
|
}
|
|
553
553
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -477,19 +477,19 @@ interface EventPayload {
|
|
|
477
477
|
/**
|
|
478
478
|
* The event that was received
|
|
479
479
|
*/
|
|
480
|
-
|
|
480
|
+
received_event: string;
|
|
481
481
|
/**
|
|
482
482
|
* Timestamp when the event was received (UNIX timestamp in seconds)
|
|
483
483
|
*/
|
|
484
|
-
|
|
484
|
+
received_at: number;
|
|
485
485
|
/**
|
|
486
486
|
* The queue name from which the event was consumed
|
|
487
487
|
*/
|
|
488
|
-
|
|
488
|
+
queue_name: string;
|
|
489
489
|
/**
|
|
490
490
|
* Optional event identifier for tracking
|
|
491
491
|
*/
|
|
492
|
-
|
|
492
|
+
event_id?: string;
|
|
493
493
|
};
|
|
494
494
|
/**
|
|
495
495
|
* Emitted when an event is successfully processed by a microservice for audit tracking
|
|
@@ -502,19 +502,19 @@ interface EventPayload {
|
|
|
502
502
|
/**
|
|
503
503
|
* The original event that was processed
|
|
504
504
|
*/
|
|
505
|
-
|
|
505
|
+
processed_event: string;
|
|
506
506
|
/**
|
|
507
507
|
* Timestamp when the event was processed (UNIX timestamp in seconds)
|
|
508
508
|
*/
|
|
509
|
-
|
|
509
|
+
processed_at: number;
|
|
510
510
|
/**
|
|
511
511
|
* The queue name where the event was consumed
|
|
512
512
|
*/
|
|
513
|
-
|
|
513
|
+
queue_name: string;
|
|
514
514
|
/**
|
|
515
515
|
* Optional event identifier for tracking
|
|
516
516
|
*/
|
|
517
|
-
|
|
517
|
+
event_id?: string;
|
|
518
518
|
};
|
|
519
519
|
/**
|
|
520
520
|
* Emitted when a message is rejected/nacked and sent to dead letter queue
|
|
@@ -527,27 +527,27 @@ interface EventPayload {
|
|
|
527
527
|
/**
|
|
528
528
|
* The original event that was rejected
|
|
529
529
|
*/
|
|
530
|
-
|
|
530
|
+
rejected_event: string;
|
|
531
531
|
/**
|
|
532
532
|
* Timestamp when the event was rejected (UNIX timestamp in seconds)
|
|
533
533
|
*/
|
|
534
|
-
|
|
534
|
+
rejected_at: number;
|
|
535
535
|
/**
|
|
536
536
|
* The queue name where the event was rejected from
|
|
537
537
|
*/
|
|
538
|
-
|
|
538
|
+
queue_name: string;
|
|
539
539
|
/**
|
|
540
540
|
* Reason for rejection (delay, fibonacci_strategy, etc.)
|
|
541
541
|
*/
|
|
542
|
-
|
|
542
|
+
rejection_reason: 'delay' | 'fibonacci_strategy';
|
|
543
543
|
/**
|
|
544
544
|
* Optional retry count
|
|
545
545
|
*/
|
|
546
|
-
|
|
546
|
+
retry_count?: number;
|
|
547
547
|
/**
|
|
548
548
|
* Optional event identifier for tracking
|
|
549
549
|
*/
|
|
550
|
-
|
|
550
|
+
event_id?: string;
|
|
551
551
|
};
|
|
552
552
|
}
|
|
553
553
|
/**
|
package/dist/index.js
CHANGED
|
@@ -702,10 +702,10 @@ var EventsConsumeChannel = class extends Consume_default {
|
|
|
702
702
|
const timestamp = Math.floor(Date.now() / 1e3);
|
|
703
703
|
publishAuditProcessed(this.channel, {
|
|
704
704
|
microservice: this.microservice,
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
705
|
+
processed_event: this.processedEvent,
|
|
706
|
+
processed_at: timestamp,
|
|
707
|
+
queue_name: this.queueName,
|
|
708
|
+
event_id: void 0
|
|
709
709
|
// Optional: can be enhanced later
|
|
710
710
|
}).catch((error) => {
|
|
711
711
|
console.error("Failed to emit audit.processed event:", error);
|
|
@@ -719,12 +719,12 @@ var EventsConsumeChannel = class extends Consume_default {
|
|
|
719
719
|
const timestamp = Math.floor(Date.now() / 1e3);
|
|
720
720
|
publishAuditDeadLetter(this.channel, {
|
|
721
721
|
microservice: this.microservice,
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
722
|
+
rejected_event: this.processedEvent,
|
|
723
|
+
rejected_at: timestamp,
|
|
724
|
+
queue_name: this.queueName,
|
|
725
|
+
rejection_reason: "delay",
|
|
726
|
+
retry_count: parentNack.count,
|
|
727
|
+
event_id: void 0
|
|
728
728
|
}).catch((error) => {
|
|
729
729
|
console.error("Failed to emit audit.dead_letter event:", error);
|
|
730
730
|
});
|
|
@@ -738,12 +738,12 @@ var EventsConsumeChannel = class extends Consume_default {
|
|
|
738
738
|
const timestamp = Math.floor(Date.now() / 1e3);
|
|
739
739
|
publishAuditDeadLetter(this.channel, {
|
|
740
740
|
microservice: this.microservice,
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
741
|
+
rejected_event: this.processedEvent,
|
|
742
|
+
rejected_at: timestamp,
|
|
743
|
+
queue_name: this.queueName,
|
|
744
|
+
rejection_reason: "fibonacci_strategy",
|
|
745
|
+
retry_count: parentNack.count,
|
|
746
|
+
event_id: void 0
|
|
747
747
|
}).catch((error) => {
|
|
748
748
|
console.error("Failed to emit audit.dead_letter event:", error);
|
|
749
749
|
});
|
|
@@ -795,10 +795,10 @@ var eventCallback = (msg, channel, e, queueName) => {
|
|
|
795
795
|
const timestamp = Math.floor(Date.now() / 1e3);
|
|
796
796
|
publishAuditReceived(channel, {
|
|
797
797
|
microservice,
|
|
798
|
-
receivedEvent,
|
|
799
|
-
|
|
800
|
-
queueName,
|
|
801
|
-
|
|
798
|
+
received_event: receivedEvent,
|
|
799
|
+
received_at: timestamp,
|
|
800
|
+
queue_name: queueName,
|
|
801
|
+
event_id: void 0
|
|
802
802
|
// Optional: can be enhanced later with message ID tracking
|
|
803
803
|
}).catch((error) => {
|
|
804
804
|
console.error("Failed to emit audit.received event:", error);
|
|
@@ -1096,7 +1096,6 @@ var sendToQueue = (
|
|
|
1096
1096
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1097
1097
|
async (queueName, payload) => {
|
|
1098
1098
|
const channel = await getSendChannel();
|
|
1099
|
-
await channel.assertQueue(queueName, { durable: true });
|
|
1100
1099
|
channel.sendToQueue(queueName, Buffer.from(JSON.stringify(payload)), {
|
|
1101
1100
|
persistent: true
|
|
1102
1101
|
});
|
|
@@ -1113,7 +1112,6 @@ var commenceSaga = async (sagaTitle2, payload) => {
|
|
|
1113
1112
|
// src/Broker/PublishToExchange.ts
|
|
1114
1113
|
var publishEvent = async (msg, event) => {
|
|
1115
1114
|
const channel = await getSendChannel();
|
|
1116
|
-
await channel.assertExchange(exchange.Matching, "headers", { durable: true });
|
|
1117
1115
|
channel.publish(exchange.Matching, ``, Buffer.from(JSON.stringify(msg)), {
|
|
1118
1116
|
headers: {
|
|
1119
1117
|
...getEventObject(event),
|
package/dist/index.mjs
CHANGED
|
@@ -695,10 +695,10 @@ var EventsConsumeChannel = class extends Consume_default {
|
|
|
695
695
|
const timestamp = Math.floor(Date.now() / 1e3);
|
|
696
696
|
publishAuditProcessed(this.channel, {
|
|
697
697
|
microservice: this.microservice,
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
698
|
+
processed_event: this.processedEvent,
|
|
699
|
+
processed_at: timestamp,
|
|
700
|
+
queue_name: this.queueName,
|
|
701
|
+
event_id: void 0
|
|
702
702
|
// Optional: can be enhanced later
|
|
703
703
|
}).catch((error) => {
|
|
704
704
|
console.error("Failed to emit audit.processed event:", error);
|
|
@@ -712,12 +712,12 @@ var EventsConsumeChannel = class extends Consume_default {
|
|
|
712
712
|
const timestamp = Math.floor(Date.now() / 1e3);
|
|
713
713
|
publishAuditDeadLetter(this.channel, {
|
|
714
714
|
microservice: this.microservice,
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
715
|
+
rejected_event: this.processedEvent,
|
|
716
|
+
rejected_at: timestamp,
|
|
717
|
+
queue_name: this.queueName,
|
|
718
|
+
rejection_reason: "delay",
|
|
719
|
+
retry_count: parentNack.count,
|
|
720
|
+
event_id: void 0
|
|
721
721
|
}).catch((error) => {
|
|
722
722
|
console.error("Failed to emit audit.dead_letter event:", error);
|
|
723
723
|
});
|
|
@@ -731,12 +731,12 @@ var EventsConsumeChannel = class extends Consume_default {
|
|
|
731
731
|
const timestamp = Math.floor(Date.now() / 1e3);
|
|
732
732
|
publishAuditDeadLetter(this.channel, {
|
|
733
733
|
microservice: this.microservice,
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
734
|
+
rejected_event: this.processedEvent,
|
|
735
|
+
rejected_at: timestamp,
|
|
736
|
+
queue_name: this.queueName,
|
|
737
|
+
rejection_reason: "fibonacci_strategy",
|
|
738
|
+
retry_count: parentNack.count,
|
|
739
|
+
event_id: void 0
|
|
740
740
|
}).catch((error) => {
|
|
741
741
|
console.error("Failed to emit audit.dead_letter event:", error);
|
|
742
742
|
});
|
|
@@ -788,10 +788,10 @@ var eventCallback = (msg, channel, e, queueName) => {
|
|
|
788
788
|
const timestamp = Math.floor(Date.now() / 1e3);
|
|
789
789
|
publishAuditReceived(channel, {
|
|
790
790
|
microservice,
|
|
791
|
-
receivedEvent,
|
|
792
|
-
|
|
793
|
-
queueName,
|
|
794
|
-
|
|
791
|
+
received_event: receivedEvent,
|
|
792
|
+
received_at: timestamp,
|
|
793
|
+
queue_name: queueName,
|
|
794
|
+
event_id: void 0
|
|
795
795
|
// Optional: can be enhanced later with message ID tracking
|
|
796
796
|
}).catch((error) => {
|
|
797
797
|
console.error("Failed to emit audit.received event:", error);
|
|
@@ -1089,7 +1089,6 @@ var sendToQueue = (
|
|
|
1089
1089
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1090
1090
|
async (queueName, payload) => {
|
|
1091
1091
|
const channel = await getSendChannel();
|
|
1092
|
-
await channel.assertQueue(queueName, { durable: true });
|
|
1093
1092
|
channel.sendToQueue(queueName, Buffer.from(JSON.stringify(payload)), {
|
|
1094
1093
|
persistent: true
|
|
1095
1094
|
});
|
|
@@ -1106,7 +1105,6 @@ var commenceSaga = async (sagaTitle2, payload) => {
|
|
|
1106
1105
|
// src/Broker/PublishToExchange.ts
|
|
1107
1106
|
var publishEvent = async (msg, event) => {
|
|
1108
1107
|
const channel = await getSendChannel();
|
|
1109
|
-
await channel.assertExchange(exchange.Matching, "headers", { durable: true });
|
|
1110
1108
|
channel.publish(exchange.Matching, ``, Buffer.from(JSON.stringify(msg)), {
|
|
1111
1109
|
headers: {
|
|
1112
1110
|
...getEventObject(event),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "legend-transactional",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.2",
|
|
4
4
|
"description": "A simple transactional, event-driven communication framework for microservices using RabbitMQ",
|
|
5
5
|
"author": "Jorge Clavijo <jym272@gmail.com> (https://github.com/jym272)",
|
|
6
6
|
"license": "MIT",
|