@serve.zone/dcrouter 7.4.3 → 8.0.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.
@@ -67,14 +67,7 @@ export interface ICertificateState {
67
67
  }
68
68
 
69
69
  export interface IEmailOpsState {
70
- currentView: 'queued' | 'sent' | 'failed' | 'received' | 'security';
71
- queuedEmails: interfaces.requests.IEmailQueueItem[];
72
- sentEmails: interfaces.requests.IEmailQueueItem[];
73
- failedEmails: interfaces.requests.IEmailQueueItem[];
74
- securityIncidents: interfaces.requests.ISecurityIncident[];
75
- bounceRecords: interfaces.requests.IBounceRecord[];
76
- suppressionList: string[];
77
- selectedEmailId: string | null;
70
+ emails: interfaces.requests.IEmail[];
78
71
  isLoading: boolean;
79
72
  error: string | null;
80
73
  lastUpdated: number;
@@ -165,14 +158,7 @@ export const networkStatePart = await appState.getStatePart<INetworkState>(
165
158
  export const emailOpsStatePart = await appState.getStatePart<IEmailOpsState>(
166
159
  'emailOps',
167
160
  {
168
- currentView: 'queued',
169
- queuedEmails: [],
170
- sentEmails: [],
171
- failedEmails: [],
172
- securityIncidents: [],
173
- bounceRecords: [],
174
- suppressionList: [],
175
- selectedEmailId: null,
161
+ emails: [],
176
162
  isLoading: false,
177
163
  error: null,
178
164
  lastUpdated: 0,
@@ -492,128 +478,22 @@ export const fetchNetworkStatsAction = networkStatePart.createAction(async (stat
492
478
  // Email Operations Actions
493
479
  // ============================================================================
494
480
 
495
- // Set Email Ops View Action
496
- export const setEmailOpsViewAction = emailOpsStatePart.createAction<IEmailOpsState['currentView']>(
497
- async (statePartArg, view) => {
498
- return {
499
- ...statePartArg.getState(),
500
- currentView: view,
501
- };
502
- }
503
- );
504
-
505
- // Fetch Queued Emails Action
506
- export const fetchQueuedEmailsAction = emailOpsStatePart.createAction(async (statePartArg) => {
507
- const context = getActionContext();
508
- const currentState = statePartArg.getState();
509
-
510
- try {
511
- const request = new plugins.domtools.plugins.typedrequest.TypedRequest<
512
- interfaces.requests.IReq_GetQueuedEmails
513
- >('/typedrequest', 'getQueuedEmails');
514
-
515
- const response = await request.fire({
516
- identity: context.identity,
517
- status: 'pending',
518
- limit: 100,
519
- });
520
-
521
- return {
522
- ...currentState,
523
- queuedEmails: response.items,
524
- isLoading: false,
525
- error: null,
526
- lastUpdated: Date.now(),
527
- };
528
- } catch (error) {
529
- return {
530
- ...currentState,
531
- isLoading: false,
532
- error: error instanceof Error ? error.message : 'Failed to fetch queued emails',
533
- };
534
- }
535
- });
536
-
537
- // Fetch Sent Emails Action
538
- export const fetchSentEmailsAction = emailOpsStatePart.createAction(async (statePartArg) => {
539
- const context = getActionContext();
540
- const currentState = statePartArg.getState();
541
-
542
- try {
543
- const request = new plugins.domtools.plugins.typedrequest.TypedRequest<
544
- interfaces.requests.IReq_GetSentEmails
545
- >('/typedrequest', 'getSentEmails');
546
-
547
- const response = await request.fire({
548
- identity: context.identity,
549
- limit: 100,
550
- });
551
-
552
- return {
553
- ...currentState,
554
- sentEmails: response.items,
555
- isLoading: false,
556
- error: null,
557
- lastUpdated: Date.now(),
558
- };
559
- } catch (error) {
560
- return {
561
- ...currentState,
562
- isLoading: false,
563
- error: error instanceof Error ? error.message : 'Failed to fetch sent emails',
564
- };
565
- }
566
- });
567
-
568
- // Fetch Failed Emails Action
569
- export const fetchFailedEmailsAction = emailOpsStatePart.createAction(async (statePartArg) => {
570
- const context = getActionContext();
571
- const currentState = statePartArg.getState();
572
-
573
- try {
574
- const request = new plugins.domtools.plugins.typedrequest.TypedRequest<
575
- interfaces.requests.IReq_GetFailedEmails
576
- >('/typedrequest', 'getFailedEmails');
577
-
578
- const response = await request.fire({
579
- identity: context.identity,
580
- limit: 100,
581
- });
582
-
583
- return {
584
- ...currentState,
585
- failedEmails: response.items,
586
- isLoading: false,
587
- error: null,
588
- lastUpdated: Date.now(),
589
- };
590
- } catch (error) {
591
- return {
592
- ...currentState,
593
- isLoading: false,
594
- error: error instanceof Error ? error.message : 'Failed to fetch failed emails',
595
- };
596
- }
597
- });
598
-
599
- // Fetch Security Incidents Action
600
- export const fetchSecurityIncidentsAction = emailOpsStatePart.createAction(async (statePartArg) => {
481
+ // Fetch All Emails Action
482
+ export const fetchAllEmailsAction = emailOpsStatePart.createAction(async (statePartArg) => {
601
483
  const context = getActionContext();
602
484
  const currentState = statePartArg.getState();
603
485
 
604
486
  try {
605
487
  const request = new plugins.domtools.plugins.typedrequest.TypedRequest<
606
- interfaces.requests.IReq_GetSecurityIncidents
607
- >('/typedrequest', 'getSecurityIncidents');
488
+ interfaces.requests.IReq_GetAllEmails
489
+ >('/typedrequest', 'getAllEmails');
608
490
 
609
491
  const response = await request.fire({
610
492
  identity: context.identity,
611
- limit: 100,
612
493
  });
613
494
 
614
495
  return {
615
- ...currentState,
616
- securityIncidents: response.incidents,
496
+ emails: response.emails,
617
497
  isLoading: false,
618
498
  error: null,
619
499
  lastUpdated: Date.now(),
@@ -622,104 +502,11 @@ export const fetchSecurityIncidentsAction = emailOpsStatePart.createAction(async
622
502
  return {
623
503
  ...currentState,
624
504
  isLoading: false,
625
- error: error instanceof Error ? error.message : 'Failed to fetch security incidents',
505
+ error: error instanceof Error ? error.message : 'Failed to fetch emails',
626
506
  };
627
507
  }
628
508
  });
629
509
 
630
- // Fetch Bounce Records Action
631
- export const fetchBounceRecordsAction = emailOpsStatePart.createAction(async (statePartArg) => {
632
- const context = getActionContext();
633
- const currentState = statePartArg.getState();
634
-
635
- try {
636
- const request = new plugins.domtools.plugins.typedrequest.TypedRequest<
637
- interfaces.requests.IReq_GetBounceRecords
638
- >('/typedrequest', 'getBounceRecords');
639
-
640
- const response = await request.fire({
641
- identity: context.identity,
642
- limit: 100,
643
- });
644
-
645
- return {
646
- ...currentState,
647
- bounceRecords: response.records,
648
- suppressionList: response.suppressionList,
649
- isLoading: false,
650
- error: null,
651
- lastUpdated: Date.now(),
652
- };
653
- } catch (error) {
654
- return {
655
- ...currentState,
656
- isLoading: false,
657
- error: error instanceof Error ? error.message : 'Failed to fetch bounce records',
658
- };
659
- }
660
- });
661
-
662
- // Resend Failed Email Action
663
- export const resendEmailAction = emailOpsStatePart.createAction<string>(async (statePartArg, emailId) => {
664
- const context = getActionContext();
665
- const currentState = statePartArg.getState();
666
-
667
- try {
668
- const request = new plugins.domtools.plugins.typedrequest.TypedRequest<
669
- interfaces.requests.IReq_ResendEmail
670
- >('/typedrequest', 'resendEmail');
671
-
672
- const response = await request.fire({
673
- identity: context.identity,
674
- emailId,
675
- });
676
-
677
- if (response.success) {
678
- // Refresh failed emails list
679
- await emailOpsStatePart.dispatchAction(fetchFailedEmailsAction, null);
680
- await emailOpsStatePart.dispatchAction(fetchQueuedEmailsAction, null);
681
- }
682
-
683
- return statePartArg.getState();
684
- } catch (error) {
685
- return {
686
- ...currentState,
687
- error: error instanceof Error ? error.message : 'Failed to resend email',
688
- };
689
- }
690
- });
691
-
692
- // Remove from Suppression List Action
693
- export const removeFromSuppressionListAction = emailOpsStatePart.createAction<string>(
694
- async (statePartArg, email) => {
695
- const context = getActionContext();
696
- const currentState = statePartArg.getState();
697
-
698
- try {
699
- const request = new plugins.domtools.plugins.typedrequest.TypedRequest<
700
- interfaces.requests.IReq_RemoveFromSuppressionList
701
- >('/typedrequest', 'removeFromSuppressionList');
702
-
703
- const response = await request.fire({
704
- identity: context.identity,
705
- email,
706
- });
707
-
708
- if (response.success) {
709
- // Refresh bounce records
710
- await emailOpsStatePart.dispatchAction(fetchBounceRecordsAction, null);
711
- }
712
-
713
- return statePartArg.getState();
714
- } catch (error) {
715
- return {
716
- ...currentState,
717
- error: error instanceof Error ? error.message : 'Failed to remove from suppression list',
718
- };
719
- }
720
- }
721
- );
722
-
723
510
  // ============================================================================
724
511
  // Certificate Actions
725
512
  // ============================================================================