@voyantjs/notifications 0.28.3 → 0.30.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.ts CHANGED
@@ -23,7 +23,7 @@ export { deliverQueuedNotificationReminder, sendDueNotificationReminders } from
23
23
  export type { NotificationLiquidSnippet, NotificationTemplateVariableCategory, NotificationTemplateVariableDefinition, NotificationTemplateVariableType, } from "./template-authoring.js";
24
24
  export { notificationLiquidSnippets, notificationTemplateVariableCatalog, } from "./template-authoring.js";
25
25
  export type { NotificationAttachment, NotificationChannel, NotificationPayload, NotificationProvider, NotificationResult, } from "./types.js";
26
- export { bookingDocumentBundleItemSchema, bookingDocumentBundleSchema, insertNotificationReminderRuleSchema, insertNotificationTemplateSchema, notificationAttachmentSchema, notificationChannelSchema, notificationDeliveryListQuerySchema, notificationDeliveryStatusSchema, notificationDocumentSourceSchema, notificationDocumentTypeSchema, notificationReminderRuleListQuerySchema, notificationReminderRunDeliverySummarySchema, notificationReminderRunLinksSchema, notificationReminderRunListQuerySchema, notificationReminderRunListResponseSchema, notificationReminderRunRecordSchema, notificationReminderRunRuleSummarySchema, notificationReminderRunStatusSchema, notificationReminderStatusSchema, notificationReminderTargetTypeSchema, notificationTargetTypeSchema, notificationTemplateListQuerySchema, notificationTemplateStatusSchema, previewNotificationTemplateResultSchema, previewNotificationTemplateSchema, runDueRemindersSchema, sendBookingDocumentsNotificationResultSchema, sendBookingDocumentsNotificationSchema, sendInvoiceNotificationSchema, sendNotificationSchema, sendPaymentSessionNotificationSchema, updateNotificationReminderRuleSchema, updateNotificationTemplateSchema, } from "./validation.js";
26
+ export { bookingDocumentBundleItemSchema, bookingDocumentBundleSchema, insertNotificationReminderRuleSchema, insertNotificationReminderRuleStageSchema, insertNotificationReminderStageChannelSchema, insertNotificationTemplateSchema, notificationAttachmentSchema, notificationChannelSchema, notificationDeliveryListQuerySchema, notificationDeliveryStatusSchema, notificationDocumentSourceSchema, notificationDocumentTypeSchema, notificationReminderRuleListQuerySchema, notificationReminderRunDeliverySummarySchema, notificationReminderRunLinksSchema, notificationReminderRunListQuerySchema, notificationReminderRunListResponseSchema, notificationReminderRunRecordSchema, notificationReminderRunRuleSummarySchema, notificationReminderRunStatusSchema, notificationReminderStageAnchorSchema, notificationReminderStageCadenceIntervalSchema, notificationReminderStageCadenceKindSchema, notificationReminderStatusSchema, notificationReminderTargetTypeSchema, notificationStageRecipientKindSchema, notificationTargetTypeSchema, notificationTemplateListQuerySchema, notificationTemplateStatusSchema, previewNotificationTemplateResultSchema, previewNotificationTemplateSchema, previewRemindersQuerySchema, reorderReminderRuleStagesSchema, runDueRemindersSchema, sendBookingDocumentsNotificationResultSchema, sendBookingDocumentsNotificationSchema, sendInvoiceNotificationSchema, sendNotificationSchema, sendPaymentSessionNotificationSchema, updateNotificationReminderRuleSchema, updateNotificationReminderRuleStageSchema, updateNotificationReminderStageChannelSchema, updateNotificationSettingsSchema, updateNotificationTemplateSchema, } from "./validation.js";
27
27
  /**
28
28
  * Auto-dispatch policy for the `booking.confirmed` subscriber. Set `enabled:
29
29
  * false` (or leave the option off entirely) to opt out.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAGvD,OAAO,EAIL,KAAK,0BAA0B,EAChC,MAAM,aAAa,CAAA;AASpB,OAAO,EACL,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,aAAa,CAAA;AACpB,YAAY,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC1D,YAAY,EACV,+BAA+B,EAC/B,wBAAwB,GACzB,MAAM,mCAAmC,CAAA;AAC1C,OAAO,EAAE,8BAA8B,EAAE,MA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CAA8C,EAC9C,0CAA0C,EAC1C,gCAAgC,EAChC,oCAAoC,EACpC,oCAAoC,EACpC,4BAA4B,EAC5B,mCAAmC,EACnC,gCAAgC,EAChC,uCAAuC,EACvC,iCAAiC,EACjC,2BAA2B,EAC3B,+BAA+B,EAC/B,qBAAqB,EACrB,4CAA4C,EAC5C,sCAAsC,EACtC,6BAA6B,EAC7B,sBAAsB,EACtB,oCAAoC,EACpC,oCAAoC,EACpC,yCAAyC,EACzC,4CAA4C,EAC5C,gCAAgC,EAChC,gCAAgC,GACjC,MAAM,iBAAiB,CAAA;AAExB;;;GAGG;AACH,MAAM,WAAW,0CAA0C;IACzD,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,8DAA8D;IAC9D,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,uEAAuE;IACvE,aAAa,CAAC,EAAE,KAAK,CAAC,UAAU,GAAG,SAAS,GAAG,UAAU,CAAC,CAAA;CAC3D;AAED,MAAM,WAAW,oCAAqC,SAAQ,0BAA0B;IACtF;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,YAAY,CAAA;IAC/D,sBAAsB,CAAC,EAAE,0CAA0C,CAAA;CACpE;AAED,wBAAgB,6BAA6B,CAC3C,OAAO,CAAC,EAAE,oCAAoC,GAC7C,UAAU,CAkNZ"}
package/dist/index.js CHANGED
@@ -15,7 +15,7 @@ export { bookingIsPaidInFullForNotification, dispatchReminderEventRules, } from
15
15
  export { buildNotificationTaskRuntime } from "./task-runtime.js";
16
16
  export { deliverQueuedNotificationReminder, sendDueNotificationReminders } from "./tasks/index.js";
17
17
  export { notificationLiquidSnippets, notificationTemplateVariableCatalog, } from "./template-authoring.js";
18
- export { bookingDocumentBundleItemSchema, bookingDocumentBundleSchema, insertNotificationReminderRuleSchema, insertNotificationTemplateSchema, notificationAttachmentSchema, notificationChannelSchema, notificationDeliveryListQuerySchema, notificationDeliveryStatusSchema, notificationDocumentSourceSchema, notificationDocumentTypeSchema, notificationReminderRuleListQuerySchema, notificationReminderRunDeliverySummarySchema, notificationReminderRunLinksSchema, notificationReminderRunListQuerySchema, notificationReminderRunListResponseSchema, notificationReminderRunRecordSchema, notificationReminderRunRuleSummarySchema, notificationReminderRunStatusSchema, notificationReminderStatusSchema, notificationReminderTargetTypeSchema, notificationTargetTypeSchema, notificationTemplateListQuerySchema, notificationTemplateStatusSchema, previewNotificationTemplateResultSchema, previewNotificationTemplateSchema, runDueRemindersSchema, sendBookingDocumentsNotificationResultSchema, sendBookingDocumentsNotificationSchema, sendInvoiceNotificationSchema, sendNotificationSchema, sendPaymentSessionNotificationSchema, updateNotificationReminderRuleSchema, updateNotificationTemplateSchema, } from "./validation.js";
18
+ export { bookingDocumentBundleItemSchema, bookingDocumentBundleSchema, insertNotificationReminderRuleSchema, insertNotificationReminderRuleStageSchema, insertNotificationReminderStageChannelSchema, insertNotificationTemplateSchema, notificationAttachmentSchema, notificationChannelSchema, notificationDeliveryListQuerySchema, notificationDeliveryStatusSchema, notificationDocumentSourceSchema, notificationDocumentTypeSchema, notificationReminderRuleListQuerySchema, notificationReminderRunDeliverySummarySchema, notificationReminderRunLinksSchema, notificationReminderRunListQuerySchema, notificationReminderRunListResponseSchema, notificationReminderRunRecordSchema, notificationReminderRunRuleSummarySchema, notificationReminderRunStatusSchema, notificationReminderStageAnchorSchema, notificationReminderStageCadenceIntervalSchema, notificationReminderStageCadenceKindSchema, notificationReminderStatusSchema, notificationReminderTargetTypeSchema, notificationStageRecipientKindSchema, notificationTargetTypeSchema, notificationTemplateListQuerySchema, notificationTemplateStatusSchema, previewNotificationTemplateResultSchema, previewNotificationTemplateSchema, previewRemindersQuerySchema, reorderReminderRuleStagesSchema, runDueRemindersSchema, sendBookingDocumentsNotificationResultSchema, sendBookingDocumentsNotificationSchema, sendInvoiceNotificationSchema, sendNotificationSchema, sendPaymentSessionNotificationSchema, updateNotificationReminderRuleSchema, updateNotificationReminderRuleStageSchema, updateNotificationReminderStageChannelSchema, updateNotificationSettingsSchema, updateNotificationTemplateSchema, } from "./validation.js";
19
19
  export function createNotificationsHonoModule(options) {
20
20
  const routes = createNotificationsRoutes(options);
21
21
  const module = {
package/dist/routes.d.ts CHANGED
@@ -376,7 +376,8 @@ export declare function createNotificationsRoutes(options?: NotificationsRoutesO
376
376
  provider: string | null;
377
377
  templateId: string | null;
378
378
  templateSlug: string | null;
379
- relativeDaysFromDueDate: number;
379
+ priority: number;
380
+ suppressionGroup: string | null;
380
381
  isSystem: boolean;
381
382
  metadata: {
382
383
  [x: string]: import("hono/utils/types").JSONValue;
@@ -411,9 +412,10 @@ export declare function createNotificationsRoutes(options?: NotificationsRoutesO
411
412
  channel: "email" | "sms";
412
413
  targetType: "booking_confirmed" | "invoice" | "booking_payment_schedule" | "payment_complete" | "booking_cancelled_non_payment";
413
414
  templateId: string | null;
415
+ priority: number;
414
416
  isSystem: boolean;
415
417
  templateSlug: string | null;
416
- relativeDaysFromDueDate: number;
418
+ suppressionGroup: string | null;
417
419
  } | null;
418
420
  };
419
421
  outputFormat: "json";
@@ -450,7 +452,8 @@ export declare function createNotificationsRoutes(options?: NotificationsRoutesO
450
452
  provider: string | null;
451
453
  templateId: string | null;
452
454
  templateSlug: string | null;
453
- relativeDaysFromDueDate: number;
455
+ priority: number;
456
+ suppressionGroup: string | null;
454
457
  isSystem: boolean;
455
458
  metadata: {
456
459
  [x: string]: import("hono/utils/types").JSONValue;
@@ -493,7 +496,8 @@ export declare function createNotificationsRoutes(options?: NotificationsRoutesO
493
496
  provider: string | null;
494
497
  templateId: string | null;
495
498
  templateSlug: string | null;
496
- relativeDaysFromDueDate: number;
499
+ priority: number;
500
+ suppressionGroup: string | null;
497
501
  isSystem: boolean;
498
502
  metadata: {
499
503
  [x: string]: import("hono/utils/types").JSONValue;
@@ -506,6 +510,424 @@ export declare function createNotificationsRoutes(options?: NotificationsRoutesO
506
510
  status: import("hono/utils/http-status").ContentfulStatusCode;
507
511
  };
508
512
  };
513
+ } & {
514
+ "/reminder-rules/:id/stages": {
515
+ $get: {
516
+ input: {
517
+ param: {
518
+ id: string;
519
+ };
520
+ };
521
+ output: {
522
+ data: {
523
+ metadata: {
524
+ [x: string]: import("hono/utils/types").JSONValue;
525
+ } | null;
526
+ name: string | null;
527
+ anchor: "due_date" | "booking_created_at" | "departure_date" | "invoice_issued_at" | "last_send_at";
528
+ id: string;
529
+ createdAt: string;
530
+ updatedAt: string;
531
+ reminderRuleId: string;
532
+ orderIndex: number;
533
+ windowStartDays: number;
534
+ windowEndDays: number;
535
+ cadenceKind: "once" | "every_n_days" | "escalating";
536
+ cadenceEveryDays: number | null;
537
+ cadenceIntervals: {
538
+ whenDaysUntilDueGT?: number | null | undefined;
539
+ whenDaysUntilDueLT?: number | null | undefined;
540
+ repeatEveryDays: number;
541
+ }[] | null;
542
+ maxSendsInStage: number | null;
543
+ respectQuietHours: boolean;
544
+ }[];
545
+ };
546
+ outputFormat: "json";
547
+ status: import("hono/utils/http-status").ContentfulStatusCode;
548
+ };
549
+ };
550
+ } & {
551
+ "/reminder-rules/:id/stages": {
552
+ $post: {
553
+ input: {
554
+ param: {
555
+ id: string;
556
+ };
557
+ };
558
+ output: {
559
+ data: {
560
+ metadata: {
561
+ [x: string]: import("hono/utils/types").JSONValue;
562
+ } | null;
563
+ name: string | null;
564
+ anchor: "due_date" | "booking_created_at" | "departure_date" | "invoice_issued_at" | "last_send_at";
565
+ id: string;
566
+ createdAt: string;
567
+ updatedAt: string;
568
+ reminderRuleId: string;
569
+ orderIndex: number;
570
+ windowStartDays: number;
571
+ windowEndDays: number;
572
+ cadenceKind: "once" | "every_n_days" | "escalating";
573
+ cadenceEveryDays: number | null;
574
+ cadenceIntervals: {
575
+ whenDaysUntilDueGT?: number | null | undefined;
576
+ whenDaysUntilDueLT?: number | null | undefined;
577
+ repeatEveryDays: number;
578
+ }[] | null;
579
+ maxSendsInStage: number | null;
580
+ respectQuietHours: boolean;
581
+ };
582
+ };
583
+ outputFormat: "json";
584
+ status: 201;
585
+ };
586
+ };
587
+ } & {
588
+ "/reminder-rules/:id/stages/reorder": {
589
+ $post: {
590
+ input: {
591
+ param: {
592
+ id: string;
593
+ };
594
+ };
595
+ output: {
596
+ data: {
597
+ metadata: {
598
+ [x: string]: import("hono/utils/types").JSONValue;
599
+ } | null;
600
+ name: string | null;
601
+ anchor: "due_date" | "booking_created_at" | "departure_date" | "invoice_issued_at" | "last_send_at";
602
+ id: string;
603
+ createdAt: string;
604
+ updatedAt: string;
605
+ reminderRuleId: string;
606
+ orderIndex: number;
607
+ windowStartDays: number;
608
+ windowEndDays: number;
609
+ cadenceKind: "once" | "every_n_days" | "escalating";
610
+ cadenceEveryDays: number | null;
611
+ cadenceIntervals: {
612
+ whenDaysUntilDueGT?: number | null | undefined;
613
+ whenDaysUntilDueLT?: number | null | undefined;
614
+ repeatEveryDays: number;
615
+ }[] | null;
616
+ maxSendsInStage: number | null;
617
+ respectQuietHours: boolean;
618
+ }[];
619
+ };
620
+ outputFormat: "json";
621
+ status: import("hono/utils/http-status").ContentfulStatusCode;
622
+ };
623
+ };
624
+ } & {
625
+ "/reminder-rules/:id/stages/:stageId": {
626
+ $patch: {
627
+ input: {
628
+ param: {
629
+ id: string;
630
+ } & {
631
+ stageId: string;
632
+ };
633
+ };
634
+ output: {
635
+ error: string;
636
+ };
637
+ outputFormat: "json";
638
+ status: 404;
639
+ } | {
640
+ input: {
641
+ param: {
642
+ id: string;
643
+ } & {
644
+ stageId: string;
645
+ };
646
+ };
647
+ output: {
648
+ data: {
649
+ metadata: {
650
+ [x: string]: import("hono/utils/types").JSONValue;
651
+ } | null;
652
+ name: string | null;
653
+ anchor: "due_date" | "booking_created_at" | "departure_date" | "invoice_issued_at" | "last_send_at";
654
+ id: string;
655
+ createdAt: string;
656
+ updatedAt: string;
657
+ reminderRuleId: string;
658
+ orderIndex: number;
659
+ windowStartDays: number;
660
+ windowEndDays: number;
661
+ cadenceKind: "once" | "every_n_days" | "escalating";
662
+ cadenceEveryDays: number | null;
663
+ cadenceIntervals: {
664
+ whenDaysUntilDueGT?: number | null | undefined;
665
+ whenDaysUntilDueLT?: number | null | undefined;
666
+ repeatEveryDays: number;
667
+ }[] | null;
668
+ maxSendsInStage: number | null;
669
+ respectQuietHours: boolean;
670
+ };
671
+ };
672
+ outputFormat: "json";
673
+ status: import("hono/utils/http-status").ContentfulStatusCode;
674
+ };
675
+ };
676
+ } & {
677
+ "/reminder-rules/:id/stages/:stageId": {
678
+ $delete: {
679
+ input: {
680
+ param: {
681
+ id: string;
682
+ } & {
683
+ stageId: string;
684
+ };
685
+ };
686
+ output: {
687
+ error: string;
688
+ };
689
+ outputFormat: "json";
690
+ status: 404;
691
+ } | {
692
+ input: {
693
+ param: {
694
+ id: string;
695
+ } & {
696
+ stageId: string;
697
+ };
698
+ };
699
+ output: null;
700
+ outputFormat: "body";
701
+ status: 204;
702
+ };
703
+ };
704
+ } & {
705
+ "/reminder-rules/:id/stages/:stageId/channels": {
706
+ $get: {
707
+ input: {
708
+ param: {
709
+ id: string;
710
+ } & {
711
+ stageId: string;
712
+ };
713
+ };
714
+ output: {
715
+ data: {
716
+ metadata: {
717
+ [x: string]: import("hono/utils/types").JSONValue;
718
+ } | null;
719
+ id: string;
720
+ createdAt: string;
721
+ updatedAt: string;
722
+ provider: string | null;
723
+ channel: "email" | "sms";
724
+ templateId: string | null;
725
+ stageId: string;
726
+ templateSlug: string | null;
727
+ orderIndex: number;
728
+ recipientKind: "primary" | "cc" | "bcc";
729
+ recipientRole: string | null;
730
+ }[];
731
+ };
732
+ outputFormat: "json";
733
+ status: import("hono/utils/http-status").ContentfulStatusCode;
734
+ };
735
+ };
736
+ } & {
737
+ "/reminder-rules/:id/stages/:stageId/channels": {
738
+ $post: {
739
+ input: {
740
+ param: {
741
+ id: string;
742
+ } & {
743
+ stageId: string;
744
+ };
745
+ };
746
+ output: {
747
+ data: {
748
+ metadata: {
749
+ [x: string]: import("hono/utils/types").JSONValue;
750
+ } | null;
751
+ id: string;
752
+ createdAt: string;
753
+ updatedAt: string;
754
+ provider: string | null;
755
+ channel: "email" | "sms";
756
+ templateId: string | null;
757
+ stageId: string;
758
+ templateSlug: string | null;
759
+ orderIndex: number;
760
+ recipientKind: "primary" | "cc" | "bcc";
761
+ recipientRole: string | null;
762
+ };
763
+ };
764
+ outputFormat: "json";
765
+ status: 201;
766
+ };
767
+ };
768
+ } & {
769
+ "/reminder-rules/:id/stages/:stageId/channels/:channelId": {
770
+ $patch: {
771
+ input: {
772
+ param: {
773
+ id: string;
774
+ } & {
775
+ stageId: string;
776
+ } & {
777
+ channelId: string;
778
+ };
779
+ };
780
+ output: {
781
+ error: string;
782
+ };
783
+ outputFormat: "json";
784
+ status: 404;
785
+ } | {
786
+ input: {
787
+ param: {
788
+ id: string;
789
+ } & {
790
+ stageId: string;
791
+ } & {
792
+ channelId: string;
793
+ };
794
+ };
795
+ output: {
796
+ data: {
797
+ metadata: {
798
+ [x: string]: import("hono/utils/types").JSONValue;
799
+ } | null;
800
+ id: string;
801
+ createdAt: string;
802
+ updatedAt: string;
803
+ provider: string | null;
804
+ channel: "email" | "sms";
805
+ templateId: string | null;
806
+ stageId: string;
807
+ templateSlug: string | null;
808
+ orderIndex: number;
809
+ recipientKind: "primary" | "cc" | "bcc";
810
+ recipientRole: string | null;
811
+ };
812
+ };
813
+ outputFormat: "json";
814
+ status: import("hono/utils/http-status").ContentfulStatusCode;
815
+ };
816
+ };
817
+ } & {
818
+ "/reminder-rules/:id/stages/:stageId/channels/:channelId": {
819
+ $delete: {
820
+ input: {
821
+ param: {
822
+ id: string;
823
+ } & {
824
+ stageId: string;
825
+ } & {
826
+ channelId: string;
827
+ };
828
+ };
829
+ output: null;
830
+ outputFormat: "body";
831
+ status: 204;
832
+ } | {
833
+ input: {
834
+ param: {
835
+ id: string;
836
+ } & {
837
+ stageId: string;
838
+ } & {
839
+ channelId: string;
840
+ };
841
+ };
842
+ output: {
843
+ error: string;
844
+ };
845
+ outputFormat: "json";
846
+ status: 404;
847
+ };
848
+ };
849
+ } & {
850
+ "/notification-settings": {
851
+ $get: {
852
+ input: {};
853
+ output: {
854
+ data: {
855
+ metadata: {
856
+ [x: string]: import("hono/utils/types").JSONValue;
857
+ } | null;
858
+ id: string;
859
+ createdAt: string;
860
+ updatedAt: string;
861
+ scope: string;
862
+ quietHoursLocal: {
863
+ start: string;
864
+ end: string;
865
+ tz: string;
866
+ } | null;
867
+ blackoutDates: string[] | null;
868
+ skipWeekends: boolean;
869
+ recipientRateLimitPerDay: number | null;
870
+ suppressionWindowHours: number;
871
+ };
872
+ };
873
+ outputFormat: "json";
874
+ status: import("hono/utils/http-status").ContentfulStatusCode;
875
+ };
876
+ };
877
+ } & {
878
+ "/notification-settings": {
879
+ $patch: {
880
+ input: {};
881
+ output: {
882
+ data: {
883
+ metadata: {
884
+ [x: string]: import("hono/utils/types").JSONValue;
885
+ } | null;
886
+ id: string;
887
+ createdAt: string;
888
+ updatedAt: string;
889
+ scope: string;
890
+ quietHoursLocal: {
891
+ start: string;
892
+ end: string;
893
+ tz: string;
894
+ } | null;
895
+ blackoutDates: string[] | null;
896
+ skipWeekends: boolean;
897
+ recipientRateLimitPerDay: number | null;
898
+ suppressionWindowHours: number;
899
+ };
900
+ };
901
+ outputFormat: "json";
902
+ status: import("hono/utils/http-status").ContentfulStatusCode;
903
+ };
904
+ };
905
+ } & {
906
+ "/reminders/preview": {
907
+ $get: {
908
+ input: {};
909
+ output: {
910
+ data: {
911
+ ruleId: string;
912
+ ruleName: string;
913
+ ruleSlug: string;
914
+ targetType: string;
915
+ targetId: string;
916
+ bookingId: string | null;
917
+ stageId: string;
918
+ stageName: string | null;
919
+ stageOrderIndex: number;
920
+ anchor: string;
921
+ anchorDate: string;
922
+ scheduledAt: string;
923
+ sendCountAtFire: number;
924
+ reasoning: string;
925
+ }[];
926
+ };
927
+ outputFormat: "json";
928
+ status: import("hono/utils/http-status").ContentfulStatusCode;
929
+ };
930
+ };
509
931
  } & {
510
932
  "/reminder-runs": {
511
933
  $get: {
@@ -517,7 +939,7 @@ export declare function createNotificationsRoutes(options?: NotificationsRoutesO
517
939
  targetType: "booking_confirmed" | "invoice" | "booking_payment_schedule" | "payment_complete" | "booking_cancelled_non_payment";
518
940
  targetId: string;
519
941
  dedupeKey: string;
520
- status: "failed" | "sent" | "processing" | "skipped" | "queued";
942
+ status: "failed" | "queued" | "skipped" | "sent" | "processing";
521
943
  recipient: string | null;
522
944
  scheduledFor: string;
523
945
  processedAt: string;
@@ -546,7 +968,6 @@ export declare function createNotificationsRoutes(options?: NotificationsRoutesO
546
968
  provider: string | null;
547
969
  templateId: string | null;
548
970
  templateSlug: string | null;
549
- relativeDaysFromDueDate: number;
550
971
  };
551
972
  delivery: {
552
973
  id: string;
@@ -594,7 +1015,7 @@ export declare function createNotificationsRoutes(options?: NotificationsRoutesO
594
1015
  targetType: "booking_confirmed" | "invoice" | "booking_payment_schedule" | "payment_complete" | "booking_cancelled_non_payment";
595
1016
  targetId: string;
596
1017
  dedupeKey: string;
597
- status: "failed" | "sent" | "processing" | "skipped" | "queued";
1018
+ status: "failed" | "queued" | "skipped" | "sent" | "processing";
598
1019
  recipient: string | null;
599
1020
  scheduledFor: string;
600
1021
  processedAt: string;
@@ -623,7 +1044,6 @@ export declare function createNotificationsRoutes(options?: NotificationsRoutesO
623
1044
  provider: string | null;
624
1045
  templateId: string | null;
625
1046
  templateSlug: string | null;
626
- relativeDaysFromDueDate: number;
627
1047
  };
628
1048
  delivery: {
629
1049
  id: string;
@@ -1 +1 @@
1
- {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAE/D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAIjE,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,gCAAgC,CAAA;AACvF,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAqW7E"}
package/dist/routes.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { parseJsonBody, parseOptionalJsonBody, parseQuery } from "@voyantjs/hono";
2
2
  import { Hono } from "hono";
3
3
  import { createNotificationService, notificationsService } from "./service.js";
4
- import { bookingDocumentBundleSchema, confirmAndDispatchBookingResultSchema, confirmAndDispatchBookingSchema, insertNotificationReminderRuleSchema, insertNotificationTemplateSchema, notificationDeliveryListQuerySchema, notificationReminderRuleListQuerySchema, notificationReminderRunListQuerySchema, notificationTemplateListQuerySchema, previewNotificationTemplateResultSchema, previewNotificationTemplateSchema, runDueRemindersSchema, sendBookingDocumentsNotificationResultSchema, sendBookingDocumentsNotificationSchema, sendInvoiceNotificationSchema, sendNotificationSchema, sendPaymentSessionNotificationSchema, updateNotificationReminderRuleSchema, updateNotificationTemplateSchema, } from "./validation.js";
4
+ import { bookingDocumentBundleSchema, confirmAndDispatchBookingResultSchema, confirmAndDispatchBookingSchema, insertNotificationReminderRuleSchema, insertNotificationReminderRuleStageSchema, insertNotificationReminderStageChannelSchema, insertNotificationTemplateSchema, notificationDeliveryListQuerySchema, notificationReminderRuleListQuerySchema, notificationReminderRunListQuerySchema, notificationTemplateListQuerySchema, previewNotificationTemplateResultSchema, previewNotificationTemplateSchema, previewRemindersQuerySchema, reorderReminderRuleStagesSchema, runDueRemindersSchema, sendBookingDocumentsNotificationResultSchema, sendBookingDocumentsNotificationSchema, sendInvoiceNotificationSchema, sendNotificationSchema, sendPaymentSessionNotificationSchema, updateNotificationReminderRuleSchema, updateNotificationReminderRuleStageSchema, updateNotificationReminderStageChannelSchema, updateNotificationSettingsSchema, updateNotificationTemplateSchema, } from "./validation.js";
5
5
  export const NOTIFICATIONS_ROUTE_RUNTIME_CONTAINER_KEY = "providers.notifications.runtime";
6
6
  export function buildNotificationsRouteRuntime(bindings, options) {
7
7
  return {
@@ -87,6 +87,68 @@ export function createNotificationsRoutes(options) {
87
87
  if (!row)
88
88
  return c.json({ error: "Notification reminder rule not found" }, 404);
89
89
  return c.json({ data: row });
90
+ })
91
+ .get("/reminder-rules/:id/stages", async (c) => {
92
+ const stages = await notificationsService.listReminderRuleStages(c.get("db"), c.req.param("id"));
93
+ return c.json({ data: stages });
94
+ })
95
+ .post("/reminder-rules/:id/stages", async (c) => {
96
+ const stage = await notificationsService.createReminderRuleStage(c.get("db"), c.req.param("id"), await parseJsonBody(c, insertNotificationReminderRuleStageSchema));
97
+ return c.json({ data: stage }, 201);
98
+ })
99
+ .post("/reminder-rules/:id/stages/reorder", async (c) => {
100
+ const stages = await notificationsService.reorderReminderRuleStages(c.get("db"), c.req.param("id"), await parseJsonBody(c, reorderReminderRuleStagesSchema));
101
+ return c.json({ data: stages });
102
+ })
103
+ .patch("/reminder-rules/:id/stages/:stageId", async (c) => {
104
+ const stage = await notificationsService.updateReminderRuleStage(c.get("db"), c.req.param("stageId"), await parseJsonBody(c, updateNotificationReminderRuleStageSchema));
105
+ if (!stage)
106
+ return c.json({ error: "Reminder stage not found" }, 404);
107
+ return c.json({ data: stage });
108
+ })
109
+ .delete("/reminder-rules/:id/stages/:stageId", async (c) => {
110
+ const ok = await notificationsService.deleteReminderRuleStage(c.get("db"), c.req.param("stageId"));
111
+ if (!ok)
112
+ return c.json({ error: "Reminder stage not found" }, 404);
113
+ return c.body(null, 204);
114
+ })
115
+ .get("/reminder-rules/:id/stages/:stageId/channels", async (c) => {
116
+ const channels = await notificationsService.listStageChannels(c.get("db"), c.req.param("stageId"));
117
+ return c.json({ data: channels });
118
+ })
119
+ .post("/reminder-rules/:id/stages/:stageId/channels", async (c) => {
120
+ const row = await notificationsService.createStageChannel(c.get("db"), c.req.param("stageId"), await parseJsonBody(c, insertNotificationReminderStageChannelSchema));
121
+ return c.json({ data: row }, 201);
122
+ })
123
+ .patch("/reminder-rules/:id/stages/:stageId/channels/:channelId", async (c) => {
124
+ const row = await notificationsService.updateStageChannel(c.get("db"), c.req.param("channelId"), await parseJsonBody(c, updateNotificationReminderStageChannelSchema));
125
+ if (!row)
126
+ return c.json({ error: "Stage channel not found" }, 404);
127
+ return c.json({ data: row });
128
+ })
129
+ .delete("/reminder-rules/:id/stages/:stageId/channels/:channelId", async (c) => {
130
+ const ok = await notificationsService.deleteStageChannel(c.get("db"), c.req.param("channelId"));
131
+ if (!ok)
132
+ return c.json({ error: "Stage channel not found" }, 404);
133
+ return c.body(null, 204);
134
+ })
135
+ .get("/notification-settings", async (c) => {
136
+ const row = await notificationsService.getNotificationSettings(c.get("db"));
137
+ return c.json({ data: row });
138
+ })
139
+ .patch("/notification-settings", async (c) => {
140
+ const row = await notificationsService.upsertNotificationSettings(c.get("db"), await parseJsonBody(c, updateNotificationSettingsSchema));
141
+ return c.json({ data: row });
142
+ })
143
+ .get("/reminders/preview", async (c) => {
144
+ const query = parseQuery(c, previewRemindersQuerySchema);
145
+ const now = query.date ? new Date(`${query.date}T00:00:00Z`) : new Date();
146
+ const rows = await notificationsService.previewReminders(c.get("db"), {
147
+ now,
148
+ ruleId: query.ruleId,
149
+ targetId: query.targetId,
150
+ });
151
+ return c.json({ data: rows });
90
152
  })
91
153
  .get("/reminder-runs", async (c) => {
92
154
  const query = parseQuery(c, notificationReminderRunListQuerySchema);