legend-transactional 2.6.1 → 2.6.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
@@ -16,10 +16,21 @@ declare const availableMicroservices: {
16
16
  * Represents the "Mint" test microservice.
17
17
  */
18
18
  readonly TestMint: "test-mint";
19
+ /**
20
+ * Represents the "audit-eda" microservice for event-driven architecture auditing.
21
+ * This microservice consumes audit events (audit.received, audit.processed, audit.dead_letter)
22
+ * to track event lifecycle and debugging purposes.
23
+ */
24
+ readonly AuditEda: "audit-eda";
19
25
  /**
20
26
  * Represents the "auth" microservice.
21
27
  */
22
28
  readonly Auth: "auth";
29
+ /**
30
+ * Represents the "legend-billing" microservice.
31
+ * Handles payment processing, subscriptions, and billing domain events.
32
+ */
33
+ readonly Billing: "billing";
23
34
  /**
24
35
  * Represents the "blockchain" microservice.
25
36
  */
@@ -32,6 +43,10 @@ declare const availableMicroservices: {
32
43
  * Represents the "rankings" microservice.
33
44
  */
34
45
  readonly Rankings: "rankings";
46
+ /**
47
+ * Represents the "legend-events" microservice.
48
+ */
49
+ readonly Events: "legend-events";
35
50
  /**
36
51
  * Represents the "transactional" microservice.
37
52
  */
@@ -52,30 +67,12 @@ declare const availableMicroservices: {
52
67
  * Represents the "legend-storage" microservice.
53
68
  */
54
69
  readonly Storage: "legend-storage";
55
- /**
56
- * Represents the "audit-eda" microservice for event-driven architecture auditing.
57
- * This microservice consumes audit events (audit.received, audit.processed, audit.dead_letter)
58
- * to track event lifecycle and debugging purposes.
59
- */
60
- readonly AuditEda: "audit-eda";
61
70
  };
62
71
  /**
63
72
  * Type of available microservices in the system.
64
73
  */
65
74
  type AvailableMicroservices = (typeof availableMicroservices)[keyof typeof availableMicroservices];
66
75
 
67
- /**
68
- * Types of Payment Email Types
69
- */
70
- declare const PaymentEmailTypes: {
71
- readonly PURCHASE: "purchase";
72
- readonly SUBSCRIPTION: "subscription";
73
- readonly NEW_SUBSCRIPTION: "new_subscription";
74
- };
75
- /**
76
- * Type of Payment Email Types
77
- */
78
- type PaymentEmailType = (typeof PaymentEmailTypes)[keyof typeof PaymentEmailTypes];
79
76
  /**
80
77
  * Represents the winners of a ranking with their respective rewards
81
78
  */
@@ -481,6 +478,223 @@ interface EventPayload {
481
478
  */
482
479
  event_id: string;
483
480
  };
481
+ /**
482
+ * Payment has been created and is pending
483
+ */
484
+ 'billing.payment_created': {
485
+ paymentId: string;
486
+ userId: string;
487
+ amount: number;
488
+ currency: string;
489
+ status: 'pending' | 'processing';
490
+ metadata: Record<string, string>;
491
+ occurredAt: string;
492
+ };
493
+ /**
494
+ * Payment completed successfully
495
+ */
496
+ 'billing.payment_succeeded': {
497
+ paymentId: string;
498
+ userId: string;
499
+ amount: number;
500
+ currency: string;
501
+ metadata: Record<string, string>;
502
+ occurredAt: string;
503
+ };
504
+ /**
505
+ * Payment failed
506
+ */
507
+ 'billing.payment_failed': {
508
+ paymentId: string;
509
+ userId: string;
510
+ amount: number;
511
+ currency: string;
512
+ failureReason: string | null;
513
+ metadata: Record<string, string>;
514
+ occurredAt: string;
515
+ };
516
+ /**
517
+ * Payment was refunded (fully or partially)
518
+ */
519
+ 'billing.payment_refunded': {
520
+ paymentId: string;
521
+ userId: string;
522
+ amount: number;
523
+ refundedAmount: number;
524
+ currency: string;
525
+ metadata: Record<string, string>;
526
+ occurredAt: string;
527
+ };
528
+ /**
529
+ * New subscription created
530
+ */
531
+ 'billing.subscription_created': {
532
+ subscriptionId: string;
533
+ userId: string;
534
+ planId: string;
535
+ planSlug: string;
536
+ status: 'pending' | 'active' | 'trialing';
537
+ periodStart: string;
538
+ periodEnd: string;
539
+ occurredAt: string;
540
+ };
541
+ /**
542
+ * Subscription was updated (plan change, status change, etc.)
543
+ */
544
+ 'billing.subscription_updated': {
545
+ subscriptionId: string;
546
+ userId: string;
547
+ planId: string;
548
+ planSlug: string;
549
+ status: 'active' | 'past_due' | 'unpaid' | 'paused' | 'trialing';
550
+ cancelAtPeriodEnd: boolean;
551
+ periodStart: string;
552
+ periodEnd: string;
553
+ occurredAt: string;
554
+ };
555
+ /**
556
+ * Subscription was renewed (new billing period started)
557
+ */
558
+ 'billing.subscription_renewed': {
559
+ subscriptionId: string;
560
+ userId: string;
561
+ planId: string;
562
+ planSlug: string;
563
+ periodStart: string;
564
+ periodEnd: string;
565
+ occurredAt: string;
566
+ };
567
+ /**
568
+ * Subscription was canceled (still active until period end)
569
+ */
570
+ 'billing.subscription_canceled': {
571
+ subscriptionId: string;
572
+ userId: string;
573
+ planId: string;
574
+ planSlug: string;
575
+ canceledAt: string;
576
+ occurredAt: string;
577
+ };
578
+ /**
579
+ * Subscription has expired (no longer active)
580
+ */
581
+ 'billing.subscription_expired': {
582
+ subscriptionId: string;
583
+ userId: string;
584
+ planId: string;
585
+ planSlug: string;
586
+ expiredAt: string;
587
+ occurredAt: string;
588
+ };
589
+ /**
590
+ * New event created
591
+ */
592
+ 'legend_events.new_event_created': {
593
+ eventId: number;
594
+ title: string;
595
+ description: string;
596
+ authorEmail: string;
597
+ rewardType?: string;
598
+ startDate: string;
599
+ endDate: string;
600
+ maxPlayers?: number;
601
+ ticketPriceUsd?: number;
602
+ isFreeTournament: boolean;
603
+ notificationConfig?: {
604
+ customEmails?: string[];
605
+ templateName: string;
606
+ };
607
+ };
608
+ /**
609
+ * Event has started
610
+ */
611
+ 'legend_events.event_started': {
612
+ eventId: number;
613
+ title: string;
614
+ startedAt: string;
615
+ };
616
+ /**
617
+ * Event has ended
618
+ */
619
+ 'legend_events.event_ended': {
620
+ eventId: number;
621
+ title: string;
622
+ endedAt: string;
623
+ totalParticipants: number;
624
+ };
625
+ /**
626
+ * Player registered for an event (paid or free)
627
+ */
628
+ 'legend_events.player_registered': {
629
+ eventId: number;
630
+ userId: string;
631
+ paymentId?: string;
632
+ amountPaid?: number;
633
+ isFree: boolean;
634
+ registeredAt: string;
635
+ };
636
+ /**
637
+ * Player joined the waitlist (event full)
638
+ */
639
+ 'legend_events.player_joined_waitlist': {
640
+ eventId: number;
641
+ userId: string;
642
+ position: number;
643
+ joinedAt: string;
644
+ };
645
+ /**
646
+ * Score submitted for an event
647
+ */
648
+ 'legend_events.score_submitted': {
649
+ eventId: number;
650
+ userId: string;
651
+ score: number;
652
+ totalScore: number;
653
+ matchId?: string;
654
+ submittedAt: string;
655
+ };
656
+ /**
657
+ * Events have finished, send emails to winners
658
+ */
659
+ 'legend_events.events_finished': {
660
+ completedEvents: Array<{
661
+ eventId: number;
662
+ title: string;
663
+ description: string;
664
+ authorEmail: string;
665
+ endsAt: string;
666
+ reward?: string;
667
+ rewardType?: string;
668
+ winners: Array<{
669
+ userId: string;
670
+ position: number;
671
+ score: number;
672
+ }>;
673
+ notificationConfig?: Record<string, unknown>;
674
+ }>;
675
+ };
676
+ /**
677
+ * Intermediate reward delivered during event
678
+ */
679
+ 'legend_events.intermediate_reward': {
680
+ userId: string;
681
+ eventId: number;
682
+ intermediateRewardType: string;
683
+ rewardConfig: Record<string, unknown>;
684
+ templateName: string;
685
+ templateData: Record<string, unknown>;
686
+ };
687
+ /**
688
+ * Participation reward delivered post-event
689
+ */
690
+ 'legend_events.participation_reward': {
691
+ userId: string;
692
+ eventId: number;
693
+ participationRewardType: string;
694
+ rewardConfig: Record<string, unknown>;
695
+ templateName: string;
696
+ templateData: Record<string, unknown>;
697
+ };
484
698
  }
485
699
  /**
486
700
  * Represents the available events in the system.
@@ -513,6 +727,24 @@ declare const microserviceEvent: {
513
727
  readonly 'SOCIAL.NEW_USER': "social.new_user";
514
728
  readonly 'SOCIAL.UNBLOCK_CHAT': "social.unblock_chat";
515
729
  readonly 'SOCIAL.UPDATED_USER': "social.updated_user";
730
+ readonly 'BILLING.PAYMENT_CREATED': "billing.payment_created";
731
+ readonly 'BILLING.PAYMENT_SUCCEEDED': "billing.payment_succeeded";
732
+ readonly 'BILLING.PAYMENT_FAILED': "billing.payment_failed";
733
+ readonly 'BILLING.PAYMENT_REFUNDED': "billing.payment_refunded";
734
+ readonly 'BILLING.SUBSCRIPTION_CREATED': "billing.subscription_created";
735
+ readonly 'BILLING.SUBSCRIPTION_UPDATED': "billing.subscription_updated";
736
+ readonly 'BILLING.SUBSCRIPTION_RENEWED': "billing.subscription_renewed";
737
+ readonly 'BILLING.SUBSCRIPTION_CANCELED': "billing.subscription_canceled";
738
+ readonly 'BILLING.SUBSCRIPTION_EXPIRED': "billing.subscription_expired";
739
+ readonly 'LEGEND_EVENTS.NEW_EVENT_CREATED': "legend_events.new_event_created";
740
+ readonly 'LEGEND_EVENTS.EVENT_STARTED': "legend_events.event_started";
741
+ readonly 'LEGEND_EVENTS.EVENT_ENDED': "legend_events.event_ended";
742
+ readonly 'LEGEND_EVENTS.PLAYER_REGISTERED': "legend_events.player_registered";
743
+ readonly 'LEGEND_EVENTS.PLAYER_JOINED_WAITLIST': "legend_events.player_joined_waitlist";
744
+ readonly 'LEGEND_EVENTS.SCORE_SUBMITTED': "legend_events.score_submitted";
745
+ readonly 'LEGEND_EVENTS.EVENTS_FINISHED': "legend_events.events_finished";
746
+ readonly 'LEGEND_EVENTS.INTERMEDIATE_REWARD': "legend_events.intermediate_reward";
747
+ readonly 'LEGEND_EVENTS.PARTICIPATION_REWARD': "legend_events.participation_reward";
516
748
  };
517
749
  /**
518
750
  * Available microservices events in the system.
@@ -926,6 +1158,24 @@ declare const transactionalCommands: {};
926
1158
  */
927
1159
  type TransactionalCommands = (typeof transactionalCommands)[keyof typeof transactionalCommands];
928
1160
 
1161
+ /**
1162
+ * Different commands related to the "billing" microservice.
1163
+ */
1164
+ declare const billingCommands: {};
1165
+ /**
1166
+ * Available commands for the "billing" microservice.
1167
+ */
1168
+ type BillingCommands = (typeof billingCommands)[keyof typeof billingCommands];
1169
+
1170
+ /**
1171
+ * Different commands related to the "legend-events" microservice.
1172
+ */
1173
+ declare const legendEventsCommands: {};
1174
+ /**
1175
+ * Available commands for the "legend-events" microservice.
1176
+ */
1177
+ type LegendEventsCommands = (typeof legendEventsCommands)[keyof typeof legendEventsCommands];
1178
+
929
1179
  /**
930
1180
  * A map that defines the relationship between microservices and their corresponding commands.
931
1181
  */
@@ -948,6 +1198,10 @@ interface CommandMap {
948
1198
  * Represents the mapping of "audit-eda" microservice commands.
949
1199
  */
950
1200
  [availableMicroservices.AuditEda]: AuditEdaCommands;
1201
+ /**
1202
+ * Represents the mapping of "legend-billing" microservice commands.
1203
+ */
1204
+ [availableMicroservices.Billing]: BillingCommands;
951
1205
  /**
952
1206
  * Represents the mapping of "blockchain" microservice commands.
953
1207
  */
@@ -980,6 +1234,10 @@ interface CommandMap {
980
1234
  * Represents the mapping of "transactional" microservice commands.
981
1235
  */
982
1236
  [availableMicroservices.Transactional]: TransactionalCommands;
1237
+ /**
1238
+ * Represents the mapping of "legend-events" microservice commands.
1239
+ */
1240
+ [availableMicroservices.Events]: LegendEventsCommands;
983
1241
  }
984
1242
  /**
985
1243
  * Represents a command specific to a microservice.
@@ -1639,4 +1897,4 @@ declare const getEventObject: (event: MicroserviceEvent) => {
1639
1897
  */
1640
1898
  declare function extractMicroserviceFromQueue(queueName: string): string;
1641
1899
 
1642
- export { type AuditEdaCommands, type AuthCommands, type AvailableMicroservices, type BlockchainCommands, type CommandMap, type CommenceSaga, type CommenceSagaEvents, type CommenceSagaHandler, type CompletedRanking, type EventPayload, EventsConsumeChannel, type EventsHandler, type Exchange, type Gender, MAX_NACK_RETRIES, MAX_OCCURRENCE, type MicroserviceCommand, MicroserviceConsumeChannel, type MicroserviceConsumeEvents, type MicroserviceConsumeSagaEvents, type MicroserviceEvent, type MicroserviceHandler, NACKING_DELAY_MS, type Nack, type PaymentEmailType, PaymentEmailTypes, type QueueConsumerProps, type RankingWinners, type RankingsCommands, Saga, SagaCommenceConsumeChannel, type SagaCommencePayload, SagaConsumeChannel, type SagaConsumeSagaEvents, type SagaHandler, type SagaStep, type SagaStepDefaults, type SagaTitle, type SendEmailCommands, type ShowcaseCommands, type SocialCommands, type SocialUser, type Status, type StorageCommands, type TestImageCommands, type TestMintCommands, Transactional, type TransactionalCommands, type TransactionalConfig, type UserLocation, auditEdaCommands, authCommands, availableMicroservices, blockchainCommands, closeConsumeChannel, closeRabbitMQConn, closeSendChannel, commenceSaga, commenceSagaConsumeCallback, consume, createAuditLoggingResources, createConsumers, createHeaderConsumers, eventCallback, exchange, extractMicroserviceFromQueue, fibonacci, gender, getConsumeChannel, getEventKey, getEventObject, getQueueConsumer, getQueueName, getRabbitMQConn, getSendChannel, getStoredConfig, isConnectionHealthy, microserviceEvent, nodeDataDefaults, publishEvent, queue, rankingsCommands, sagaConsumeCallback, sagaStepCallback, sagaTitle, saveQueueForHealthCheck, sendEmailCommands, sendToQueue, showcaseCommands, socialCommands, status, stopRabbitMQ, storageCommands, testImageCommands, testMintCommands, transactionalCommands };
1900
+ export { type AuditEdaCommands, type AuthCommands, type AvailableMicroservices, type BlockchainCommands, type CommandMap, type CommenceSaga, type CommenceSagaEvents, type CommenceSagaHandler, type CompletedRanking, type EventPayload, EventsConsumeChannel, type EventsHandler, type Exchange, type Gender, MAX_NACK_RETRIES, MAX_OCCURRENCE, type MicroserviceCommand, MicroserviceConsumeChannel, type MicroserviceConsumeEvents, type MicroserviceConsumeSagaEvents, type MicroserviceEvent, type MicroserviceHandler, NACKING_DELAY_MS, type Nack, type QueueConsumerProps, type RankingWinners, type RankingsCommands, Saga, SagaCommenceConsumeChannel, type SagaCommencePayload, SagaConsumeChannel, type SagaConsumeSagaEvents, type SagaHandler, type SagaStep, type SagaStepDefaults, type SagaTitle, type SendEmailCommands, type ShowcaseCommands, type SocialCommands, type SocialUser, type Status, type StorageCommands, type TestImageCommands, type TestMintCommands, Transactional, type TransactionalCommands, type TransactionalConfig, type UserLocation, auditEdaCommands, authCommands, availableMicroservices, blockchainCommands, closeConsumeChannel, closeRabbitMQConn, closeSendChannel, commenceSaga, commenceSagaConsumeCallback, consume, createAuditLoggingResources, createConsumers, createHeaderConsumers, eventCallback, exchange, extractMicroserviceFromQueue, fibonacci, gender, getConsumeChannel, getEventKey, getEventObject, getQueueConsumer, getQueueName, getRabbitMQConn, getSendChannel, getStoredConfig, isConnectionHealthy, microserviceEvent, nodeDataDefaults, publishEvent, queue, rankingsCommands, sagaConsumeCallback, sagaStepCallback, sagaTitle, saveQueueForHealthCheck, sendEmailCommands, sendToQueue, showcaseCommands, socialCommands, status, stopRabbitMQ, storageCommands, testImageCommands, testMintCommands, transactionalCommands };
package/dist/index.d.ts CHANGED
@@ -16,10 +16,21 @@ declare const availableMicroservices: {
16
16
  * Represents the "Mint" test microservice.
17
17
  */
18
18
  readonly TestMint: "test-mint";
19
+ /**
20
+ * Represents the "audit-eda" microservice for event-driven architecture auditing.
21
+ * This microservice consumes audit events (audit.received, audit.processed, audit.dead_letter)
22
+ * to track event lifecycle and debugging purposes.
23
+ */
24
+ readonly AuditEda: "audit-eda";
19
25
  /**
20
26
  * Represents the "auth" microservice.
21
27
  */
22
28
  readonly Auth: "auth";
29
+ /**
30
+ * Represents the "legend-billing" microservice.
31
+ * Handles payment processing, subscriptions, and billing domain events.
32
+ */
33
+ readonly Billing: "billing";
23
34
  /**
24
35
  * Represents the "blockchain" microservice.
25
36
  */
@@ -32,6 +43,10 @@ declare const availableMicroservices: {
32
43
  * Represents the "rankings" microservice.
33
44
  */
34
45
  readonly Rankings: "rankings";
46
+ /**
47
+ * Represents the "legend-events" microservice.
48
+ */
49
+ readonly Events: "legend-events";
35
50
  /**
36
51
  * Represents the "transactional" microservice.
37
52
  */
@@ -52,30 +67,12 @@ declare const availableMicroservices: {
52
67
  * Represents the "legend-storage" microservice.
53
68
  */
54
69
  readonly Storage: "legend-storage";
55
- /**
56
- * Represents the "audit-eda" microservice for event-driven architecture auditing.
57
- * This microservice consumes audit events (audit.received, audit.processed, audit.dead_letter)
58
- * to track event lifecycle and debugging purposes.
59
- */
60
- readonly AuditEda: "audit-eda";
61
70
  };
62
71
  /**
63
72
  * Type of available microservices in the system.
64
73
  */
65
74
  type AvailableMicroservices = (typeof availableMicroservices)[keyof typeof availableMicroservices];
66
75
 
67
- /**
68
- * Types of Payment Email Types
69
- */
70
- declare const PaymentEmailTypes: {
71
- readonly PURCHASE: "purchase";
72
- readonly SUBSCRIPTION: "subscription";
73
- readonly NEW_SUBSCRIPTION: "new_subscription";
74
- };
75
- /**
76
- * Type of Payment Email Types
77
- */
78
- type PaymentEmailType = (typeof PaymentEmailTypes)[keyof typeof PaymentEmailTypes];
79
76
  /**
80
77
  * Represents the winners of a ranking with their respective rewards
81
78
  */
@@ -481,6 +478,223 @@ interface EventPayload {
481
478
  */
482
479
  event_id: string;
483
480
  };
481
+ /**
482
+ * Payment has been created and is pending
483
+ */
484
+ 'billing.payment_created': {
485
+ paymentId: string;
486
+ userId: string;
487
+ amount: number;
488
+ currency: string;
489
+ status: 'pending' | 'processing';
490
+ metadata: Record<string, string>;
491
+ occurredAt: string;
492
+ };
493
+ /**
494
+ * Payment completed successfully
495
+ */
496
+ 'billing.payment_succeeded': {
497
+ paymentId: string;
498
+ userId: string;
499
+ amount: number;
500
+ currency: string;
501
+ metadata: Record<string, string>;
502
+ occurredAt: string;
503
+ };
504
+ /**
505
+ * Payment failed
506
+ */
507
+ 'billing.payment_failed': {
508
+ paymentId: string;
509
+ userId: string;
510
+ amount: number;
511
+ currency: string;
512
+ failureReason: string | null;
513
+ metadata: Record<string, string>;
514
+ occurredAt: string;
515
+ };
516
+ /**
517
+ * Payment was refunded (fully or partially)
518
+ */
519
+ 'billing.payment_refunded': {
520
+ paymentId: string;
521
+ userId: string;
522
+ amount: number;
523
+ refundedAmount: number;
524
+ currency: string;
525
+ metadata: Record<string, string>;
526
+ occurredAt: string;
527
+ };
528
+ /**
529
+ * New subscription created
530
+ */
531
+ 'billing.subscription_created': {
532
+ subscriptionId: string;
533
+ userId: string;
534
+ planId: string;
535
+ planSlug: string;
536
+ status: 'pending' | 'active' | 'trialing';
537
+ periodStart: string;
538
+ periodEnd: string;
539
+ occurredAt: string;
540
+ };
541
+ /**
542
+ * Subscription was updated (plan change, status change, etc.)
543
+ */
544
+ 'billing.subscription_updated': {
545
+ subscriptionId: string;
546
+ userId: string;
547
+ planId: string;
548
+ planSlug: string;
549
+ status: 'active' | 'past_due' | 'unpaid' | 'paused' | 'trialing';
550
+ cancelAtPeriodEnd: boolean;
551
+ periodStart: string;
552
+ periodEnd: string;
553
+ occurredAt: string;
554
+ };
555
+ /**
556
+ * Subscription was renewed (new billing period started)
557
+ */
558
+ 'billing.subscription_renewed': {
559
+ subscriptionId: string;
560
+ userId: string;
561
+ planId: string;
562
+ planSlug: string;
563
+ periodStart: string;
564
+ periodEnd: string;
565
+ occurredAt: string;
566
+ };
567
+ /**
568
+ * Subscription was canceled (still active until period end)
569
+ */
570
+ 'billing.subscription_canceled': {
571
+ subscriptionId: string;
572
+ userId: string;
573
+ planId: string;
574
+ planSlug: string;
575
+ canceledAt: string;
576
+ occurredAt: string;
577
+ };
578
+ /**
579
+ * Subscription has expired (no longer active)
580
+ */
581
+ 'billing.subscription_expired': {
582
+ subscriptionId: string;
583
+ userId: string;
584
+ planId: string;
585
+ planSlug: string;
586
+ expiredAt: string;
587
+ occurredAt: string;
588
+ };
589
+ /**
590
+ * New event created
591
+ */
592
+ 'legend_events.new_event_created': {
593
+ eventId: number;
594
+ title: string;
595
+ description: string;
596
+ authorEmail: string;
597
+ rewardType?: string;
598
+ startDate: string;
599
+ endDate: string;
600
+ maxPlayers?: number;
601
+ ticketPriceUsd?: number;
602
+ isFreeTournament: boolean;
603
+ notificationConfig?: {
604
+ customEmails?: string[];
605
+ templateName: string;
606
+ };
607
+ };
608
+ /**
609
+ * Event has started
610
+ */
611
+ 'legend_events.event_started': {
612
+ eventId: number;
613
+ title: string;
614
+ startedAt: string;
615
+ };
616
+ /**
617
+ * Event has ended
618
+ */
619
+ 'legend_events.event_ended': {
620
+ eventId: number;
621
+ title: string;
622
+ endedAt: string;
623
+ totalParticipants: number;
624
+ };
625
+ /**
626
+ * Player registered for an event (paid or free)
627
+ */
628
+ 'legend_events.player_registered': {
629
+ eventId: number;
630
+ userId: string;
631
+ paymentId?: string;
632
+ amountPaid?: number;
633
+ isFree: boolean;
634
+ registeredAt: string;
635
+ };
636
+ /**
637
+ * Player joined the waitlist (event full)
638
+ */
639
+ 'legend_events.player_joined_waitlist': {
640
+ eventId: number;
641
+ userId: string;
642
+ position: number;
643
+ joinedAt: string;
644
+ };
645
+ /**
646
+ * Score submitted for an event
647
+ */
648
+ 'legend_events.score_submitted': {
649
+ eventId: number;
650
+ userId: string;
651
+ score: number;
652
+ totalScore: number;
653
+ matchId?: string;
654
+ submittedAt: string;
655
+ };
656
+ /**
657
+ * Events have finished, send emails to winners
658
+ */
659
+ 'legend_events.events_finished': {
660
+ completedEvents: Array<{
661
+ eventId: number;
662
+ title: string;
663
+ description: string;
664
+ authorEmail: string;
665
+ endsAt: string;
666
+ reward?: string;
667
+ rewardType?: string;
668
+ winners: Array<{
669
+ userId: string;
670
+ position: number;
671
+ score: number;
672
+ }>;
673
+ notificationConfig?: Record<string, unknown>;
674
+ }>;
675
+ };
676
+ /**
677
+ * Intermediate reward delivered during event
678
+ */
679
+ 'legend_events.intermediate_reward': {
680
+ userId: string;
681
+ eventId: number;
682
+ intermediateRewardType: string;
683
+ rewardConfig: Record<string, unknown>;
684
+ templateName: string;
685
+ templateData: Record<string, unknown>;
686
+ };
687
+ /**
688
+ * Participation reward delivered post-event
689
+ */
690
+ 'legend_events.participation_reward': {
691
+ userId: string;
692
+ eventId: number;
693
+ participationRewardType: string;
694
+ rewardConfig: Record<string, unknown>;
695
+ templateName: string;
696
+ templateData: Record<string, unknown>;
697
+ };
484
698
  }
485
699
  /**
486
700
  * Represents the available events in the system.
@@ -513,6 +727,24 @@ declare const microserviceEvent: {
513
727
  readonly 'SOCIAL.NEW_USER': "social.new_user";
514
728
  readonly 'SOCIAL.UNBLOCK_CHAT': "social.unblock_chat";
515
729
  readonly 'SOCIAL.UPDATED_USER': "social.updated_user";
730
+ readonly 'BILLING.PAYMENT_CREATED': "billing.payment_created";
731
+ readonly 'BILLING.PAYMENT_SUCCEEDED': "billing.payment_succeeded";
732
+ readonly 'BILLING.PAYMENT_FAILED': "billing.payment_failed";
733
+ readonly 'BILLING.PAYMENT_REFUNDED': "billing.payment_refunded";
734
+ readonly 'BILLING.SUBSCRIPTION_CREATED': "billing.subscription_created";
735
+ readonly 'BILLING.SUBSCRIPTION_UPDATED': "billing.subscription_updated";
736
+ readonly 'BILLING.SUBSCRIPTION_RENEWED': "billing.subscription_renewed";
737
+ readonly 'BILLING.SUBSCRIPTION_CANCELED': "billing.subscription_canceled";
738
+ readonly 'BILLING.SUBSCRIPTION_EXPIRED': "billing.subscription_expired";
739
+ readonly 'LEGEND_EVENTS.NEW_EVENT_CREATED': "legend_events.new_event_created";
740
+ readonly 'LEGEND_EVENTS.EVENT_STARTED': "legend_events.event_started";
741
+ readonly 'LEGEND_EVENTS.EVENT_ENDED': "legend_events.event_ended";
742
+ readonly 'LEGEND_EVENTS.PLAYER_REGISTERED': "legend_events.player_registered";
743
+ readonly 'LEGEND_EVENTS.PLAYER_JOINED_WAITLIST': "legend_events.player_joined_waitlist";
744
+ readonly 'LEGEND_EVENTS.SCORE_SUBMITTED': "legend_events.score_submitted";
745
+ readonly 'LEGEND_EVENTS.EVENTS_FINISHED': "legend_events.events_finished";
746
+ readonly 'LEGEND_EVENTS.INTERMEDIATE_REWARD': "legend_events.intermediate_reward";
747
+ readonly 'LEGEND_EVENTS.PARTICIPATION_REWARD': "legend_events.participation_reward";
516
748
  };
517
749
  /**
518
750
  * Available microservices events in the system.
@@ -926,6 +1158,24 @@ declare const transactionalCommands: {};
926
1158
  */
927
1159
  type TransactionalCommands = (typeof transactionalCommands)[keyof typeof transactionalCommands];
928
1160
 
1161
+ /**
1162
+ * Different commands related to the "billing" microservice.
1163
+ */
1164
+ declare const billingCommands: {};
1165
+ /**
1166
+ * Available commands for the "billing" microservice.
1167
+ */
1168
+ type BillingCommands = (typeof billingCommands)[keyof typeof billingCommands];
1169
+
1170
+ /**
1171
+ * Different commands related to the "legend-events" microservice.
1172
+ */
1173
+ declare const legendEventsCommands: {};
1174
+ /**
1175
+ * Available commands for the "legend-events" microservice.
1176
+ */
1177
+ type LegendEventsCommands = (typeof legendEventsCommands)[keyof typeof legendEventsCommands];
1178
+
929
1179
  /**
930
1180
  * A map that defines the relationship between microservices and their corresponding commands.
931
1181
  */
@@ -948,6 +1198,10 @@ interface CommandMap {
948
1198
  * Represents the mapping of "audit-eda" microservice commands.
949
1199
  */
950
1200
  [availableMicroservices.AuditEda]: AuditEdaCommands;
1201
+ /**
1202
+ * Represents the mapping of "legend-billing" microservice commands.
1203
+ */
1204
+ [availableMicroservices.Billing]: BillingCommands;
951
1205
  /**
952
1206
  * Represents the mapping of "blockchain" microservice commands.
953
1207
  */
@@ -980,6 +1234,10 @@ interface CommandMap {
980
1234
  * Represents the mapping of "transactional" microservice commands.
981
1235
  */
982
1236
  [availableMicroservices.Transactional]: TransactionalCommands;
1237
+ /**
1238
+ * Represents the mapping of "legend-events" microservice commands.
1239
+ */
1240
+ [availableMicroservices.Events]: LegendEventsCommands;
983
1241
  }
984
1242
  /**
985
1243
  * Represents a command specific to a microservice.
@@ -1639,4 +1897,4 @@ declare const getEventObject: (event: MicroserviceEvent) => {
1639
1897
  */
1640
1898
  declare function extractMicroserviceFromQueue(queueName: string): string;
1641
1899
 
1642
- export { type AuditEdaCommands, type AuthCommands, type AvailableMicroservices, type BlockchainCommands, type CommandMap, type CommenceSaga, type CommenceSagaEvents, type CommenceSagaHandler, type CompletedRanking, type EventPayload, EventsConsumeChannel, type EventsHandler, type Exchange, type Gender, MAX_NACK_RETRIES, MAX_OCCURRENCE, type MicroserviceCommand, MicroserviceConsumeChannel, type MicroserviceConsumeEvents, type MicroserviceConsumeSagaEvents, type MicroserviceEvent, type MicroserviceHandler, NACKING_DELAY_MS, type Nack, type PaymentEmailType, PaymentEmailTypes, type QueueConsumerProps, type RankingWinners, type RankingsCommands, Saga, SagaCommenceConsumeChannel, type SagaCommencePayload, SagaConsumeChannel, type SagaConsumeSagaEvents, type SagaHandler, type SagaStep, type SagaStepDefaults, type SagaTitle, type SendEmailCommands, type ShowcaseCommands, type SocialCommands, type SocialUser, type Status, type StorageCommands, type TestImageCommands, type TestMintCommands, Transactional, type TransactionalCommands, type TransactionalConfig, type UserLocation, auditEdaCommands, authCommands, availableMicroservices, blockchainCommands, closeConsumeChannel, closeRabbitMQConn, closeSendChannel, commenceSaga, commenceSagaConsumeCallback, consume, createAuditLoggingResources, createConsumers, createHeaderConsumers, eventCallback, exchange, extractMicroserviceFromQueue, fibonacci, gender, getConsumeChannel, getEventKey, getEventObject, getQueueConsumer, getQueueName, getRabbitMQConn, getSendChannel, getStoredConfig, isConnectionHealthy, microserviceEvent, nodeDataDefaults, publishEvent, queue, rankingsCommands, sagaConsumeCallback, sagaStepCallback, sagaTitle, saveQueueForHealthCheck, sendEmailCommands, sendToQueue, showcaseCommands, socialCommands, status, stopRabbitMQ, storageCommands, testImageCommands, testMintCommands, transactionalCommands };
1900
+ export { type AuditEdaCommands, type AuthCommands, type AvailableMicroservices, type BlockchainCommands, type CommandMap, type CommenceSaga, type CommenceSagaEvents, type CommenceSagaHandler, type CompletedRanking, type EventPayload, EventsConsumeChannel, type EventsHandler, type Exchange, type Gender, MAX_NACK_RETRIES, MAX_OCCURRENCE, type MicroserviceCommand, MicroserviceConsumeChannel, type MicroserviceConsumeEvents, type MicroserviceConsumeSagaEvents, type MicroserviceEvent, type MicroserviceHandler, NACKING_DELAY_MS, type Nack, type QueueConsumerProps, type RankingWinners, type RankingsCommands, Saga, SagaCommenceConsumeChannel, type SagaCommencePayload, SagaConsumeChannel, type SagaConsumeSagaEvents, type SagaHandler, type SagaStep, type SagaStepDefaults, type SagaTitle, type SendEmailCommands, type ShowcaseCommands, type SocialCommands, type SocialUser, type Status, type StorageCommands, type TestImageCommands, type TestMintCommands, Transactional, type TransactionalCommands, type TransactionalConfig, type UserLocation, auditEdaCommands, authCommands, availableMicroservices, blockchainCommands, closeConsumeChannel, closeRabbitMQConn, closeSendChannel, commenceSaga, commenceSagaConsumeCallback, consume, createAuditLoggingResources, createConsumers, createHeaderConsumers, eventCallback, exchange, extractMicroserviceFromQueue, fibonacci, gender, getConsumeChannel, getEventKey, getEventObject, getQueueConsumer, getQueueName, getRabbitMQConn, getSendChannel, getStoredConfig, isConnectionHealthy, microserviceEvent, nodeDataDefaults, publishEvent, queue, rankingsCommands, sagaConsumeCallback, sagaStepCallback, sagaTitle, saveQueueForHealthCheck, sendEmailCommands, sendToQueue, showcaseCommands, socialCommands, status, stopRabbitMQ, storageCommands, testImageCommands, testMintCommands, transactionalCommands };
package/dist/index.js CHANGED
@@ -21,10 +21,21 @@ var availableMicroservices = {
21
21
  * Represents the "Mint" test microservice.
22
22
  */
23
23
  TestMint: "test-mint",
24
+ /**
25
+ * Represents the "audit-eda" microservice for event-driven architecture auditing.
26
+ * This microservice consumes audit events (audit.received, audit.processed, audit.dead_letter)
27
+ * to track event lifecycle and debugging purposes.
28
+ */
29
+ AuditEda: "audit-eda",
24
30
  /**
25
31
  * Represents the "auth" microservice.
26
32
  */
27
33
  Auth: "auth",
34
+ /**
35
+ * Represents the "legend-billing" microservice.
36
+ * Handles payment processing, subscriptions, and billing domain events.
37
+ */
38
+ Billing: "billing",
28
39
  /**
29
40
  * Represents the "blockchain" microservice.
30
41
  */
@@ -37,6 +48,10 @@ var availableMicroservices = {
37
48
  * Represents the "rankings" microservice.
38
49
  */
39
50
  Rankings: "rankings",
51
+ /**
52
+ * Represents the "legend-events" microservice.
53
+ */
54
+ Events: "legend-events",
40
55
  /**
41
56
  * Represents the "transactional" microservice.
42
57
  */
@@ -56,21 +71,10 @@ var availableMicroservices = {
56
71
  /**
57
72
  * Represents the "legend-storage" microservice.
58
73
  */
59
- Storage: "legend-storage",
60
- /**
61
- * Represents the "audit-eda" microservice for event-driven architecture auditing.
62
- * This microservice consumes audit events (audit.received, audit.processed, audit.dead_letter)
63
- * to track event lifecycle and debugging purposes.
64
- */
65
- AuditEda: "audit-eda"
74
+ Storage: "legend-storage"
66
75
  };
67
76
 
68
77
  // src/@types/event/events.ts
69
- var PaymentEmailTypes = {
70
- PURCHASE: "purchase",
71
- SUBSCRIPTION: "subscription",
72
- NEW_SUBSCRIPTION: "new_subscription"
73
- };
74
78
  var gender = {
75
79
  Male: "MALE",
76
80
  Female: "FEMALE",
@@ -106,7 +110,29 @@ var microserviceEvent = {
106
110
  "SOCIAL.BLOCK_CHAT": "social.block_chat",
107
111
  "SOCIAL.NEW_USER": "social.new_user",
108
112
  "SOCIAL.UNBLOCK_CHAT": "social.unblock_chat",
109
- "SOCIAL.UPDATED_USER": "social.updated_user"
113
+ "SOCIAL.UPDATED_USER": "social.updated_user",
114
+ ///////////////////////////
115
+ // BILLING EVENTS
116
+ "BILLING.PAYMENT_CREATED": "billing.payment_created",
117
+ "BILLING.PAYMENT_SUCCEEDED": "billing.payment_succeeded",
118
+ "BILLING.PAYMENT_FAILED": "billing.payment_failed",
119
+ "BILLING.PAYMENT_REFUNDED": "billing.payment_refunded",
120
+ "BILLING.SUBSCRIPTION_CREATED": "billing.subscription_created",
121
+ "BILLING.SUBSCRIPTION_UPDATED": "billing.subscription_updated",
122
+ "BILLING.SUBSCRIPTION_RENEWED": "billing.subscription_renewed",
123
+ "BILLING.SUBSCRIPTION_CANCELED": "billing.subscription_canceled",
124
+ "BILLING.SUBSCRIPTION_EXPIRED": "billing.subscription_expired",
125
+ ///////////////////////////
126
+ // LEGEND EVENTS
127
+ "LEGEND_EVENTS.NEW_EVENT_CREATED": "legend_events.new_event_created",
128
+ "LEGEND_EVENTS.EVENT_STARTED": "legend_events.event_started",
129
+ "LEGEND_EVENTS.EVENT_ENDED": "legend_events.event_ended",
130
+ "LEGEND_EVENTS.PLAYER_REGISTERED": "legend_events.player_registered",
131
+ "LEGEND_EVENTS.PLAYER_JOINED_WAITLIST": "legend_events.player_joined_waitlist",
132
+ "LEGEND_EVENTS.SCORE_SUBMITTED": "legend_events.score_submitted",
133
+ "LEGEND_EVENTS.EVENTS_FINISHED": "legend_events.events_finished",
134
+ "LEGEND_EVENTS.INTERMEDIATE_REWARD": "legend_events.intermediate_reward",
135
+ "LEGEND_EVENTS.PARTICIPATION_REWARD": "legend_events.participation_reward"
110
136
  };
111
137
 
112
138
  // src/@types/rabbit-mq.ts
@@ -1118,7 +1144,6 @@ exports.MAX_NACK_RETRIES = MAX_NACK_RETRIES;
1118
1144
  exports.MAX_OCCURRENCE = MAX_OCCURRENCE;
1119
1145
  exports.MicroserviceConsumeChannel = MicroserviceConsumeChannel;
1120
1146
  exports.NACKING_DELAY_MS = NACKING_DELAY_MS;
1121
- exports.PaymentEmailTypes = PaymentEmailTypes;
1122
1147
  exports.Saga = Saga;
1123
1148
  exports.SagaCommenceConsumeChannel = SagaCommenceConsumeChannel;
1124
1149
  exports.SagaConsumeChannel = SagaConsumeChannel;
package/dist/index.mjs CHANGED
@@ -14,10 +14,21 @@ var availableMicroservices = {
14
14
  * Represents the "Mint" test microservice.
15
15
  */
16
16
  TestMint: "test-mint",
17
+ /**
18
+ * Represents the "audit-eda" microservice for event-driven architecture auditing.
19
+ * This microservice consumes audit events (audit.received, audit.processed, audit.dead_letter)
20
+ * to track event lifecycle and debugging purposes.
21
+ */
22
+ AuditEda: "audit-eda",
17
23
  /**
18
24
  * Represents the "auth" microservice.
19
25
  */
20
26
  Auth: "auth",
27
+ /**
28
+ * Represents the "legend-billing" microservice.
29
+ * Handles payment processing, subscriptions, and billing domain events.
30
+ */
31
+ Billing: "billing",
21
32
  /**
22
33
  * Represents the "blockchain" microservice.
23
34
  */
@@ -30,6 +41,10 @@ var availableMicroservices = {
30
41
  * Represents the "rankings" microservice.
31
42
  */
32
43
  Rankings: "rankings",
44
+ /**
45
+ * Represents the "legend-events" microservice.
46
+ */
47
+ Events: "legend-events",
33
48
  /**
34
49
  * Represents the "transactional" microservice.
35
50
  */
@@ -49,21 +64,10 @@ var availableMicroservices = {
49
64
  /**
50
65
  * Represents the "legend-storage" microservice.
51
66
  */
52
- Storage: "legend-storage",
53
- /**
54
- * Represents the "audit-eda" microservice for event-driven architecture auditing.
55
- * This microservice consumes audit events (audit.received, audit.processed, audit.dead_letter)
56
- * to track event lifecycle and debugging purposes.
57
- */
58
- AuditEda: "audit-eda"
67
+ Storage: "legend-storage"
59
68
  };
60
69
 
61
70
  // src/@types/event/events.ts
62
- var PaymentEmailTypes = {
63
- PURCHASE: "purchase",
64
- SUBSCRIPTION: "subscription",
65
- NEW_SUBSCRIPTION: "new_subscription"
66
- };
67
71
  var gender = {
68
72
  Male: "MALE",
69
73
  Female: "FEMALE",
@@ -99,7 +103,29 @@ var microserviceEvent = {
99
103
  "SOCIAL.BLOCK_CHAT": "social.block_chat",
100
104
  "SOCIAL.NEW_USER": "social.new_user",
101
105
  "SOCIAL.UNBLOCK_CHAT": "social.unblock_chat",
102
- "SOCIAL.UPDATED_USER": "social.updated_user"
106
+ "SOCIAL.UPDATED_USER": "social.updated_user",
107
+ ///////////////////////////
108
+ // BILLING EVENTS
109
+ "BILLING.PAYMENT_CREATED": "billing.payment_created",
110
+ "BILLING.PAYMENT_SUCCEEDED": "billing.payment_succeeded",
111
+ "BILLING.PAYMENT_FAILED": "billing.payment_failed",
112
+ "BILLING.PAYMENT_REFUNDED": "billing.payment_refunded",
113
+ "BILLING.SUBSCRIPTION_CREATED": "billing.subscription_created",
114
+ "BILLING.SUBSCRIPTION_UPDATED": "billing.subscription_updated",
115
+ "BILLING.SUBSCRIPTION_RENEWED": "billing.subscription_renewed",
116
+ "BILLING.SUBSCRIPTION_CANCELED": "billing.subscription_canceled",
117
+ "BILLING.SUBSCRIPTION_EXPIRED": "billing.subscription_expired",
118
+ ///////////////////////////
119
+ // LEGEND EVENTS
120
+ "LEGEND_EVENTS.NEW_EVENT_CREATED": "legend_events.new_event_created",
121
+ "LEGEND_EVENTS.EVENT_STARTED": "legend_events.event_started",
122
+ "LEGEND_EVENTS.EVENT_ENDED": "legend_events.event_ended",
123
+ "LEGEND_EVENTS.PLAYER_REGISTERED": "legend_events.player_registered",
124
+ "LEGEND_EVENTS.PLAYER_JOINED_WAITLIST": "legend_events.player_joined_waitlist",
125
+ "LEGEND_EVENTS.SCORE_SUBMITTED": "legend_events.score_submitted",
126
+ "LEGEND_EVENTS.EVENTS_FINISHED": "legend_events.events_finished",
127
+ "LEGEND_EVENTS.INTERMEDIATE_REWARD": "legend_events.intermediate_reward",
128
+ "LEGEND_EVENTS.PARTICIPATION_REWARD": "legend_events.participation_reward"
103
129
  };
104
130
 
105
131
  // src/@types/rabbit-mq.ts
@@ -1106,4 +1132,4 @@ var publishEvent = async (msg, event) => {
1106
1132
  });
1107
1133
  };
1108
1134
 
1109
- export { EventsConsumeChannel, MAX_NACK_RETRIES, MAX_OCCURRENCE, MicroserviceConsumeChannel, NACKING_DELAY_MS, PaymentEmailTypes, Saga, SagaCommenceConsumeChannel, SagaConsumeChannel, Transactional, auditEdaCommands, authCommands, availableMicroservices, blockchainCommands, closeConsumeChannel, closeRabbitMQConn, closeSendChannel, commenceSaga, commenceSagaConsumeCallback, consume, createAuditLoggingResources, createConsumers, createHeaderConsumers, eventCallback, exchange, extractMicroserviceFromQueue, fibonacci, gender, getConsumeChannel, getEventKey, getEventObject, getQueueConsumer, getQueueName, getRabbitMQConn, getSendChannel, getStoredConfig, isConnectionHealthy, microserviceEvent, nodeDataDefaults, publishEvent, queue, rankingsCommands, sagaConsumeCallback, sagaStepCallback, sagaTitle, saveQueueForHealthCheck, sendEmailCommands, sendToQueue, showcaseCommands, socialCommands, status, stopRabbitMQ, storageCommands, testImageCommands, testMintCommands, transactionalCommands };
1135
+ export { EventsConsumeChannel, MAX_NACK_RETRIES, MAX_OCCURRENCE, MicroserviceConsumeChannel, NACKING_DELAY_MS, Saga, SagaCommenceConsumeChannel, SagaConsumeChannel, Transactional, auditEdaCommands, authCommands, availableMicroservices, blockchainCommands, closeConsumeChannel, closeRabbitMQConn, closeSendChannel, commenceSaga, commenceSagaConsumeCallback, consume, createAuditLoggingResources, createConsumers, createHeaderConsumers, eventCallback, exchange, extractMicroserviceFromQueue, fibonacci, gender, getConsumeChannel, getEventKey, getEventObject, getQueueConsumer, getQueueName, getRabbitMQConn, getSendChannel, getStoredConfig, isConnectionHealthy, microserviceEvent, nodeDataDefaults, publishEvent, queue, rankingsCommands, sagaConsumeCallback, sagaStepCallback, sagaTitle, saveQueueForHealthCheck, sendEmailCommands, sendToQueue, showcaseCommands, socialCommands, status, stopRabbitMQ, storageCommands, testImageCommands, testMintCommands, transactionalCommands };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "legend-transactional",
3
- "version": "2.6.1",
3
+ "version": "2.6.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",