legend-transactional 2.5.1 → 2.5.3

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 CHANGED
@@ -390,6 +390,7 @@ interface EventPayload {
390
390
  description: string;
391
391
  authorEmail: string;
392
392
  rewardType: string;
393
+ startAt: string;
393
394
  endsAt: string;
394
395
  nftBlockchainNetwork?: string;
395
396
  nftContractAddress?: string;
@@ -780,14 +781,39 @@ declare class EventsConsumeChannel extends ConsumeChannel {
780
781
  */
781
782
  ackMessage(): void;
782
783
  /**
783
- * Override nackWithDelay to emit audit.dead_letter event
784
+ * Negatively acknowledges (NACKs) the message with a specified delay and maximum retry count.
785
+ *
786
+ * This method is useful when you want to requeue the message for later processing, especially if the current attempt failed due to a temporary issue.
787
+ *
788
+ * Additionally, this override automatically emits an `audit.dead_letter` event to track the rejection.
789
+ *
790
+ * @param delay - The delay (in milliseconds) before requeueing the message. Defaults to `NACKING_DELAY_MS`.
791
+ * @param maxRetries - The maximum number of times to requeue the message before giving up. Defaults to `undefined`, never giving up.
792
+ * @returns An object containing:
793
+ * - `count`: The current retry count.
794
+ * - `delay`: The actual delay applied to the nack.
795
+ *
796
+ * @see NACKING_DELAY_MS
784
797
  */
785
798
  nackWithDelay(delay?: number, maxRetries?: number): {
786
799
  count: number;
787
800
  delay: number;
788
801
  };
789
802
  /**
790
- * Override nackWithFibonacciStrategy to emit audit.dead_letter event
803
+ * Negatively acknowledges (NACKs) the message using a Fibonacci backoff strategy.
804
+ *
805
+ * The delay before requeuing increases with each retry according to the Fibonacci sequence, helping to avoid overwhelming the system in case of repeated failures.
806
+ *
807
+ * Additionally, this override automatically emits an `audit.dead_letter` event to track the rejection.
808
+ *
809
+ * @param maxOccurrence - The maximum number of times the Fibonacci delay is allowed to increase before being reset. Defaults to `MAX_OCCURRENCE`.
810
+ * @param maxRetries - The maximum number of times to requeue the message before giving up. Defaults to `undefined`, never giving up.
811
+ * @returns An object containing:
812
+ * - `count`: The current retry count.
813
+ * - `delay`: The calculated Fibonacci delay (in milliseconds) applied to the nack.
814
+ * - `occurrence`: The current occurrence count for the Fibonacci sequence.
815
+ *
816
+ * @see MAX_OCCURRENCE
791
817
  */
792
818
  nackWithFibonacciStrategy(maxOccurrence?: number, maxRetries?: number): {
793
819
  count: number;
package/dist/index.d.ts CHANGED
@@ -390,6 +390,7 @@ interface EventPayload {
390
390
  description: string;
391
391
  authorEmail: string;
392
392
  rewardType: string;
393
+ startAt: string;
393
394
  endsAt: string;
394
395
  nftBlockchainNetwork?: string;
395
396
  nftContractAddress?: string;
@@ -780,14 +781,39 @@ declare class EventsConsumeChannel extends ConsumeChannel {
780
781
  */
781
782
  ackMessage(): void;
782
783
  /**
783
- * Override nackWithDelay to emit audit.dead_letter event
784
+ * Negatively acknowledges (NACKs) the message with a specified delay and maximum retry count.
785
+ *
786
+ * This method is useful when you want to requeue the message for later processing, especially if the current attempt failed due to a temporary issue.
787
+ *
788
+ * Additionally, this override automatically emits an `audit.dead_letter` event to track the rejection.
789
+ *
790
+ * @param delay - The delay (in milliseconds) before requeueing the message. Defaults to `NACKING_DELAY_MS`.
791
+ * @param maxRetries - The maximum number of times to requeue the message before giving up. Defaults to `undefined`, never giving up.
792
+ * @returns An object containing:
793
+ * - `count`: The current retry count.
794
+ * - `delay`: The actual delay applied to the nack.
795
+ *
796
+ * @see NACKING_DELAY_MS
784
797
  */
785
798
  nackWithDelay(delay?: number, maxRetries?: number): {
786
799
  count: number;
787
800
  delay: number;
788
801
  };
789
802
  /**
790
- * Override nackWithFibonacciStrategy to emit audit.dead_letter event
803
+ * Negatively acknowledges (NACKs) the message using a Fibonacci backoff strategy.
804
+ *
805
+ * The delay before requeuing increases with each retry according to the Fibonacci sequence, helping to avoid overwhelming the system in case of repeated failures.
806
+ *
807
+ * Additionally, this override automatically emits an `audit.dead_letter` event to track the rejection.
808
+ *
809
+ * @param maxOccurrence - The maximum number of times the Fibonacci delay is allowed to increase before being reset. Defaults to `MAX_OCCURRENCE`.
810
+ * @param maxRetries - The maximum number of times to requeue the message before giving up. Defaults to `undefined`, never giving up.
811
+ * @returns An object containing:
812
+ * - `count`: The current retry count.
813
+ * - `delay`: The calculated Fibonacci delay (in milliseconds) applied to the nack.
814
+ * - `occurrence`: The current occurrence count for the Fibonacci sequence.
815
+ *
816
+ * @see MAX_OCCURRENCE
791
817
  */
792
818
  nackWithFibonacciStrategy(maxOccurrence?: number, maxRetries?: number): {
793
819
  count: number;
package/dist/index.js CHANGED
@@ -639,7 +639,19 @@ var EventsConsumeChannel = class extends Consume_default {
639
639
  });
640
640
  }
641
641
  /**
642
- * Override nackWithDelay to emit audit.dead_letter event
642
+ * Negatively acknowledges (NACKs) the message with a specified delay and maximum retry count.
643
+ *
644
+ * This method is useful when you want to requeue the message for later processing, especially if the current attempt failed due to a temporary issue.
645
+ *
646
+ * Additionally, this override automatically emits an `audit.dead_letter` event to track the rejection.
647
+ *
648
+ * @param delay - The delay (in milliseconds) before requeueing the message. Defaults to `NACKING_DELAY_MS`.
649
+ * @param maxRetries - The maximum number of times to requeue the message before giving up. Defaults to `undefined`, never giving up.
650
+ * @returns An object containing:
651
+ * - `count`: The current retry count.
652
+ * - `delay`: The actual delay applied to the nack.
653
+ *
654
+ * @see NACKING_DELAY_MS
643
655
  */
644
656
  nackWithDelay(delay = NACKING_DELAY_MS, maxRetries) {
645
657
  const parentNack = super.nackWithDelay(delay, maxRetries);
@@ -660,7 +672,20 @@ var EventsConsumeChannel = class extends Consume_default {
660
672
  return parentNack;
661
673
  }
662
674
  /**
663
- * Override nackWithFibonacciStrategy to emit audit.dead_letter event
675
+ * Negatively acknowledges (NACKs) the message using a Fibonacci backoff strategy.
676
+ *
677
+ * The delay before requeuing increases with each retry according to the Fibonacci sequence, helping to avoid overwhelming the system in case of repeated failures.
678
+ *
679
+ * Additionally, this override automatically emits an `audit.dead_letter` event to track the rejection.
680
+ *
681
+ * @param maxOccurrence - The maximum number of times the Fibonacci delay is allowed to increase before being reset. Defaults to `MAX_OCCURRENCE`.
682
+ * @param maxRetries - The maximum number of times to requeue the message before giving up. Defaults to `undefined`, never giving up.
683
+ * @returns An object containing:
684
+ * - `count`: The current retry count.
685
+ * - `delay`: The calculated Fibonacci delay (in milliseconds) applied to the nack.
686
+ * - `occurrence`: The current occurrence count for the Fibonacci sequence.
687
+ *
688
+ * @see MAX_OCCURRENCE
664
689
  */
665
690
  nackWithFibonacciStrategy(maxOccurrence = MAX_OCCURRENCE, maxRetries) {
666
691
  const parentNack = super.nackWithFibonacciStrategy(maxOccurrence, maxRetries);
package/dist/index.mjs CHANGED
@@ -632,7 +632,19 @@ var EventsConsumeChannel = class extends Consume_default {
632
632
  });
633
633
  }
634
634
  /**
635
- * Override nackWithDelay to emit audit.dead_letter event
635
+ * Negatively acknowledges (NACKs) the message with a specified delay and maximum retry count.
636
+ *
637
+ * This method is useful when you want to requeue the message for later processing, especially if the current attempt failed due to a temporary issue.
638
+ *
639
+ * Additionally, this override automatically emits an `audit.dead_letter` event to track the rejection.
640
+ *
641
+ * @param delay - The delay (in milliseconds) before requeueing the message. Defaults to `NACKING_DELAY_MS`.
642
+ * @param maxRetries - The maximum number of times to requeue the message before giving up. Defaults to `undefined`, never giving up.
643
+ * @returns An object containing:
644
+ * - `count`: The current retry count.
645
+ * - `delay`: The actual delay applied to the nack.
646
+ *
647
+ * @see NACKING_DELAY_MS
636
648
  */
637
649
  nackWithDelay(delay = NACKING_DELAY_MS, maxRetries) {
638
650
  const parentNack = super.nackWithDelay(delay, maxRetries);
@@ -653,7 +665,20 @@ var EventsConsumeChannel = class extends Consume_default {
653
665
  return parentNack;
654
666
  }
655
667
  /**
656
- * Override nackWithFibonacciStrategy to emit audit.dead_letter event
668
+ * Negatively acknowledges (NACKs) the message using a Fibonacci backoff strategy.
669
+ *
670
+ * The delay before requeuing increases with each retry according to the Fibonacci sequence, helping to avoid overwhelming the system in case of repeated failures.
671
+ *
672
+ * Additionally, this override automatically emits an `audit.dead_letter` event to track the rejection.
673
+ *
674
+ * @param maxOccurrence - The maximum number of times the Fibonacci delay is allowed to increase before being reset. Defaults to `MAX_OCCURRENCE`.
675
+ * @param maxRetries - The maximum number of times to requeue the message before giving up. Defaults to `undefined`, never giving up.
676
+ * @returns An object containing:
677
+ * - `count`: The current retry count.
678
+ * - `delay`: The calculated Fibonacci delay (in milliseconds) applied to the nack.
679
+ * - `occurrence`: The current occurrence count for the Fibonacci sequence.
680
+ *
681
+ * @see MAX_OCCURRENCE
657
682
  */
658
683
  nackWithFibonacciStrategy(maxOccurrence = MAX_OCCURRENCE, maxRetries) {
659
684
  const parentNack = super.nackWithFibonacciStrategy(maxOccurrence, maxRetries);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "legend-transactional",
3
- "version": "2.5.1",
3
+ "version": "2.5.3",
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",
@@ -31,7 +31,7 @@
31
31
  "dist"
32
32
  ],
33
33
  "dependencies": {
34
- "@types/amqplib": "^0.10.7",
34
+ "@types/amqplib": "^0.10.8",
35
35
  "amqplib": "^0.10.9",
36
36
  "mitt": "latest",
37
37
  "uuid": "^13.0.0"