@dragonmastery/dragoncore-shared 0.0.2 → 0.0.5

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.mjs CHANGED
@@ -1,33 +1,5 @@
1
1
  import { z } from "zod";
2
2
 
3
- //#region src/validation/app_settings/notification_emails_zod.ts
4
- /**
5
- * Schema for individual email entry
6
- */
7
- const EmailEntrySchema = z.object({
8
- id: z.string().default(() => `email-${Math.random().toString(36).substr(2, 9)}`).optional(),
9
- email: z.string().email("Must be a valid email address")
10
- });
11
- /**
12
- * Schema for updating support ticket notification emails
13
- * Uses an array of email objects for proper validation and UX
14
- */
15
- const UpdateNotificationEmailsSchema = z.object({ emails: z.array(EmailEntrySchema).max(10, "Maximum 10 email addresses allowed") });
16
- /**
17
- * Schema for reading support ticket notification emails
18
- */
19
- const ReadNotificationEmailsSchema = z.object({ emails: z.array(z.object({ email: z.string() })) });
20
- /**
21
- * Helper function to create a new email entry
22
- */
23
- function createNewEmailEntry() {
24
- return {
25
- id: `email-${Math.random().toString(36).substr(2, 9)}`,
26
- email: ""
27
- };
28
- }
29
-
30
- //#endregion
31
3
  //#region src/validation/attachment/attachment_filters_zod.ts
32
4
  const AttachmentFiltersSchema = z.object({
33
5
  record_id: z.string(),
@@ -416,7 +388,7 @@ const PaginationFiltersSchema = z.object({
416
388
  const PageInfoSchema = z.object({
417
389
  hasNextPage: z.boolean(),
418
390
  hasPreviousPage: z.boolean(),
419
- prevPageCursor: z.string().optional(),
391
+ prevPageCursor: z.string().nullish(),
420
392
  nextPageCursor: z.string().optional(),
421
393
  currentPageIndex: z.number().optional(),
422
394
  paginationToken: z.string().optional()
@@ -462,6 +434,7 @@ const USER_TYPES = [
462
434
  "staff",
463
435
  "super_admin"
464
436
  ];
437
+ const DEFAULT_USER_TYPE = USER_TYPES[0];
465
438
  const UserTypeEnum = z.enum([...USER_TYPES]);
466
439
 
467
440
  //#endregion
@@ -571,6 +544,7 @@ const RecordTypeValues = [
571
544
  "password_reset",
572
545
  "record_version",
573
546
  "support_ticket",
547
+ "support_ticket_activity",
574
548
  "credit_transaction",
575
549
  "team_member",
576
550
  "client_contact",
@@ -578,10 +552,15 @@ const RecordTypeValues = [
578
552
  "client_profile",
579
553
  "business_profile",
580
554
  "tracker",
555
+ "tracker_activity",
581
556
  "team",
582
557
  "quote",
583
558
  "note",
584
- "followup"
559
+ "followup",
560
+ "saved_filter",
561
+ "user_pinned_preset",
562
+ "record_subscriber",
563
+ "support_staff"
585
564
  ];
586
565
  const RecordConst = {
587
566
  ATTACHMENT: "attachment",
@@ -595,6 +574,7 @@ const RecordConst = {
595
574
  PASSWORD_RESET: "password_reset",
596
575
  RECORD_VERSION: "record_version",
597
576
  SUPPORT_TICKET: "support_ticket",
577
+ SUPPORT_TICKET_ACTIVITY: "support_ticket_activity",
598
578
  CREDIT_TRANSACTION: "credit_transaction",
599
579
  TEAM_MEMBER: "team_member",
600
580
  CLIENT_CONTACT: "client_contact",
@@ -602,26 +582,33 @@ const RecordConst = {
602
582
  CLIENT_PROFILE: "client_profile",
603
583
  BUSINESS_PROFILE: "business_profile",
604
584
  TRACKER: "tracker",
585
+ TRACKER_ACTIVITY: "tracker_activity",
605
586
  TEAM: "team",
606
587
  NOTE: "note",
607
- FOLLOWUP: "followup"
588
+ FOLLOWUP: "followup",
589
+ SAVED_FILTER: "saved_filter",
590
+ USER_PINNED_PRESET: "user_pinned_preset",
591
+ RECORD_SUBSCRIBER: "record_subscriber",
592
+ SUPPORT_STAFF: "support_staff"
608
593
  };
609
594
 
610
595
  //#endregion
611
596
  //#region src/validation/note/note_read_zod.ts
612
- const RecordTypeEnum$3 = z.enum(RecordTypeValues);
597
+ const RecordTypeEnum$5 = z.enum(RecordTypeValues);
613
598
  const NoteReadSchema = z.object({
614
599
  id: z.string(),
615
600
  record_id: z.string(),
616
- record_type: RecordTypeEnum$3,
601
+ record_type: RecordTypeEnum$5,
617
602
  tag: z.string().optional().nullable(),
618
603
  title: z.string().optional().nullable(),
619
604
  body: z.string().optional().nullable(),
620
605
  original_id: z.number().optional().nullable(),
621
606
  is_internal: z.boolean(),
622
607
  created_by: z.string(),
608
+ created_by_display_name: z.string().optional().nullable(),
623
609
  created_at: z.string(),
624
610
  updated_by: z.string().optional().nullable(),
611
+ updated_by_display_name: z.string().optional().nullable(),
625
612
  updated_at: z.string().optional().nullable(),
626
613
  archived_by: z.string().optional().nullable(),
627
614
  archived_at: z.string().optional().nullable(),
@@ -631,10 +618,10 @@ const NoteReadSchema = z.object({
631
618
 
632
619
  //#endregion
633
620
  //#region src/validation/note/note_create_zod.ts
634
- const RecordTypeEnum$2 = z.enum(RecordTypeValues);
621
+ const RecordTypeEnum$4 = z.enum(RecordTypeValues);
635
622
  const NoteCreateSchema = z.object({
636
623
  record_id: z.string(),
637
- record_type: RecordTypeEnum$2,
624
+ record_type: RecordTypeEnum$4,
638
625
  tag: z.string().optional().nullable(),
639
626
  title: z.string().optional().nullable(),
640
627
  body: z.string().optional().nullable(),
@@ -644,11 +631,11 @@ const NoteCreateSchema = z.object({
644
631
 
645
632
  //#endregion
646
633
  //#region src/validation/note/note_update_zod.ts
647
- const RecordTypeEnum$1 = z.enum(RecordTypeValues);
634
+ const RecordTypeEnum$3 = z.enum(RecordTypeValues);
648
635
  const NoteUpdateSchema = z.object({
649
636
  id: z.string(),
650
637
  record_id: z.string().optional(),
651
- record_type: RecordTypeEnum$1.optional(),
638
+ record_type: RecordTypeEnum$3.optional(),
652
639
  tag: z.string().optional().nullable(),
653
640
  title: z.string().optional().nullable(),
654
641
  body: z.string().optional().nullable(),
@@ -690,7 +677,7 @@ const NoteFiltersSortDirectionEnum = z.enum(["asc", "desc"]);
690
677
 
691
678
  //#endregion
692
679
  //#region src/validation/record_version_zod.ts
693
- const RecordTypeEnum = z.enum(RecordTypeValues);
680
+ const RecordTypeEnum$2 = z.enum(RecordTypeValues);
694
681
  const recordVersionSchema = z.object({
695
682
  id: z.string(),
696
683
  record_id: z.string(),
@@ -722,14 +709,15 @@ const recordVersionFiltersSchema = z.object({
722
709
  });
723
710
  const recordVersionFiltersInputSchema = z.object({
724
711
  record_id: z.string(),
725
- record_type: RecordTypeEnum,
712
+ record_type: RecordTypeEnum$2,
726
713
  filters: recordVersionFiltersSchema.optional().nullable()
727
714
  });
728
715
  /**
729
716
  * NEW: Breadcrumb-paginated record version response
730
717
  * Use this for new implementations
718
+ * user_display_map: optional map of user_id -> display_name for timeline display (assigned_to, created_by, etc.)
731
719
  */
732
- const recordVersionPageBreadcrumbSchema = createPaginatedSchema(recordVersionSchema);
720
+ const recordVersionPageBreadcrumbSchema = createPaginatedSchema(recordVersionSchema).extend({ user_display_map: z.record(z.string(), z.string()).optional() });
733
721
  /**
734
722
  * NEW: Filters with breadcrumb pagination support
735
723
  * Extends PaginationFiltersSchema for consistent pagination
@@ -743,14 +731,48 @@ const recordVersionFiltersBreadcrumbSchema = z.object({
743
731
  sortDirection: SortDirectionSchema.optional(),
744
732
  paginationToken: z.string().optional(),
745
733
  start_date: z.string().optional().nullable(),
746
- end_date: z.string().optional().nullable()
734
+ end_date: z.string().optional().nullable(),
735
+ record_types: z.array(RecordTypeEnum$2).min(1).optional(),
736
+ record_ids: z.array(z.string()).min(1).optional()
747
737
  });
748
738
  const recordVersionFiltersInputBreadcrumbSchema = z.object({
749
739
  record_id: z.string(),
750
- record_type: RecordTypeEnum,
740
+ record_type: RecordTypeEnum$2,
741
+ filters: recordVersionFiltersBreadcrumbSchema.optional().nullable()
742
+ });
743
+ /** Input for listTrackerActivityVersions - tracker ID + optional filters */
744
+ const recordVersionTrackerActivityInputSchema = z.object({
745
+ tracker_id: z.string(),
751
746
  filters: recordVersionFiltersBreadcrumbSchema.optional().nullable()
752
747
  });
753
748
 
749
+ //#endregion
750
+ //#region src/validation/saved_filter/saved_filter_create_zod.ts
751
+ /**
752
+ * Schema for creating a saved filter preset
753
+ */
754
+ const SavedFilterCreateSchema = z.object({
755
+ name: z.string().min(1, "Name is required").max(100),
756
+ context: z.string().min(1, "Context is required"),
757
+ route_path: z.string().min(1, "Route path is required"),
758
+ filters: z.record(z.union([z.string(), z.array(z.string())])),
759
+ sort_by: z.string().optional(),
760
+ sort_direction: z.enum(["asc", "desc"]).optional()
761
+ });
762
+
763
+ //#endregion
764
+ //#region src/validation/saved_filter/saved_filter_read_zod.ts
765
+ const SavedFilterReadSchema = SavedFilterCreateSchema.extend({
766
+ id: z.string(),
767
+ user_id: z.string(),
768
+ created_at: z.string(),
769
+ updated_at: z.string().optional()
770
+ });
771
+
772
+ //#endregion
773
+ //#region src/validation/saved_filter/saved_filter_update_zod.ts
774
+ const SavedFilterUpdateSchema = SavedFilterCreateSchema.partial().extend({ id: z.string() });
775
+
754
776
  //#endregion
755
777
  //#region src/validation/reset_password_zod.ts
756
778
  const resetPasswordInputSchema = z.object({ passwords: z.object({
@@ -775,6 +797,38 @@ const signupSchema = z.object({
775
797
  })
776
798
  });
777
799
 
800
+ //#endregion
801
+ //#region src/validation/record_subscriber/record_subscriber_create_zod.ts
802
+ const RecordTypeEnum$1 = z.enum(RecordTypeValues);
803
+ const RecordSubscriberCreateSchema = z.object({
804
+ record_type: RecordTypeEnum$1,
805
+ record_id: z.string().min(1, "Record ID is required"),
806
+ user_id: z.string().min(1, "User ID is required"),
807
+ subscribed_events: z.array(z.string()).optional().nullable()
808
+ });
809
+
810
+ //#endregion
811
+ //#region src/validation/record_subscriber/record_subscriber_read_zod.ts
812
+ const RecordTypeEnum = z.enum(RecordTypeValues);
813
+ const RecordSubscriberReadSchema = z.object({
814
+ id: z.string().min(1, "ID is required"),
815
+ record_type: RecordTypeEnum,
816
+ record_id: z.string().min(1, "Record ID is required"),
817
+ user_id: z.string().min(1, "User ID is required"),
818
+ user_id_display_name: z.string().optional().nullable(),
819
+ subscribed_events: z.array(z.string()).optional().nullable(),
820
+ created_at: z.string(),
821
+ created_by: z.string(),
822
+ created_by_display_name: z.string().optional().nullable()
823
+ });
824
+
825
+ //#endregion
826
+ //#region src/validation/record_subscriber/record_subscriber_update_zod.ts
827
+ const RecordSubscriberUpdateSchema = z.object({
828
+ id: z.string().min(1, "ID is required"),
829
+ subscribed_events: z.array(z.string()).optional().nullable()
830
+ });
831
+
778
832
  //#endregion
779
833
  //#region src/validation/support_ticket/support_ticket_shared/support_ticket_enums_zod.ts
780
834
  const SupportTicketTypeEnum = [
@@ -790,22 +844,90 @@ const SupportTicketPriorityEnum = [
790
844
  "HIGH",
791
845
  "CRITICAL"
792
846
  ];
847
+ const SupportTicketPriorityNumberEnum = [
848
+ 1,
849
+ 2,
850
+ 3,
851
+ 4
852
+ ];
793
853
  /**
794
854
  * Enum for feature request priority levels
795
855
  */
796
856
  const SupportTicketPrioritySchema = z.enum(SupportTicketPriorityEnum);
797
857
  /**
858
+ * Numeric priority for create/update DTOs (1–4).
859
+ * Used in forms and API input; read DTOs still return string for display.
860
+ */
861
+ const SupportTicketPriorityNumberSchema = z.number().int().min(1, "Priority must be between 1 and 4").max(4, "Priority must be between 1 and 4");
862
+ /**
863
+ * Numeric mapping for DB storage and proper sorting.
864
+ * Higher number = higher priority.
865
+ */
866
+ const SUPPORT_TICKET_PRIORITY_TO_NUMBER = {
867
+ LOW: 1,
868
+ MEDIUM: 2,
869
+ HIGH: 3,
870
+ CRITICAL: 4
871
+ };
872
+ const SUPPORT_TICKET_NUMBER_TO_PRIORITY = {
873
+ 1: "LOW",
874
+ 2: "MEDIUM",
875
+ 3: "HIGH",
876
+ 4: "CRITICAL"
877
+ };
878
+ function supportTicketPriorityToNumber(priority) {
879
+ return SUPPORT_TICKET_PRIORITY_TO_NUMBER[priority];
880
+ }
881
+ function supportTicketNumberToPriority(num) {
882
+ const p = SUPPORT_TICKET_NUMBER_TO_PRIORITY[num];
883
+ if (!p) return "MEDIUM";
884
+ return p;
885
+ }
886
+ /**
887
+ * Label/value options for priority filter dropdowns (Zinia columns)
888
+ */
889
+ const SUPPORT_TICKET_PRIORITY_FILTER_OPTIONS = [
890
+ {
891
+ label: "Low",
892
+ value: 1
893
+ },
894
+ {
895
+ label: "Medium",
896
+ value: 2
897
+ },
898
+ {
899
+ label: "High",
900
+ value: 3
901
+ },
902
+ {
903
+ label: "Critical",
904
+ value: 4
905
+ }
906
+ ];
907
+ /**
908
+ * Maps numeric priority (1–4) to display label for Zinia SelectField.
909
+ * Use with valueToLabel + valueType: 'number' for number-backed select fields.
910
+ */
911
+ const SUPPORT_TICKET_PRIORITY_NUMBER_TO_LABEL = {
912
+ 1: "Low",
913
+ 2: "Medium",
914
+ 3: "High",
915
+ 4: "Critical"
916
+ };
917
+ /**
798
918
  * Enum for customer-facing support_ticket status (computed from approval_status + dev_lifecycle)
799
919
  * - PENDING: Awaiting admin review
800
920
  * - FOLLOWUP: Approved but not started
801
921
  * - IN_PROGRESS: Actively being worked on
802
- * - COMPLETED: Deployed to production
922
+ * - VERIFICATION: Work deployed; consumer should verify and leave a comment
923
+ * - COMPLETED: Deployed to production and verified
803
924
  * - CANCELLED: Rejected by admin
804
925
  */
805
926
  const SupportTicketStatusEnum = [
806
927
  "PENDING",
807
928
  "FOLLOWUP",
808
929
  "IN_PROGRESS",
930
+ "VERIFICATION",
809
931
  "COMPLETED",
810
932
  "CANCELLED"
811
933
  ];
@@ -833,7 +955,8 @@ const SupportTicketApprovalSchema = z.enum(SupportTicketApprovalEnum);
833
955
  * - TESTING: QA testing
834
956
  * - STAGING: On staging environment
835
957
  * - PO_APPROVAL: Waiting for PO/customer sign-off
836
- * - DEPLOYED: Live in production
958
+ * - VERIFICATION: Deployed; waiting for consumer to verify and leave a comment
959
+ * - DEPLOYED: Live in production and verified
837
960
  * - CANCELLED: Internal task cancelled (only for INTERNAL approval status)
838
961
  */
839
962
  const SupportTicketDevLifecycleEnum = [
@@ -845,6 +968,7 @@ const SupportTicketDevLifecycleEnum = [
845
968
  "TESTING",
846
969
  "STAGING",
847
970
  "PO_APPROVAL",
971
+ "VERIFICATION",
848
972
  "DEPLOYED",
849
973
  "CANCELLED"
850
974
  ];
@@ -854,7 +978,7 @@ const SupportTicketDevLifecycleSchema = z.enum(SupportTicketDevLifecycleEnum);
854
978
  * Excludes workflow-only stages:
855
979
  * - PENDING: Set by revert workflow
856
980
  * - DEPLOYED: Set by completeSupportTicket workflow
857
- * Staff can manually progress through: BACKLOG → PLANNING → DEVELOPMENT → CODE_REVIEW → TESTING → STAGING → PO_APPROVAL
981
+ * Staff can manually progress through: BACKLOG → PLANNING → DEVELOPMENT → CODE_REVIEW → TESTING → STAGING → PO_APPROVAL → VERIFICATION
858
982
  */
859
983
  const SupportTicketDevLifecycleUpdateEnum = [
860
984
  "BACKLOG",
@@ -863,10 +987,122 @@ const SupportTicketDevLifecycleUpdateEnum = [
863
987
  "CODE_REVIEW",
864
988
  "TESTING",
865
989
  "STAGING",
866
- "PO_APPROVAL"
990
+ "PO_APPROVAL",
991
+ "VERIFICATION"
867
992
  ];
868
993
  const SupportTicketDevLifecycleUpdateSchema = z.enum(SupportTicketDevLifecycleUpdateEnum);
869
994
  /**
995
+ * Label/value options for type, approval, dev lifecycle, and status filter dropdowns
996
+ */
997
+ const SUPPORT_TICKET_TYPE_FILTER_OPTIONS = [
998
+ {
999
+ label: "Bug",
1000
+ value: "BUG"
1001
+ },
1002
+ {
1003
+ label: "Feature",
1004
+ value: "FEATURE_REQUEST"
1005
+ },
1006
+ {
1007
+ label: "Improvement",
1008
+ value: "IMPROVEMENT"
1009
+ },
1010
+ {
1011
+ label: "Operational",
1012
+ value: "OPERATIONAL"
1013
+ }
1014
+ ];
1015
+ const SUPPORT_TICKET_APPROVAL_FILTER_OPTIONS = [
1016
+ {
1017
+ label: "Pending",
1018
+ value: "PENDING"
1019
+ },
1020
+ {
1021
+ label: "Approved",
1022
+ value: "APPROVED"
1023
+ },
1024
+ {
1025
+ label: "Rejected",
1026
+ value: "REJECTED"
1027
+ },
1028
+ {
1029
+ label: "Internal",
1030
+ value: "INTERNAL"
1031
+ }
1032
+ ];
1033
+ const SUPPORT_TICKET_DEV_LIFECYCLE_FILTER_OPTIONS = [
1034
+ {
1035
+ label: "Pending",
1036
+ value: "PENDING"
1037
+ },
1038
+ {
1039
+ label: "Backlog",
1040
+ value: "BACKLOG"
1041
+ },
1042
+ {
1043
+ label: "Planning",
1044
+ value: "PLANNING"
1045
+ },
1046
+ {
1047
+ label: "Dev",
1048
+ value: "DEVELOPMENT"
1049
+ },
1050
+ {
1051
+ label: "Review",
1052
+ value: "CODE_REVIEW"
1053
+ },
1054
+ {
1055
+ label: "Testing",
1056
+ value: "TESTING"
1057
+ },
1058
+ {
1059
+ label: "Staging",
1060
+ value: "STAGING"
1061
+ },
1062
+ {
1063
+ label: "PO Approval",
1064
+ value: "PO_APPROVAL"
1065
+ },
1066
+ {
1067
+ label: "Verification",
1068
+ value: "VERIFICATION"
1069
+ },
1070
+ {
1071
+ label: "Live",
1072
+ value: "DEPLOYED"
1073
+ },
1074
+ {
1075
+ label: "Cancelled",
1076
+ value: "CANCELLED"
1077
+ }
1078
+ ];
1079
+ const SUPPORT_TICKET_STATUS_FILTER_OPTIONS = [
1080
+ {
1081
+ label: "Pending",
1082
+ value: "PENDING"
1083
+ },
1084
+ {
1085
+ label: "Todo",
1086
+ value: "FOLLOWUP"
1087
+ },
1088
+ {
1089
+ label: "Active",
1090
+ value: "IN_PROGRESS"
1091
+ },
1092
+ {
1093
+ label: "Verification",
1094
+ value: "VERIFICATION"
1095
+ },
1096
+ {
1097
+ label: "Done",
1098
+ value: "COMPLETED"
1099
+ },
1100
+ {
1101
+ label: "Cancelled",
1102
+ value: "CANCELLED"
1103
+ }
1104
+ ];
1105
+ /**
870
1106
  * Filter-specific enum instances
871
1107
  * These are separate Zod objects with the same values as above,
872
1108
  * allowing GraphQL to generate distinct enum types for filters vs domain objects
@@ -886,7 +1122,7 @@ const CustomerSupportTicketCreateSchema = z.object({
886
1122
  title: z.string().min(5, "Please add a more descriptive title (at least 5 characters)").max(256, "Title is too long - keep it brief (under 256 characters)"),
887
1123
  description: z.string().optional().nullable(),
888
1124
  type: SupportTicketTypeSchema.default("FEATURE_REQUEST"),
889
- priority: SupportTicketPrioritySchema.default("MEDIUM")
1125
+ priority: SupportTicketPriorityNumberSchema.default(SUPPORT_TICKET_PRIORITY_TO_NUMBER.MEDIUM)
890
1126
  });
891
1127
  /**
892
1128
  * Schema for updating support_ticket (customer - PENDING items only)
@@ -909,8 +1145,7 @@ const CustomerSupportTicketReadSchema = z.object({
909
1145
  priority: SupportTicketPrioritySchema,
910
1146
  status: SupportTicketStatusSchema,
911
1147
  is_locked: z.boolean(),
912
- requester_name: z.string().optional().nullable(),
913
- requester_email: z.string().email().optional().nullable(),
1148
+ created_by_display_name: z.string().optional().nullable(),
914
1149
  credit_value: z.string().optional().nullable(),
915
1150
  start_at: z.string().optional().nullable(),
916
1151
  target_at: z.string().optional().nullable(),
@@ -919,7 +1154,9 @@ const CustomerSupportTicketReadSchema = z.object({
919
1154
  created_by: z.string().optional().nullable(),
920
1155
  created_at: z.string().optional().nullable(),
921
1156
  updated_by: z.string().optional().nullable(),
922
- updated_at: z.string().optional().nullable()
1157
+ updated_at: z.string().optional().nullable(),
1158
+ archived_at: z.string().optional().nullable(),
1159
+ my_subscription: RecordSubscriberReadSchema.nullable().optional()
923
1160
  });
924
1161
  /**
925
1162
  * Paginated customer support_ticket response
@@ -938,11 +1175,10 @@ const CustomerSupportTicketPageSchema = createPaginatedSchema(CustomerSupportTic
938
1175
  const CustomerSupportTicketFiltersSchema = PaginationFiltersSchema.extend({
939
1176
  type: createEnumFilter(SupportTicketTypeFilterSchema).optional(),
940
1177
  status: createEnumFilter(SupportTicketStatusFilterSchema).optional(),
941
- priority: createEnumFilter(SupportTicketPriorityFilterSchema).optional(),
1178
+ priority: NumberFilterSchema.optional(),
942
1179
  title: StringFilterSchema.optional(),
943
1180
  description: StringFilterSchema.optional(),
944
- requester_name: StringFilterSchema.optional(),
945
- requester_email: StringFilterSchema.optional(),
1181
+ created_by: StringFilterSchema.optional(),
946
1182
  is_locked: BooleanFilterSchema.optional(),
947
1183
  credit_value: NumberFilterSchema.optional(),
948
1184
  created_at: DateFilterSchema.optional(),
@@ -974,8 +1210,9 @@ const StaffSupportTicketReadSchema = z.object({
974
1210
  approval_status: SupportTicketApprovalSchema,
975
1211
  is_locked: z.boolean(),
976
1212
  can_delete: z.boolean(),
977
- requester_name: z.string().optional().nullable(),
978
- requester_email: z.string().email().optional().nullable(),
1213
+ created_by_display_name: z.string().optional().nullable(),
1214
+ assigned_to: z.string().optional().nullable(),
1215
+ assigned_to_display_name: z.string().optional().nullable(),
979
1216
  dev_lifecycle: SupportTicketDevLifecycleSchema.optional().nullable(),
980
1217
  credit_value: z.string().optional().nullable(),
981
1218
  delivered_value: z.string().optional().nullable(),
@@ -986,7 +1223,10 @@ const StaffSupportTicketReadSchema = z.object({
986
1223
  created_by: z.string().optional().nullable(),
987
1224
  created_at: z.string().optional().nullable(),
988
1225
  updated_by: z.string().optional().nullable(),
989
- updated_at: z.string().optional().nullable()
1226
+ updated_by_display_name: z.string().optional().nullable(),
1227
+ updated_at: z.string().optional().nullable(),
1228
+ archived_at: z.string().optional().nullable(),
1229
+ archived_by: z.string().optional().nullable()
990
1230
  });
991
1231
  /**
992
1232
  * Paginated staff support_ticket response
@@ -1017,12 +1257,11 @@ const StaffSupportTicketFiltersSchema = PaginationFiltersSchema.extend({
1017
1257
  type: createEnumFilter(SupportTicketTypeFilterSchema).optional(),
1018
1258
  status: createEnumFilter(SupportTicketStatusFilterSchema).optional(),
1019
1259
  approval_status: createEnumFilter(SupportTicketApprovalFilterSchema).optional(),
1020
- priority: createEnumFilter(SupportTicketPriorityFilterSchema).optional(),
1260
+ priority: NumberFilterSchema.optional(),
1021
1261
  dev_lifecycle: createEnumFilter(SupportTicketDevLifecycleFilterSchema).optional(),
1262
+ created_by: StringFilterSchema.optional(),
1022
1263
  title: StringFilterSchema.optional(),
1023
1264
  description: StringFilterSchema.optional(),
1024
- requester_name: StringFilterSchema.optional(),
1025
- requester_email: StringFilterSchema.optional(),
1026
1265
  is_locked: BooleanFilterSchema.optional(),
1027
1266
  credit_value: NumberFilterSchema.optional(),
1028
1267
  delivered_value: NumberFilterSchema.optional(),
@@ -1059,13 +1298,14 @@ const StaffSupportTicketInputBaseSchema = z.object({
1059
1298
  title: z.string().min(5, "Please add a more descriptive title (at least 5 characters)").max(256, "Title is too long - keep it brief (under 256 characters)"),
1060
1299
  description: z.string().optional().nullable(),
1061
1300
  type: SupportTicketTypeSchema,
1062
- priority: SupportTicketPrioritySchema,
1301
+ priority: SupportTicketPriorityNumberSchema,
1063
1302
  dev_lifecycle: SupportTicketDevLifecycleUpdateSchema.optional(),
1064
1303
  credit_value: z.string().regex(DECIMAL_AMOUNT_REGEX, DECIMAL_AMOUNT_ERROR_MESSAGE).optional().nullable(),
1065
1304
  delivered_value: z.string().regex(DECIMAL_AMOUNT_2_DECIMALS_OR_EMPTY_REGEX, DECIMAL_AMOUNT_2_DECIMALS_OR_EMPTY_ERROR_MESSAGE).optional().nullable(),
1066
1305
  start_at: z.string().regex(/\d{4}-\d{2}-\d{2}/, "Date must be in the format YYYY-MM-DD").optional().nullable(),
1067
1306
  target_at: z.string().regex(/\d{4}-\d{2}-\d{2}/, "Date must be in the format YYYY-MM-DD").optional().nullable(),
1068
- completed_at: z.string().regex(/\d{4}-\d{2}-\d{2}/, "Date must be in the format YYYY-MM-DD").optional().nullable()
1307
+ completed_at: z.string().regex(/\d{4}-\d{2}-\d{2}/, "Date must be in the format YYYY-MM-DD").optional().nullable(),
1308
+ assigned_to: z.string().optional().nullable()
1069
1309
  });
1070
1310
  const StaffSupportTicketCreateSchema = StaffSupportTicketInputBaseSchema.extend({ is_internal: z.boolean().optional() });
1071
1311
  const StaffSupportTicketUpdateSchema = StaffSupportTicketInputBaseSchema.extend({ id: z.string() });
@@ -1080,8 +1320,12 @@ const StaffSupportTicketInputSchema = StaffSupportTicketUpdateSchema;
1080
1320
  /**
1081
1321
  * Approve support_ticket (PENDING → APPROVED)
1082
1322
  * Deducts credits and sets dev_lifecycle to BACKLOG
1323
+ * credit_value is required - can be set/updated in the approve flow
1083
1324
  */
1084
- const ApproveSupportTicketSchema = z.object({ id: z.string() });
1325
+ const ApproveSupportTicketSchema = z.object({
1326
+ id: z.string(),
1327
+ credit_value: z.string().min(0, "Credit value is required to approve").regex(DECIMAL_AMOUNT_REGEX, DECIMAL_AMOUNT_ERROR_MESSAGE).refine((val) => parseFloat(val) >= 0, "Must be 0 or greater")
1328
+ });
1085
1329
  /**
1086
1330
  * Reject support_ticket (PENDING → REJECTED)
1087
1331
  * Locks the support_ticket without deducting credits
@@ -1119,6 +1363,37 @@ const CancelInternalTaskSchema = z.object({ id: z.string() });
1119
1363
  * Clears completed_at timestamp and reopens task for more work
1120
1364
  */
1121
1365
  const ReactivateInternalTaskSchema = z.object({ id: z.string() });
1366
+ /**
1367
+ * Archive support ticket (COMPLETED only)
1368
+ * Only completed tickets (dev_lifecycle = DEPLOYED) can be archived.
1369
+ * Archiving locks comments for both customer and staff.
1370
+ */
1371
+ const ArchiveSupportTicketSchema = z.object({ id: z.string() });
1372
+
1373
+ //#endregion
1374
+ //#region src/validation/support_ticket/support_ticket_staff/support_ticket_event_types_zod.ts
1375
+ const SupportTicketEventTypeValues = [
1376
+ "TICKET_CREATED",
1377
+ "TICKET_ASSIGNED",
1378
+ "TICKET_UPDATED",
1379
+ "APPROVAL_STATUS_CHANGED",
1380
+ "DEV_LIFECYCLE_CHANGED",
1381
+ "PRIORITY_CHANGED",
1382
+ "NEW_CUSTOMER_NOTE",
1383
+ "NEW_INTERNAL_NOTE",
1384
+ "NEW_FOLLOWUP",
1385
+ "FOLLOWUP_COMPLETED"
1386
+ ];
1387
+ const SupportTicketEventTypeEnum = z.enum(SupportTicketEventTypeValues);
1388
+
1389
+ //#endregion
1390
+ //#region src/validation/support_ticket/support_ticket_staff/support_ticket_subscriber_zod.ts
1391
+ /** Support-ticket-specific create input: uses support_ticket_id instead of generic record_type/record_id */
1392
+ const SupportTicketSubscriberCreateSchema = z.object({
1393
+ support_ticket_id: z.string().min(1, "Support ticket ID is required"),
1394
+ user_id: z.string().min(1, "User ID is required"),
1395
+ subscribed_events: z.array(SupportTicketEventTypeEnum).optional().nullable()
1396
+ });
1122
1397
 
1123
1398
  //#endregion
1124
1399
  //#region src/validation/support_ticket/support_ticket_enrichment.ts
@@ -1202,7 +1477,9 @@ const TeamReadSchema = TeamCreateSchema.extend({
1202
1477
  created_at: z.string(),
1203
1478
  updated_at: z.string().optional().nullable(),
1204
1479
  created_by: z.string(),
1480
+ created_by_display_name: z.string().optional().nullable(),
1205
1481
  updated_by: z.string().optional().nullable(),
1482
+ updated_by_display_name: z.string().optional().nullable(),
1206
1483
  archived_at: z.string().optional().nullable(),
1207
1484
  archived_by: z.string().optional().nullable()
1208
1485
  });
@@ -1319,8 +1596,10 @@ const TeamMemberReadSchema = z.object({
1319
1596
  time_zone: z.string().optional().nullable(),
1320
1597
  created_at: z.string(),
1321
1598
  created_by: z.string(),
1599
+ created_by_display_name: z.string().optional().nullable(),
1322
1600
  updated_at: z.string().optional().nullable(),
1323
1601
  updated_by: z.string().optional().nullable(),
1602
+ updated_by_display_name: z.string().optional().nullable(),
1324
1603
  deleted_at: z.string().optional().nullable(),
1325
1604
  deleted_by: z.string().optional().nullable()
1326
1605
  });
@@ -1364,7 +1643,8 @@ const UserUpdateSchema = z.object({
1364
1643
  const UserProfileBaseSchema = z.object({
1365
1644
  first_name: z.string().max(255, "First name is too long").nullable().optional(),
1366
1645
  last_name: z.string().max(255, "Last name is too long").nullable().optional(),
1367
- bio: z.string().max(1e3, "Bio is too long").nullable().optional()
1646
+ bio: z.string().max(1e3, "Bio is too long").nullable().optional(),
1647
+ notification_email: z.string().email("Invalid notification email").nullable().optional()
1368
1648
  });
1369
1649
  /**
1370
1650
  * Schema for updating a user profile
@@ -1420,6 +1700,11 @@ const loginResponseSchema = z.object({
1420
1700
  user_details_token: z.string()
1421
1701
  });
1422
1702
 
1703
+ //#endregion
1704
+ //#region src/api/saved-filter-api.ts
1705
+ /** Maximum presets per context (e.g. per page like trackers, followups) */
1706
+ const MAX_PRESETS_PER_CONTEXT = 10;
1707
+
1423
1708
  //#endregion
1424
1709
  //#region src/utils/enum_labels.ts
1425
1710
  /**
@@ -1676,5 +1961,5 @@ const formatDollar = (amount) => {
1676
1961
  };
1677
1962
 
1678
1963
  //#endregion
1679
- export { AddCreditsSchema, ApproveSupportTicketSchema, AttachmentCreateSchema, AttachmentFiltersSchema, AttachmentFiltersSchema as attachmentFilters_zod, AttachmentFolderCreateSchema, AttachmentFolderReadSchema, AttachmentFolderUpdateSchema, AttachmentPageSchema, AttachmentPageSchema as attachmentPage_zod, AttachmentReadSchema, AttachmentReadSchema as attachment_zod, AttachmentUpdateSchema, BaseFilterSchema, BooleanFilterSchema, CancelInternalTaskSchema, CompleteSupportTicketSchema, CreditBalanceSchema, CreditTransactionFiltersSchema, CreditTransactionPageSchema, CreditTransactionReadSchema, CreditTransactionTypeEnum, CustomerSupportTicketCreateSchema, CustomerSupportTicketFiltersSchema, CustomerSupportTicketPageSchema, CustomerSupportTicketReadSchema, CustomerSupportTicketUpdateSchema, DECIMAL_AMOUNT_2_DECIMALS_OR_EMPTY_ERROR_MESSAGE, DECIMAL_AMOUNT_2_DECIMALS_OR_EMPTY_REGEX, DECIMAL_AMOUNT_ERROR_MESSAGE, DECIMAL_AMOUNT_REGEX, DataTypeSchema, DateFilterSchema, DateOperatorSchema, DeleteSupportTicketSchema, EmailEntrySchema, EqualityArrayOperatorSchema, EqualityOperatorSchema, FilterConfigSchema, NoteCreateSchema, NoteFiltersSchema, NoteFiltersSortDirectionEnum, NoteReadSchema, NoteUpdateSchema, NumberFilterSchema, NumberOperatorSchema, OPERATORS, PageInfoSchema, PaginationFiltersSchema, ReactivateInternalTaskSchema, ReadNotificationEmailsSchema, RecordConst, RecordTypeValues, RejectSupportTicketSchema, ResetMonthlyBalanceSchema, RevertSupportTicketSchema, SetMonthlyAllocationSchema, SortDirectionSchema, StaffSupportTicketCreateSchema, StaffSupportTicketFiltersSchema, StaffSupportTicketInputSchema, StaffSupportTicketPageSchema, StaffSupportTicketReadSchema, StaffSupportTicketUpdateSchema, StringFilterSchema, StringOperatorSchema, SupportTicketApprovalEnum, SupportTicketApprovalFilterSchema, SupportTicketApprovalSchema, SupportTicketDevLifecycleEnum, SupportTicketDevLifecycleFilterSchema, SupportTicketDevLifecycleSchema, SupportTicketDevLifecycleUpdateEnum, SupportTicketDevLifecycleUpdateSchema, SupportTicketPriorityEnum, SupportTicketPriorityFilterSchema, SupportTicketPrioritySchema, SupportTicketRecordDataSchema, SupportTicketStatusEnum, SupportTicketStatusFilterSchema, SupportTicketStatusSchema, SupportTicketTypeEnum, SupportTicketTypeFilterSchema, SupportTicketTypeSchema, TeamCreateSchema, TeamFiltersSchema, TeamInputBaseSchema, TeamMemberCreateSchema, TeamMemberFiltersSchema, TeamMemberOptionSchema, TeamMemberReadSchema, TeamMemberRoleEnum, TeamMemberRoleFilterSchema, TeamMemberRoleSchema, TeamMemberUpdateSchema, TeamOptionSchema, TeamPageSchema, TeamReadSchema, TeamStatusSchema, TeamUpdateSchema, USER_TYPES, UpdateNotificationEmailsSchema, UserProfileBaseSchema, UserProfileReadSchema, UserProfileUpdateSchema, UserReadSchema, UserTeamMembersSchema, UserTeamsSchema, UserTypeEnum, UserUpdateSchema, addMoney, applyPercentage, changePasswordSchema, createEnumFilter, createEnumLabelMap, createNewEmailEntry, createPaginatedSchema, createSelectOptionsFromLabelMap, createUserSchema, createUserSchemaOutput, divideMoney, enumToDisplayLabel, forgot_password_zod, formatCurrency, formatDollar, isCommonPassword, loginResponseSchema, loginSchema, multiplyMoney, pageInfoSchema, passwordSchema, recordVersionFiltersBreadcrumbSchema, recordVersionFiltersInputBreadcrumbSchema, recordVersionFiltersInputSchema, recordVersionFiltersSchema, recordVersionPageBreadcrumbSchema, recordVersionPageSchema, recordVersionSchema, resetPasswordInputSchema, resetPasswordSchema, roundMoney, sanitizeFileName, signupSchema, subtractMoney, userSessionSchema };
1964
+ export { AddCreditsSchema, ApproveSupportTicketSchema, ArchiveSupportTicketSchema, AttachmentCreateSchema, AttachmentFiltersSchema, AttachmentFiltersSchema as attachmentFilters_zod, AttachmentFolderCreateSchema, AttachmentFolderReadSchema, AttachmentFolderUpdateSchema, AttachmentPageSchema, AttachmentPageSchema as attachmentPage_zod, AttachmentReadSchema, AttachmentReadSchema as attachment_zod, AttachmentUpdateSchema, BaseFilterSchema, BooleanFilterSchema, CancelInternalTaskSchema, CompleteSupportTicketSchema, CreditBalanceSchema, CreditTransactionFiltersSchema, CreditTransactionPageSchema, CreditTransactionReadSchema, CreditTransactionTypeEnum, CustomerSupportTicketCreateSchema, CustomerSupportTicketFiltersSchema, CustomerSupportTicketPageSchema, CustomerSupportTicketReadSchema, CustomerSupportTicketUpdateSchema, DECIMAL_AMOUNT_2_DECIMALS_OR_EMPTY_ERROR_MESSAGE, DECIMAL_AMOUNT_2_DECIMALS_OR_EMPTY_REGEX, DECIMAL_AMOUNT_ERROR_MESSAGE, DECIMAL_AMOUNT_REGEX, DEFAULT_USER_TYPE, DataTypeSchema, DateFilterSchema, DateOperatorSchema, DeleteSupportTicketSchema, EqualityArrayOperatorSchema, EqualityOperatorSchema, FilterConfigSchema, MAX_PRESETS_PER_CONTEXT, NoteCreateSchema, NoteFiltersSchema, NoteFiltersSortDirectionEnum, NoteReadSchema, NoteUpdateSchema, NumberFilterSchema, NumberOperatorSchema, OPERATORS, PageInfoSchema, PaginationFiltersSchema, ReactivateInternalTaskSchema, RecordConst, RecordSubscriberCreateSchema, RecordSubscriberReadSchema, RecordSubscriberUpdateSchema, RecordTypeValues, RejectSupportTicketSchema, ResetMonthlyBalanceSchema, RevertSupportTicketSchema, SUPPORT_TICKET_APPROVAL_FILTER_OPTIONS, SUPPORT_TICKET_DEV_LIFECYCLE_FILTER_OPTIONS, SUPPORT_TICKET_NUMBER_TO_PRIORITY, SUPPORT_TICKET_PRIORITY_FILTER_OPTIONS, SUPPORT_TICKET_PRIORITY_NUMBER_TO_LABEL, SUPPORT_TICKET_PRIORITY_TO_NUMBER, SUPPORT_TICKET_STATUS_FILTER_OPTIONS, SUPPORT_TICKET_TYPE_FILTER_OPTIONS, SavedFilterCreateSchema, SavedFilterReadSchema, SavedFilterUpdateSchema, SetMonthlyAllocationSchema, SortDirectionSchema, StaffSupportTicketCreateSchema, StaffSupportTicketFiltersSchema, StaffSupportTicketInputSchema, StaffSupportTicketPageSchema, StaffSupportTicketReadSchema, StaffSupportTicketUpdateSchema, StringFilterSchema, StringOperatorSchema, SupportTicketApprovalEnum, SupportTicketApprovalFilterSchema, SupportTicketApprovalSchema, SupportTicketDevLifecycleEnum, SupportTicketDevLifecycleFilterSchema, SupportTicketDevLifecycleSchema, SupportTicketDevLifecycleUpdateEnum, SupportTicketDevLifecycleUpdateSchema, SupportTicketEventTypeEnum, SupportTicketEventTypeValues, SupportTicketPriorityEnum, SupportTicketPriorityFilterSchema, SupportTicketPriorityNumberEnum, SupportTicketPriorityNumberSchema, SupportTicketPrioritySchema, SupportTicketRecordDataSchema, SupportTicketStatusEnum, SupportTicketStatusFilterSchema, SupportTicketStatusSchema, SupportTicketSubscriberCreateSchema, SupportTicketTypeEnum, SupportTicketTypeFilterSchema, SupportTicketTypeSchema, TeamCreateSchema, TeamFiltersSchema, TeamInputBaseSchema, TeamMemberCreateSchema, TeamMemberFiltersSchema, TeamMemberOptionSchema, TeamMemberReadSchema, TeamMemberRoleEnum, TeamMemberRoleFilterSchema, TeamMemberRoleSchema, TeamMemberUpdateSchema, TeamOptionSchema, TeamPageSchema, TeamReadSchema, TeamStatusSchema, TeamUpdateSchema, USER_TYPES, UserProfileBaseSchema, UserProfileReadSchema, UserProfileUpdateSchema, UserReadSchema, UserTeamMembersSchema, UserTeamsSchema, UserTypeEnum, UserUpdateSchema, addMoney, applyPercentage, changePasswordSchema, createEnumFilter, createEnumLabelMap, createPaginatedSchema, createSelectOptionsFromLabelMap, createUserSchema, createUserSchemaOutput, divideMoney, enumToDisplayLabel, forgot_password_zod, formatCurrency, formatDollar, isCommonPassword, loginResponseSchema, loginSchema, multiplyMoney, pageInfoSchema, passwordSchema, recordVersionFiltersBreadcrumbSchema, recordVersionFiltersInputBreadcrumbSchema, recordVersionFiltersInputSchema, recordVersionFiltersSchema, recordVersionPageBreadcrumbSchema, recordVersionPageSchema, recordVersionSchema, recordVersionTrackerActivityInputSchema, resetPasswordInputSchema, resetPasswordSchema, roundMoney, sanitizeFileName, signupSchema, subtractMoney, supportTicketNumberToPriority, supportTicketPriorityToNumber, userSessionSchema };
1680
1965
  //# sourceMappingURL=index.mjs.map