legend-transactional 2.4.0 → 2.5.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/dist/index.d.mts CHANGED
@@ -366,6 +366,17 @@ interface EventPayload {
366
366
  templateName: string;
367
367
  templateData: Record<string, unknown>;
368
368
  };
369
+ /**
370
+ * Event to deliver participation reward (post-ranking)
371
+ */
372
+ 'legend_rankings.participation_reward': {
373
+ userId: string;
374
+ rankingId: number;
375
+ participationRewardType: string;
376
+ rewardConfig: Record<string, unknown>;
377
+ templateName: string;
378
+ templateData: Record<string, unknown>;
379
+ };
369
380
  /**
370
381
  * Event to notify when a ranking is created
371
382
  */
@@ -483,7 +494,7 @@ interface EventPayload {
483
494
  */
484
495
  published_event: string;
485
496
  /**
486
- * Timestamp when the event was published (UNIX timestamp in seconds)
497
+ * Timestamp when the event was published (UNIX timestamp in milliseconds)
487
498
  */
488
499
  published_at: number;
489
500
  /**
@@ -508,7 +519,7 @@ interface EventPayload {
508
519
  */
509
520
  received_event: string;
510
521
  /**
511
- * Timestamp when the event was received (UNIX timestamp in seconds)
522
+ * Timestamp when the event was received (UNIX timestamp in milliseconds)
512
523
  */
513
524
  received_at: number;
514
525
  /**
@@ -537,7 +548,7 @@ interface EventPayload {
537
548
  */
538
549
  processed_event: string;
539
550
  /**
540
- * Timestamp when the event was processed (UNIX timestamp in seconds)
551
+ * Timestamp when the event was processed (UNIX timestamp in milliseconds)
541
552
  */
542
553
  processed_at: number;
543
554
  /**
@@ -566,7 +577,7 @@ interface EventPayload {
566
577
  */
567
578
  rejected_event: string;
568
579
  /**
569
- * Timestamp when the event was rejected (UNIX timestamp in seconds)
580
+ * Timestamp when the event was rejected (UNIX timestamp in milliseconds)
570
581
  */
571
582
  rejected_at: number;
572
583
  /**
@@ -614,6 +625,7 @@ declare const microserviceEvent: {
614
625
  readonly 'LEGEND_RANKINGS.RANKINGS_FINISHED': "legend_rankings.rankings_finished";
615
626
  readonly 'LEGEND_RANKINGS.NEW_RANKING_CREATED': "legend_rankings.new_ranking_created";
616
627
  readonly 'LEGEND_RANKINGS.INTERMEDIATE_REWARD': "legend_rankings.intermediate_reward";
628
+ readonly 'LEGEND_RANKINGS.PARTICIPATION_REWARD': "legend_rankings.participation_reward";
617
629
  readonly 'LEGEND_SHOWCASE.PRODUCT_VIRTUAL_DELETED': "legend_showcase.product_virtual_deleted";
618
630
  readonly 'LEGEND_SHOWCASE.UPDATE_ALLOWED_MISSION_SUBSCRIPTION_IDS': "legend_showcase.update_allowed_mission_subscription_ids";
619
631
  readonly 'LEGEND_SHOWCASE.UPDATE_ALLOWED_RANKING_SUBSCRIPTION_IDS': "legend_showcase.update_allowed_ranking_subscription_ids";
package/dist/index.d.ts CHANGED
@@ -366,6 +366,17 @@ interface EventPayload {
366
366
  templateName: string;
367
367
  templateData: Record<string, unknown>;
368
368
  };
369
+ /**
370
+ * Event to deliver participation reward (post-ranking)
371
+ */
372
+ 'legend_rankings.participation_reward': {
373
+ userId: string;
374
+ rankingId: number;
375
+ participationRewardType: string;
376
+ rewardConfig: Record<string, unknown>;
377
+ templateName: string;
378
+ templateData: Record<string, unknown>;
379
+ };
369
380
  /**
370
381
  * Event to notify when a ranking is created
371
382
  */
@@ -483,7 +494,7 @@ interface EventPayload {
483
494
  */
484
495
  published_event: string;
485
496
  /**
486
- * Timestamp when the event was published (UNIX timestamp in seconds)
497
+ * Timestamp when the event was published (UNIX timestamp in milliseconds)
487
498
  */
488
499
  published_at: number;
489
500
  /**
@@ -508,7 +519,7 @@ interface EventPayload {
508
519
  */
509
520
  received_event: string;
510
521
  /**
511
- * Timestamp when the event was received (UNIX timestamp in seconds)
522
+ * Timestamp when the event was received (UNIX timestamp in milliseconds)
512
523
  */
513
524
  received_at: number;
514
525
  /**
@@ -537,7 +548,7 @@ interface EventPayload {
537
548
  */
538
549
  processed_event: string;
539
550
  /**
540
- * Timestamp when the event was processed (UNIX timestamp in seconds)
551
+ * Timestamp when the event was processed (UNIX timestamp in milliseconds)
541
552
  */
542
553
  processed_at: number;
543
554
  /**
@@ -566,7 +577,7 @@ interface EventPayload {
566
577
  */
567
578
  rejected_event: string;
568
579
  /**
569
- * Timestamp when the event was rejected (UNIX timestamp in seconds)
580
+ * Timestamp when the event was rejected (UNIX timestamp in milliseconds)
570
581
  */
571
582
  rejected_at: number;
572
583
  /**
@@ -614,6 +625,7 @@ declare const microserviceEvent: {
614
625
  readonly 'LEGEND_RANKINGS.RANKINGS_FINISHED': "legend_rankings.rankings_finished";
615
626
  readonly 'LEGEND_RANKINGS.NEW_RANKING_CREATED': "legend_rankings.new_ranking_created";
616
627
  readonly 'LEGEND_RANKINGS.INTERMEDIATE_REWARD': "legend_rankings.intermediate_reward";
628
+ readonly 'LEGEND_RANKINGS.PARTICIPATION_REWARD': "legend_rankings.participation_reward";
617
629
  readonly 'LEGEND_SHOWCASE.PRODUCT_VIRTUAL_DELETED': "legend_showcase.product_virtual_deleted";
618
630
  readonly 'LEGEND_SHOWCASE.UPDATE_ALLOWED_MISSION_SUBSCRIPTION_IDS': "legend_showcase.update_allowed_mission_subscription_ids";
619
631
  readonly 'LEGEND_SHOWCASE.UPDATE_ALLOWED_RANKING_SUBSCRIPTION_IDS': "legend_showcase.update_allowed_ranking_subscription_ids";
package/dist/index.js CHANGED
@@ -132,6 +132,7 @@ var microserviceEvent = {
132
132
  "LEGEND_RANKINGS.RANKINGS_FINISHED": "legend_rankings.rankings_finished",
133
133
  "LEGEND_RANKINGS.NEW_RANKING_CREATED": "legend_rankings.new_ranking_created",
134
134
  "LEGEND_RANKINGS.INTERMEDIATE_REWARD": "legend_rankings.intermediate_reward",
135
+ "LEGEND_RANKINGS.PARTICIPATION_REWARD": "legend_rankings.participation_reward",
135
136
  "LEGEND_SHOWCASE.PRODUCT_VIRTUAL_DELETED": "legend_showcase.product_virtual_deleted",
136
137
  "LEGEND_SHOWCASE.UPDATE_ALLOWED_MISSION_SUBSCRIPTION_IDS": "legend_showcase.update_allowed_mission_subscription_ids",
137
138
  "LEGEND_SHOWCASE.UPDATE_ALLOWED_RANKING_SUBSCRIPTION_IDS": "legend_showcase.update_allowed_ranking_subscription_ids",
@@ -624,7 +625,7 @@ var EventsConsumeChannel = class extends Consume_default {
624
625
  */
625
626
  ackMessage() {
626
627
  this.channel.ack(this.msg, false);
627
- const timestamp = Math.floor(Date.now() / 1e3);
628
+ const timestamp = Date.now();
628
629
  publishAuditEvent(this.channel, "audit.processed", {
629
630
  publisher_microservice: this.publisherMicroservice,
630
631
  processor_microservice: this.processorMicroservice,
@@ -642,7 +643,7 @@ var EventsConsumeChannel = class extends Consume_default {
642
643
  */
643
644
  nackWithDelay(delay = NACKING_DELAY_MS, maxRetries) {
644
645
  const parentNack = super.nackWithDelay(delay, maxRetries);
645
- const timestamp = Math.floor(Date.now() / 1e3);
646
+ const timestamp = Date.now();
646
647
  publishAuditEvent(this.channel, "audit.dead_letter", {
647
648
  publisher_microservice: this.publisherMicroservice,
648
649
  rejector_microservice: this.processorMicroservice,
@@ -663,7 +664,7 @@ var EventsConsumeChannel = class extends Consume_default {
663
664
  */
664
665
  nackWithFibonacciStrategy(maxOccurrence = MAX_OCCURRENCE, maxRetries) {
665
666
  const parentNack = super.nackWithFibonacciStrategy(maxOccurrence, maxRetries);
666
- const timestamp = Math.floor(Date.now() / 1e3);
667
+ const timestamp = Date.now();
667
668
  publishAuditEvent(this.channel, "audit.dead_letter", {
668
669
  publisher_microservice: this.publisherMicroservice,
669
670
  rejector_microservice: this.processorMicroservice,
@@ -720,7 +721,7 @@ var eventCallback = (msg, channel, e, queueName) => {
720
721
  }
721
722
  const receiverMicroservice = extractMicroserviceFromQueue(queueName);
722
723
  const receivedEvent = event[0];
723
- const timestamp = Math.floor(Date.now() / 1e3);
724
+ const timestamp = Date.now();
724
725
  let event_id = msg.properties.messageId;
725
726
  if (!event_id) {
726
727
  console.warn("Message is missing messageId, generating a new UUID v7 for event_id");
@@ -1165,7 +1166,7 @@ var publishEvent = async (msg, event) => {
1165
1166
  messageId,
1166
1167
  appId: publisherMicroservice
1167
1168
  });
1168
- const timestamp = Math.floor(Date.now() / 1e3);
1169
+ const timestamp = Date.now();
1169
1170
  publishAuditEvent(channel, "audit.published", {
1170
1171
  publisher_microservice: publisherMicroservice,
1171
1172
  published_event: event,
package/dist/index.mjs CHANGED
@@ -125,6 +125,7 @@ var microserviceEvent = {
125
125
  "LEGEND_RANKINGS.RANKINGS_FINISHED": "legend_rankings.rankings_finished",
126
126
  "LEGEND_RANKINGS.NEW_RANKING_CREATED": "legend_rankings.new_ranking_created",
127
127
  "LEGEND_RANKINGS.INTERMEDIATE_REWARD": "legend_rankings.intermediate_reward",
128
+ "LEGEND_RANKINGS.PARTICIPATION_REWARD": "legend_rankings.participation_reward",
128
129
  "LEGEND_SHOWCASE.PRODUCT_VIRTUAL_DELETED": "legend_showcase.product_virtual_deleted",
129
130
  "LEGEND_SHOWCASE.UPDATE_ALLOWED_MISSION_SUBSCRIPTION_IDS": "legend_showcase.update_allowed_mission_subscription_ids",
130
131
  "LEGEND_SHOWCASE.UPDATE_ALLOWED_RANKING_SUBSCRIPTION_IDS": "legend_showcase.update_allowed_ranking_subscription_ids",
@@ -617,7 +618,7 @@ var EventsConsumeChannel = class extends Consume_default {
617
618
  */
618
619
  ackMessage() {
619
620
  this.channel.ack(this.msg, false);
620
- const timestamp = Math.floor(Date.now() / 1e3);
621
+ const timestamp = Date.now();
621
622
  publishAuditEvent(this.channel, "audit.processed", {
622
623
  publisher_microservice: this.publisherMicroservice,
623
624
  processor_microservice: this.processorMicroservice,
@@ -635,7 +636,7 @@ var EventsConsumeChannel = class extends Consume_default {
635
636
  */
636
637
  nackWithDelay(delay = NACKING_DELAY_MS, maxRetries) {
637
638
  const parentNack = super.nackWithDelay(delay, maxRetries);
638
- const timestamp = Math.floor(Date.now() / 1e3);
639
+ const timestamp = Date.now();
639
640
  publishAuditEvent(this.channel, "audit.dead_letter", {
640
641
  publisher_microservice: this.publisherMicroservice,
641
642
  rejector_microservice: this.processorMicroservice,
@@ -656,7 +657,7 @@ var EventsConsumeChannel = class extends Consume_default {
656
657
  */
657
658
  nackWithFibonacciStrategy(maxOccurrence = MAX_OCCURRENCE, maxRetries) {
658
659
  const parentNack = super.nackWithFibonacciStrategy(maxOccurrence, maxRetries);
659
- const timestamp = Math.floor(Date.now() / 1e3);
660
+ const timestamp = Date.now();
660
661
  publishAuditEvent(this.channel, "audit.dead_letter", {
661
662
  publisher_microservice: this.publisherMicroservice,
662
663
  rejector_microservice: this.processorMicroservice,
@@ -713,7 +714,7 @@ var eventCallback = (msg, channel, e, queueName) => {
713
714
  }
714
715
  const receiverMicroservice = extractMicroserviceFromQueue(queueName);
715
716
  const receivedEvent = event[0];
716
- const timestamp = Math.floor(Date.now() / 1e3);
717
+ const timestamp = Date.now();
717
718
  let event_id = msg.properties.messageId;
718
719
  if (!event_id) {
719
720
  console.warn("Message is missing messageId, generating a new UUID v7 for event_id");
@@ -1158,7 +1159,7 @@ var publishEvent = async (msg, event) => {
1158
1159
  messageId,
1159
1160
  appId: publisherMicroservice
1160
1161
  });
1161
- const timestamp = Math.floor(Date.now() / 1e3);
1162
+ const timestamp = Date.now();
1162
1163
  publishAuditEvent(channel, "audit.published", {
1163
1164
  publisher_microservice: publisherMicroservice,
1164
1165
  published_event: event,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "legend-transactional",
3
- "version": "2.4.0",
3
+ "version": "2.5.0",
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",