@kl1/contracts 1.0.15 → 1.0.17

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.
Files changed (39) hide show
  1. package/dist/index.js +1551 -851
  2. package/dist/index.js.map +1 -1
  3. package/dist/index.mjs +1551 -851
  4. package/dist/index.mjs.map +1 -1
  5. package/dist/src/app/index.d.ts +17 -0
  6. package/dist/src/app/index.d.ts.map +1 -0
  7. package/dist/src/call-log/schema.d.ts +2 -2
  8. package/dist/src/chat/index.d.ts +1437 -3140
  9. package/dist/src/chat/index.d.ts.map +1 -1
  10. package/dist/src/chat/schema.d.ts +256 -47
  11. package/dist/src/chat/schema.d.ts.map +1 -1
  12. package/dist/src/chat/validation.d.ts +5327 -92
  13. package/dist/src/chat/validation.d.ts.map +1 -1
  14. package/dist/src/contact/index.d.ts +4079 -581
  15. package/dist/src/contact/index.d.ts.map +1 -1
  16. package/dist/src/contact/validation.d.ts +3148 -0
  17. package/dist/src/contact/validation.d.ts.map +1 -1
  18. package/dist/src/contract.d.ts +25332 -13715
  19. package/dist/src/contract.d.ts.map +1 -1
  20. package/dist/src/cx-log/index.d.ts +8 -8
  21. package/dist/src/cx-log/schema.d.ts +4 -4
  22. package/dist/src/mail/mail-contract.d.ts +1316 -1316
  23. package/dist/src/mail/mail-server.d.ts +216 -0
  24. package/dist/src/mail/mail-server.d.ts.map +1 -0
  25. package/dist/src/mail/message-contract.d.ts +56 -56
  26. package/dist/src/mail/room-contract.d.ts +1254 -1254
  27. package/dist/src/mail/schemas/message.schema.d.ts +33 -33
  28. package/dist/src/mail/schemas/room-validation.schema.d.ts +408 -408
  29. package/dist/src/mail/schemas/room.schema.d.ts +270 -270
  30. package/dist/src/messenger/index.d.ts +5232 -54
  31. package/dist/src/messenger/index.d.ts.map +1 -1
  32. package/dist/src/platform-contact/schema.d.ts +2 -2
  33. package/dist/src/ticket/index.d.ts +4662 -0
  34. package/dist/src/ticket/index.d.ts.map +1 -0
  35. package/dist/src/ticket/schema.d.ts +677 -5
  36. package/dist/src/ticket/schema.d.ts.map +1 -1
  37. package/dist/src/ticket/validation.d.ts +637 -0
  38. package/dist/src/ticket/validation.d.ts.map +1 -0
  39. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/contract.ts
2
- import { initContract as initContract27 } from "@ts-rest/core";
2
+ import { initContract as initContract28 } from "@ts-rest/core";
3
3
 
4
4
  // src/attribute/index.ts
5
5
  import { initContract } from "@ts-rest/core";
@@ -654,7 +654,7 @@ var channelContract = initContract5().router(
654
654
 
655
655
  // src/chat/index.ts
656
656
  import { initContract as initContract6 } from "@ts-rest/core";
657
- import z24 from "zod";
657
+ import z25 from "zod";
658
658
 
659
659
  // src/contact/schema.ts
660
660
  import z20 from "zod";
@@ -767,18 +767,38 @@ var ContactSchema = z20.object({
767
767
  });
768
768
 
769
769
  // src/chat/schema.ts
770
+ import z22 from "zod";
771
+
772
+ // src/cx-log/schema.ts
770
773
  import z21 from "zod";
771
- var MessageDirectionTypeSchema = z21.enum([
774
+ var CxLogSchema = DefaultEntitySchema.extend({
775
+ caseId: z21.number(),
776
+ entityId: z21.string().uuid(),
777
+ entityName: z21.string(),
778
+ contactId: z21.string().uuid().nullable(),
779
+ channel: z21.string().nullable(),
780
+ queueId: z21.string().uuid().nullable(),
781
+ agentId: z21.string().uuid().nullable(),
782
+ direction: z21.string().nullable(),
783
+ startedDate: z21.date().nullable(),
784
+ handledTime: z21.number().nullable(),
785
+ firstResponseTime: z21.number().nullable(),
786
+ disposition: z21.string().nullable()
787
+ });
788
+
789
+ // src/chat/schema.ts
790
+ var MessageDirectionTypeSchema = z22.enum([
772
791
  "incoming",
773
792
  "outgoing",
774
793
  "system"
775
794
  ]);
776
- var MessageTypeSchema = z21.enum([
795
+ var MessageTypeSchema = z22.enum([
777
796
  "text",
778
797
  "image",
779
798
  "video",
780
799
  "audio",
781
800
  "file",
801
+ "imagemap",
782
802
  "fallback",
783
803
  "location",
784
804
  "attachment",
@@ -792,136 +812,138 @@ var MessageTypeSchema = z21.enum([
792
812
  "updated",
793
813
  "started"
794
814
  ]);
795
- var MessageLocaleTypeSchema = z21.enum([
796
- "mm",
797
- "en",
798
- "th"
799
- ]);
800
- var PlatformContactMetadataSchema = z21.object({
801
- id: z21.string(),
802
- name: z21.string(),
803
- picture: z21.string(),
804
- additionalCredentials: z21.any()
815
+ var MessageLocaleTypeSchema = z22.enum(["mm", "en", "th"]);
816
+ var PlatformContactMetadataSchema = z22.object({
817
+ id: z22.string(),
818
+ name: z22.string(),
819
+ picture: z22.string(),
820
+ additionalCredentials: z22.any()
805
821
  });
806
822
  var PlatformContactSchema = DefaultEntitySchema.extend({
807
- channelId: z21.string().uuid(),
808
- socialPlatformId: z21.string().uuid(),
809
- platform: ChannelTypeSchema,
823
+ channelId: z22.string().uuid(),
824
+ socialPlatformId: z22.string().uuid(),
825
+ type: ChannelTypeSchema,
810
826
  metadata: PlatformContactMetadataSchema,
811
827
  contact: ContactSchema
812
828
  });
813
829
  var RoomSchema = DefaultEntitySchema.extend({
814
- lastMessage: z21.string(),
815
- handleTime: z21.number(),
816
- isSolved: z21.boolean(),
817
- closeAt: z21.date(),
818
- unreadCount: z21.number(),
819
- firstResponseTime: z21.date(),
820
- isLatest: z21.boolean(),
830
+ lastMessage: z22.string(),
831
+ handleTime: z22.number(),
832
+ closeAt: z22.date(),
833
+ unreadCount: z22.number(),
834
+ firstResponseAt: z22.date(),
835
+ firstResponseTime: z22.number(),
836
+ isLatest: z22.boolean(),
821
837
  direction: MessageDirectionTypeSchema,
822
838
  platformContact: PlatformContactSchema,
823
839
  actor: UserSchema,
824
840
  assignee: UserSchema,
825
- channel: ChannelSchema
841
+ channel: ChannelSchema,
842
+ cxLog: CxLogSchema
826
843
  });
827
844
  var MessageSchema = DefaultEntitySchema.extend({
828
- message: z21.string(),
845
+ message: z22.string(),
829
846
  direction: MessageDirectionTypeSchema,
830
847
  type: MessageTypeSchema,
831
- readAt: z21.date(),
832
- metadata: z21.any(),
833
- platformId: z21.string(),
834
- platformMessageId: z21.string(),
835
- replyPlatformMessageId: z21.string(),
836
- template: z21.any(),
848
+ readAt: z22.date(),
849
+ metadata: z22.any(),
850
+ platformId: z22.string(),
851
+ platformMessageId: z22.string(),
852
+ replyPlatformMessageId: z22.string(),
853
+ template: z22.any(),
837
854
  locale: MessageLocaleTypeSchema,
838
- isSent: z21.boolean(),
855
+ url: z22.string(),
856
+ previewUrl: z22.string(),
857
+ imageSetId: z22.string(),
839
858
  room: RoomSchema,
840
859
  upload: UploadSchema,
841
860
  actor: UserSchema,
842
861
  assignee: UserSchema,
843
862
  sender: UserSchema
844
863
  });
845
- var UnreadCountsByAssigneeSchema = z21.object({
846
- assigneeId: z21.string(),
847
- totalUnreadCount: z21.number()
864
+ var UnreadCountsByAssigneeSchema = z22.object({
865
+ assigneeId: z22.string(),
866
+ totalUnreadCount: z22.number()
848
867
  });
849
868
 
850
869
  // src/chat/validation.ts
851
- import z23 from "zod";
870
+ import z24 from "zod";
852
871
 
853
872
  // src/custom-field/schema.ts
854
- import z22 from "zod";
873
+ import z23 from "zod";
855
874
  var CustomFieldSchema = DefaultEntitySchema.extend({
856
- textValue: z22.string().nullable(),
857
- booleanValue: z22.boolean().nullable(),
858
- numberValue: z22.number().nullable(),
859
- dateValue: z22.date().nullable(),
860
- entityId: z22.string().uuid(),
861
- attributeId: z22.string().uuid()
875
+ textValue: z23.string().nullable(),
876
+ booleanValue: z23.boolean().nullable(),
877
+ numberValue: z23.number().nullable(),
878
+ dateValue: z23.date().nullable(),
879
+ entityId: z23.string().uuid(),
880
+ attributeId: z23.string().uuid()
862
881
  });
863
882
 
864
883
  // src/chat/validation.ts
865
- var GetRoomsSchema = z23.object({
866
- page: z23.coerce.number().positive().default(1),
867
- pageSize: z23.coerce.number().positive().default(20),
868
- contactTagIds: z23.string().array().optional(),
869
- contactIds: z23.string().array().optional(),
870
- agentIds: z23.string().array().optional(),
871
- roomTagIds: z23.string().array().optional(),
872
- keyword: z23.string().optional(),
873
- company: z23.string().array().optional(),
874
- channel: z23.string().array().optional(),
875
- name: z23.string().optional(),
876
- address: z23.string().optional(),
877
- contactGroups: z23.string().array().optional(),
878
- selectedDate: z23.string().optional(),
879
- customFields: z23.array(CustomFieldSchema).optional(),
880
- tags: z23.string().array().optional(),
881
- phone: z23.string().optional(),
882
- email: z23.string().optional(),
883
- notes: z23.string().optional(),
884
- tab: z23.string().optional()
885
- });
886
- var UpdateRoomTagsAndNotesSchema = z23.object({
887
- notes: z23.string().optional(),
888
- tags: z23.string().array().optional()
884
+ var GetRoomsSchema = z24.object({
885
+ page: z24.coerce.number().positive().default(1),
886
+ pageSize: z24.coerce.number().positive().default(20),
887
+ contactTagIds: z24.string().array().optional(),
888
+ contactIds: z24.string().array().optional(),
889
+ agentIds: z24.string().array().optional(),
890
+ roomTagIds: z24.string().array().optional(),
891
+ keyword: z24.string().optional(),
892
+ company: z24.string().array().optional(),
893
+ channel: z24.string().array().optional(),
894
+ name: z24.string().optional(),
895
+ address: z24.string().optional(),
896
+ contactGroups: z24.string().array().optional(),
897
+ selectedDate: z24.string().optional(),
898
+ customFields: z24.array(CustomFieldSchema).optional(),
899
+ tags: z24.string().array().optional(),
900
+ phone: z24.string().optional(),
901
+ email: z24.string().optional(),
902
+ notes: z24.string().optional(),
903
+ tab: z24.string().optional()
904
+ });
905
+ var UpdateRoomTagsAndNotesSchema = z24.object({
906
+ note: z24.string().optional(),
907
+ tags: TagSchema.array().optional()
889
908
  });
890
909
  var UpdateRoomAttributesSchema = UpdateRoomTagsAndNotesSchema.extend({
891
- roomId: z23.string().uuid()
892
- });
893
- var MessageAttachmentSchema = z23.object({
894
- bucketName: z23.string(),
895
- fileKey: z23.string(),
896
- fileName: z23.string(),
897
- fileSize: z23.number(),
898
- url: z23.string(),
910
+ roomId: z24.string().uuid()
911
+ });
912
+ var MessageAttachmentSchema = z24.object({
913
+ bucketName: z24.string(),
914
+ fileKey: z24.string(),
915
+ fileName: z24.string(),
916
+ fileSize: z24.number(),
917
+ url: z24.string(),
899
918
  fileType: MessageTypeSchema,
900
- thumbnailUrl: z23.string().optional()
919
+ thumbnailUrl: z24.string().optional()
901
920
  });
902
- var SendMessageSchema = z23.object({
903
- roomId: z23.string().uuid(),
921
+ var SendMessageSchema = z24.object({
922
+ roomId: z24.string().uuid(),
904
923
  messageType: MessageTypeSchema,
905
- message: z23.string().optional(),
924
+ message: z24.string().optional(),
906
925
  direction: MessageDirectionTypeSchema,
907
926
  messageAttachments: MessageAttachmentSchema.optional(),
908
- user: UserSchema.optional(),
909
- packageId: z23.number().optional(),
910
- stickerId: z23.number().optional()
927
+ user: UserSchema,
928
+ packageId: z24.number().optional(),
929
+ stickerId: z24.number().optional()
911
930
  });
912
- var SolveRoomSchema = z23.object({
913
- roomId: z23.string()
931
+ var SolveRoomSchema = z24.object({
932
+ roomId: z24.string()
914
933
  });
915
934
  var UpdateAssigneeSchema = SolveRoomSchema.extend({
916
- assigneeId: z23.string().uuid()
935
+ assigneeId: z24.string().uuid()
917
936
  });
918
937
  var SearchRoomsSchema = DefaultQueryParamsSchema.extend({
919
- query: z23.string()
938
+ query: z24.string()
920
939
  });
921
- var SendMessageToPlatformSchema = z23.object({
940
+ var SendMessageToPlatformSchema = z24.object({
922
941
  room: RoomSchema,
923
942
  message: MessageSchema,
924
- url: z23.string().optional()
943
+ url: z24.string().optional()
944
+ });
945
+ var SendMessageResponseSchema = DefaultSuccessResponseSchema.extend({
946
+ data: MessageSchema
925
947
  });
926
948
 
927
949
  // src/chat/index.ts
@@ -932,11 +954,11 @@ var mainChatContract = initContract6().router(
932
954
  path: "/rooms",
933
955
  responses: {
934
956
  200: DefaultSuccessResponseSchema.extend({
935
- total: z24.number(),
936
- page: z24.number(),
937
- pageSize: z24.number(),
938
- data: z24.array(RoomSchema),
939
- unreadCountsByAssignee: z24.array(UnreadCountsByAssigneeSchema)
957
+ total: z25.number(),
958
+ page: z25.number(),
959
+ pageSize: z25.number(),
960
+ data: z25.array(RoomSchema),
961
+ unreadCountsByAssignee: z25.array(UnreadCountsByAssigneeSchema)
940
962
  }),
941
963
  401: DefaultUnauthorizedSchema
942
964
  },
@@ -946,8 +968,8 @@ var mainChatContract = initContract6().router(
946
968
  getRoomContact: {
947
969
  method: "GET",
948
970
  path: "/contact/:contactId",
949
- pathParams: z24.object({
950
- contactId: z24.string().uuid()
971
+ pathParams: z25.object({
972
+ contactId: z25.string().uuid()
951
973
  }),
952
974
  responses: {
953
975
  200: DefaultSuccessResponseSchema.extend({
@@ -967,17 +989,6 @@ var mainChatContract = initContract6().router(
967
989
  },
968
990
  summary: "Update room attributes"
969
991
  },
970
- updateRoomTagsAndNotes: {
971
- method: "PATCH",
972
- path: "/room/:roomId",
973
- body: UpdateRoomAttributesSchema,
974
- responses: {
975
- 200: DefaultSuccessResponseSchema.extend({
976
- data: RoomSchema
977
- })
978
- },
979
- summary: "Update room tags and notes"
980
- },
981
992
  sendMessage: {
982
993
  method: "POST",
983
994
  path: "/message",
@@ -990,14 +1001,18 @@ var mainChatContract = initContract6().router(
990
1001
  getMessages: {
991
1002
  method: "GET",
992
1003
  path: "/message/:roomId",
993
- pathParams: z24.object({
994
- roomId: z24.string().uuid()
1004
+ pathParams: z25.object({
1005
+ roomId: z25.string().uuid()
995
1006
  }),
996
1007
  responses: {
997
1008
  200: DefaultSuccessResponseSchema.extend({
998
- data: z24.array(MessageSchema)
1009
+ total: z25.number(),
1010
+ page: z25.number(),
1011
+ pageSize: z25.number(),
1012
+ data: z25.array(MessageSchema)
999
1013
  })
1000
1014
  },
1015
+ query: DefaultQueryParamsSchema,
1001
1016
  summary: "Get messages"
1002
1017
  },
1003
1018
  solveRoom: {
@@ -1007,7 +1022,7 @@ var mainChatContract = initContract6().router(
1007
1022
  responses: {
1008
1023
  200: DefaultSuccessResponseSchema.extend({
1009
1024
  data: RoomSchema.extend({
1010
- solveMessage: z24.string()
1025
+ solveMessage: z25.string()
1011
1026
  })
1012
1027
  }),
1013
1028
  409: DefaultErrorResponseSchema
@@ -1028,8 +1043,8 @@ var mainChatContract = initContract6().router(
1028
1043
  getRoom: {
1029
1044
  method: "GET",
1030
1045
  path: "/room/:roomId",
1031
- pathParams: z24.object({
1032
- roomId: z24.string().uuid()
1046
+ pathParams: z25.object({
1047
+ roomId: z25.string().uuid()
1033
1048
  }),
1034
1049
  responses: {
1035
1050
  200: DefaultSuccessResponseSchema.extend({
@@ -1041,15 +1056,15 @@ var mainChatContract = initContract6().router(
1041
1056
  },
1042
1057
  createRoom: {
1043
1058
  method: "POST",
1044
- path: "/room/create/:roomid",
1045
- pathParams: z24.object({
1046
- roomId: z24.string().uuid()
1059
+ path: "/room/create/:platformContactId",
1060
+ pathParams: z25.object({
1061
+ platformContactId: z25.string().uuid()
1047
1062
  }),
1048
1063
  responses: {
1049
1064
  200: DefaultSuccessResponseSchema.extend({
1050
1065
  data: RoomSchema.extend({
1051
1066
  contact: ContactSchema,
1052
- openMessage: z24.string()
1067
+ openMessage: z25.string()
1053
1068
  })
1054
1069
  })
1055
1070
  },
@@ -1059,13 +1074,13 @@ var mainChatContract = initContract6().router(
1059
1074
  readRoom: {
1060
1075
  method: "POST",
1061
1076
  path: "/room/:roomid/read",
1062
- pathParams: z24.object({
1063
- roomId: z24.string().uuid()
1077
+ pathParams: z25.object({
1078
+ roomId: z25.string().uuid()
1064
1079
  }),
1065
1080
  responses: {
1066
1081
  200: DefaultSuccessResponseSchema.extend({
1067
1082
  data: RoomSchema.extend({
1068
- description: z24.string().nullable()
1083
+ description: z25.string().nullable()
1069
1084
  })
1070
1085
  })
1071
1086
  },
@@ -1077,10 +1092,10 @@ var mainChatContract = initContract6().router(
1077
1092
  path: "/search",
1078
1093
  responses: {
1079
1094
  200: DefaultSuccessResponseSchema.extend({
1080
- total: z24.number(),
1081
- page: z24.number(),
1082
- pageSize: z24.number(),
1083
- data: z24.array(RoomSchema)
1095
+ total: z25.number(),
1096
+ page: z25.number(),
1097
+ pageSize: z25.number(),
1098
+ data: z25.array(RoomSchema)
1084
1099
  })
1085
1100
  },
1086
1101
  query: SearchRoomsSchema,
@@ -1095,98 +1110,113 @@ var mainChatContract = initContract6().router(
1095
1110
 
1096
1111
  // src/contact/index.ts
1097
1112
  import { initContract as initContract7 } from "@ts-rest/core";
1098
- import z26 from "zod";
1113
+ import z27 from "zod";
1099
1114
 
1100
1115
  // src/contact/validation.ts
1101
- import z25 from "zod";
1102
- var BaseSchema = z25.object({
1103
- isRequired: z25.boolean(),
1104
- attributeId: z25.string()
1116
+ import z26 from "zod";
1117
+ var BaseSchema = z26.object({
1118
+ isRequired: z26.boolean(),
1119
+ attributeId: z26.string()
1105
1120
  });
1106
1121
  var SingleValue = {
1107
- value: z25.string()
1122
+ value: z26.string()
1108
1123
  };
1109
1124
  var ContactContractValidationSchema = {
1110
1125
  create: {
1111
- request: z25.object({
1126
+ request: z26.object({
1112
1127
  name: BaseSchema.extend(SingleValue),
1113
1128
  email: BaseSchema.extend({
1114
- value: z25.array(
1115
- z25.object({
1116
- email: z25.string(),
1117
- isPrimary: z25.boolean()
1129
+ value: z26.array(
1130
+ z26.object({
1131
+ email: z26.string(),
1132
+ isPrimary: z26.boolean()
1118
1133
  })
1119
1134
  )
1120
1135
  }),
1121
1136
  channel: BaseSchema.extend(SingleValue),
1122
1137
  address: BaseSchema.extend(SingleValue),
1123
1138
  phone: BaseSchema.extend({
1124
- value: z25.array(
1125
- z25.object({
1126
- phone: z25.string(),
1127
- isPrimary: z25.boolean()
1139
+ value: z26.array(
1140
+ z26.object({
1141
+ phone: z26.string(),
1142
+ isPrimary: z26.boolean()
1128
1143
  })
1129
1144
  )
1130
1145
  }).optional(),
1131
1146
  notes: BaseSchema.extend(SingleValue),
1132
1147
  tags: BaseSchema.extend({
1133
- value: z25.array(z25.string())
1148
+ value: z26.array(z26.string())
1134
1149
  }),
1135
1150
  company: BaseSchema.extend(SingleValue),
1136
- customFields: z25.array(
1151
+ customFields: z26.array(
1137
1152
  BaseSchema.extend({
1138
- value: z25.union([z25.string(), z25.array(z25.string())]),
1139
- type: z25.string(),
1140
- isDefaultAttribute: z25.boolean()
1153
+ value: z26.union([z26.string(), z26.array(z26.string())]),
1154
+ type: z26.string(),
1155
+ isDefaultAttribute: z26.boolean()
1141
1156
  })
1142
1157
  )
1143
1158
  }),
1144
- response: z25.string()
1159
+ response: z26.string()
1145
1160
  },
1146
1161
  getById: {
1147
- request: z25.object({
1148
- id: z25.string().uuid()
1162
+ request: z26.object({
1163
+ id: z26.string().uuid()
1149
1164
  }),
1150
1165
  response: ContactSchema
1151
1166
  },
1152
1167
  delete: {
1153
- request: z25.object({
1154
- id: z25.string().uuid()
1168
+ request: z26.object({
1169
+ id: z26.string().uuid()
1155
1170
  }),
1156
- response: z25.string()
1171
+ response: z26.string()
1157
1172
  },
1158
1173
  getAll: {
1159
- request: z25.object({
1160
- page: z25.coerce.number().default(1),
1161
- pageSize: z25.coerce.number().default(10),
1162
- keyword: z25.string().optional(),
1163
- company: z25.array(z25.string().uuid()),
1164
- name: z25.string(),
1165
- address: z25.string(),
1166
- channel: z25.array(z25.string()),
1167
- selectedDate: z25.string(),
1168
- customFields: z25.array(
1169
- z25.object({
1170
- attributeId: z25.string().uuid(),
1171
- type: z25.string(),
1172
- value: z25.union([z25.string(), z25.array(z25.string())])
1174
+ request: z26.object({
1175
+ page: z26.coerce.number().default(1),
1176
+ pageSize: z26.coerce.number().default(10),
1177
+ keyword: z26.string().optional(),
1178
+ company: z26.array(z26.string().uuid()),
1179
+ name: z26.string(),
1180
+ address: z26.string(),
1181
+ channel: z26.array(z26.string()),
1182
+ selectedDate: z26.string(),
1183
+ customFields: z26.array(
1184
+ z26.object({
1185
+ attributeId: z26.string().uuid(),
1186
+ type: z26.string(),
1187
+ value: z26.union([z26.string(), z26.array(z26.string())])
1173
1188
  })
1174
1189
  ),
1175
- tags: z25.array(z25.string().uuid()),
1176
- phone: z25.string(),
1177
- email: z25.string(),
1178
- notes: z25.string()
1190
+ tags: z26.array(z26.string().uuid()),
1191
+ phone: z26.string(),
1192
+ email: z26.string(),
1193
+ notes: z26.string()
1179
1194
  }).partial(),
1180
1195
  response: {
1181
- page: z25.number(),
1182
- pageSize: z25.number(),
1183
- total: z25.number(),
1184
- data: z25.array(ContactSchema)
1196
+ page: z26.number(),
1197
+ pageSize: z26.number(),
1198
+ total: z26.number(),
1199
+ lastPage: z26.number(),
1200
+ data: z26.array(ContactSchema)
1185
1201
  }
1186
1202
  },
1187
1203
  createContactByPhone: {
1188
- request: z25.object({
1189
- phoneNumber: z25.string().refine(
1204
+ request: z26.object({
1205
+ phoneNumber: z26.string().refine(
1206
+ (value) => {
1207
+ const numericValue = value.replace(/\s/g, "");
1208
+ return /^\d+$/.test(numericValue);
1209
+ },
1210
+ {
1211
+ message: "Phone number must contain only numeric characters"
1212
+ }
1213
+ )
1214
+ }),
1215
+ response: ContactSchema
1216
+ },
1217
+ updateContactByPhone: {
1218
+ request: z26.object({
1219
+ phoneNumber: z26.string().refine(
1190
1220
  (value) => {
1191
1221
  const numericValue = value.replace(/\s/g, "");
1192
1222
  return /^\d+$/.test(numericValue);
@@ -1197,6 +1227,74 @@ var ContactContractValidationSchema = {
1197
1227
  )
1198
1228
  }),
1199
1229
  response: ContactSchema
1230
+ },
1231
+ updateFromOngoingCall: {
1232
+ request: z26.object({
1233
+ name: z26.string(),
1234
+ companyId: z26.string().uuid()
1235
+ }).partial(),
1236
+ response: ContactSchema
1237
+ },
1238
+ merge: {
1239
+ request: z26.object({
1240
+ primaryContactId: z26.string().uuid(),
1241
+ emails: z26.array(
1242
+ z26.object({
1243
+ email: z26.string(),
1244
+ isPrimary: z26.boolean()
1245
+ })
1246
+ ),
1247
+ phones: z26.array(
1248
+ z26.object({
1249
+ phone: z26.string(),
1250
+ isPrimary: z26.boolean()
1251
+ })
1252
+ ),
1253
+ otherContacts: z26.array(z26.string().uuid())
1254
+ }),
1255
+ response: ContactSchema
1256
+ },
1257
+ checkContactPhone: {
1258
+ request: z26.object({
1259
+ contactId: z26.string().uuid().optional(),
1260
+ phoneNumber: z26.string()
1261
+ }),
1262
+ response: z26.boolean()
1263
+ },
1264
+ checkContactEmail: {
1265
+ request: z26.object({
1266
+ contactId: z26.string().uuid().optional(),
1267
+ email: z26.string()
1268
+ }),
1269
+ response: z26.boolean()
1270
+ },
1271
+ filterContacts: {
1272
+ request: z26.object({
1273
+ page: z26.coerce.number().default(1),
1274
+ pageSize: z26.coerce.number().default(10),
1275
+ keyword: z26.string()
1276
+ }).partial(),
1277
+ response: {
1278
+ page: z26.number(),
1279
+ pageSize: z26.number(),
1280
+ total: z26.number(),
1281
+ lastPage: z26.number(),
1282
+ data: z26.array(ContactSchema)
1283
+ }
1284
+ },
1285
+ addAttachments: {
1286
+ request: z26.object({
1287
+ attributeId: z26.string().uuid(),
1288
+ attachments: z26.array(
1289
+ z26.object({
1290
+ bucketName: z26.string(),
1291
+ fileKey: z26.string(),
1292
+ fileName: z26.string(),
1293
+ fileSize: z26.coerce.number()
1294
+ })
1295
+ ).optional()
1296
+ }),
1297
+ response: CustomFieldSchema
1200
1298
  }
1201
1299
  };
1202
1300
 
@@ -1210,14 +1308,14 @@ var contactContract = initContract7().router(
1210
1308
  201: DefaultSuccessResponseSchema.extend({
1211
1309
  message: ContactContractValidationSchema.create.response
1212
1310
  }),
1213
- 400: z26.object({
1214
- message: z26.string()
1311
+ 400: z27.object({
1312
+ message: z27.string()
1215
1313
  }),
1216
- 409: z26.object({
1217
- message: z26.string()
1314
+ 409: z27.object({
1315
+ message: z27.string()
1218
1316
  }),
1219
- 500: z26.object({
1220
- message: z26.string()
1317
+ 500: z27.object({
1318
+ message: z27.string()
1221
1319
  }),
1222
1320
  401: DefaultUnauthorizedSchema,
1223
1321
  404: DefaultNotFoundSchema,
@@ -1234,14 +1332,14 @@ var contactContract = initContract7().router(
1234
1332
  200: DefaultSuccessResponseSchema.extend({
1235
1333
  data: ContactContractValidationSchema.getById.response
1236
1334
  }),
1237
- 400: z26.object({
1238
- message: z26.string()
1335
+ 400: z27.object({
1336
+ message: z27.string()
1239
1337
  }),
1240
- 409: z26.object({
1241
- message: z26.string()
1338
+ 409: z27.object({
1339
+ message: z27.string()
1242
1340
  }),
1243
- 500: z26.object({
1244
- message: z26.string()
1341
+ 500: z27.object({
1342
+ message: z27.string()
1245
1343
  }),
1246
1344
  401: DefaultUnauthorizedSchema,
1247
1345
  404: DefaultNotFoundSchema,
@@ -1257,14 +1355,14 @@ var contactContract = initContract7().router(
1257
1355
  200: DefaultSuccessResponseSchema.extend(
1258
1356
  ContactContractValidationSchema.getAll.response
1259
1357
  ),
1260
- 400: z26.object({
1261
- message: z26.string()
1358
+ 400: z27.object({
1359
+ message: z27.string()
1262
1360
  }),
1263
- 409: z26.object({
1264
- message: z26.string()
1361
+ 409: z27.object({
1362
+ message: z27.string()
1265
1363
  }),
1266
- 500: z26.object({
1267
- message: z26.string()
1364
+ 500: z27.object({
1365
+ message: z27.string()
1268
1366
  }),
1269
1367
  401: DefaultUnauthorizedSchema,
1270
1368
  404: DefaultNotFoundSchema,
@@ -1272,6 +1370,29 @@ var contactContract = initContract7().router(
1272
1370
  },
1273
1371
  summary: "Get all contacts"
1274
1372
  },
1373
+ filterContacts: {
1374
+ method: "GET",
1375
+ path: "/filter",
1376
+ query: ContactContractValidationSchema.filterContacts.request,
1377
+ responses: {
1378
+ 200: DefaultSuccessResponseSchema.extend(
1379
+ ContactContractValidationSchema.filterContacts.response
1380
+ ),
1381
+ 400: z27.object({
1382
+ message: z27.string()
1383
+ }),
1384
+ 409: z27.object({
1385
+ message: z27.string()
1386
+ }),
1387
+ 500: z27.object({
1388
+ message: z27.string()
1389
+ }),
1390
+ 401: DefaultUnauthorizedSchema,
1391
+ 404: DefaultNotFoundSchema,
1392
+ 422: DefaultUnprocessibleSchema
1393
+ },
1394
+ summary: "Get all contacts by filtering with only keyword"
1395
+ },
1275
1396
  update: {
1276
1397
  method: "PATCH",
1277
1398
  path: "/:id",
@@ -1280,14 +1401,14 @@ var contactContract = initContract7().router(
1280
1401
  200: DefaultSuccessResponseSchema.extend({
1281
1402
  data: ContactContractValidationSchema.getById.response
1282
1403
  }),
1283
- 400: z26.object({
1284
- message: z26.string()
1404
+ 400: z27.object({
1405
+ message: z27.string()
1285
1406
  }),
1286
- 409: z26.object({
1287
- message: z26.string()
1407
+ 409: z27.object({
1408
+ message: z27.string()
1288
1409
  }),
1289
- 500: z26.object({
1290
- message: z26.string()
1410
+ 500: z27.object({
1411
+ message: z27.string()
1291
1412
  }),
1292
1413
  401: DefaultUnauthorizedSchema,
1293
1414
  404: DefaultNotFoundSchema,
@@ -1304,14 +1425,14 @@ var contactContract = initContract7().router(
1304
1425
  200: DefaultSuccessResponseSchema.extend({
1305
1426
  message: ContactContractValidationSchema.delete.response
1306
1427
  }),
1307
- 400: z26.object({
1308
- message: z26.string()
1428
+ 400: z27.object({
1429
+ message: z27.string()
1309
1430
  }),
1310
- 409: z26.object({
1311
- message: z26.string()
1431
+ 409: z27.object({
1432
+ message: z27.string()
1312
1433
  }),
1313
- 500: z26.object({
1314
- message: z26.string()
1434
+ 500: z27.object({
1435
+ message: z27.string()
1315
1436
  }),
1316
1437
  401: DefaultUnauthorizedSchema,
1317
1438
  404: DefaultNotFoundSchema,
@@ -1327,14 +1448,14 @@ var contactContract = initContract7().router(
1327
1448
  201: DefaultSuccessResponseSchema.extend({
1328
1449
  data: ContactContractValidationSchema.createContactByPhone.response
1329
1450
  }),
1330
- 400: z26.object({
1331
- message: z26.string()
1451
+ 400: z27.object({
1452
+ message: z27.string()
1332
1453
  }),
1333
- 409: z26.object({
1334
- message: z26.string()
1454
+ 409: z27.object({
1455
+ message: z27.string()
1335
1456
  }),
1336
- 500: z26.object({
1337
- message: z26.string()
1457
+ 500: z27.object({
1458
+ message: z27.string()
1338
1459
  }),
1339
1460
  401: DefaultUnauthorizedSchema,
1340
1461
  404: DefaultNotFoundSchema,
@@ -1342,6 +1463,124 @@ var contactContract = initContract7().router(
1342
1463
  },
1343
1464
  body: ContactContractValidationSchema.createContactByPhone.request,
1344
1465
  summary: "Create a new contact using phone number"
1466
+ },
1467
+ updateFromOngoingCall: {
1468
+ method: "PATCH",
1469
+ path: "/:id/ongoing",
1470
+ responses: {
1471
+ 201: DefaultSuccessResponseSchema.extend({
1472
+ data: ContactContractValidationSchema.updateFromOngoingCall.response
1473
+ }),
1474
+ 400: z27.object({
1475
+ message: z27.string()
1476
+ }),
1477
+ 409: z27.object({
1478
+ message: z27.string()
1479
+ }),
1480
+ 500: z27.object({
1481
+ message: z27.string()
1482
+ }),
1483
+ 401: DefaultUnauthorizedSchema,
1484
+ 404: DefaultNotFoundSchema,
1485
+ 422: DefaultUnprocessibleSchema
1486
+ },
1487
+ body: ContactContractValidationSchema.updateFromOngoingCall.request,
1488
+ summary: "Update a contact with name and company while making ongoing call"
1489
+ },
1490
+ merge: {
1491
+ method: "POST",
1492
+ path: "/merge",
1493
+ responses: {
1494
+ 200: DefaultSuccessResponseSchema.extend({
1495
+ data: ContactContractValidationSchema.merge.response
1496
+ }),
1497
+ 400: z27.object({
1498
+ message: z27.string()
1499
+ }),
1500
+ 409: z27.object({
1501
+ message: z27.string()
1502
+ }),
1503
+ 500: z27.object({
1504
+ message: z27.string()
1505
+ }),
1506
+ 401: DefaultUnauthorizedSchema,
1507
+ 404: DefaultNotFoundSchema,
1508
+ 422: DefaultUnprocessibleSchema
1509
+ },
1510
+ body: ContactContractValidationSchema.merge.request,
1511
+ summary: "Merge contacts into a single contact."
1512
+ },
1513
+ checkContactPhone: {
1514
+ method: "POST",
1515
+ path: "/check/phone",
1516
+ responses: {
1517
+ 200: DefaultSuccessResponseSchema.extend({
1518
+ existed: ContactContractValidationSchema.checkContactPhone.response
1519
+ }),
1520
+ 400: z27.object({
1521
+ message: z27.string()
1522
+ }),
1523
+ 409: z27.object({
1524
+ message: z27.string()
1525
+ }),
1526
+ 500: z27.object({
1527
+ message: z27.string()
1528
+ }),
1529
+ 401: DefaultUnauthorizedSchema,
1530
+ 404: DefaultNotFoundSchema,
1531
+ 422: DefaultUnprocessibleSchema
1532
+ },
1533
+ body: ContactContractValidationSchema.checkContactPhone.request,
1534
+ summary: "Check whether a contact owns a phone number"
1535
+ },
1536
+ checkContactEmail: {
1537
+ method: "POST",
1538
+ path: "/check/email",
1539
+ responses: {
1540
+ 200: DefaultSuccessResponseSchema.extend({
1541
+ existed: ContactContractValidationSchema.checkContactEmail.response
1542
+ }),
1543
+ 400: z27.object({
1544
+ message: z27.string()
1545
+ }),
1546
+ 409: z27.object({
1547
+ message: z27.string()
1548
+ }),
1549
+ 500: z27.object({
1550
+ message: z27.string()
1551
+ }),
1552
+ 401: DefaultUnauthorizedSchema,
1553
+ 404: DefaultNotFoundSchema,
1554
+ 422: DefaultUnprocessibleSchema
1555
+ },
1556
+ body: ContactContractValidationSchema.checkContactEmail.request,
1557
+ summary: "Check whether a contact owns a email"
1558
+ },
1559
+ addAttachments: {
1560
+ method: "POST",
1561
+ path: "/:id/attachments",
1562
+ pathParams: z27.object({
1563
+ id: z27.string().uuid()
1564
+ }),
1565
+ responses: {
1566
+ 201: DefaultSuccessResponseSchema.extend({
1567
+ message: ContactContractValidationSchema.addAttachments.response
1568
+ }),
1569
+ 400: z27.object({
1570
+ message: z27.string()
1571
+ }),
1572
+ 409: z27.object({
1573
+ message: z27.string()
1574
+ }),
1575
+ 500: z27.object({
1576
+ message: z27.string()
1577
+ }),
1578
+ 401: DefaultUnauthorizedSchema,
1579
+ 404: DefaultNotFoundSchema,
1580
+ 422: DefaultUnprocessibleSchema
1581
+ },
1582
+ body: ContactContractValidationSchema.addAttachments.request,
1583
+ summary: " attachment information from pre-uploaded files in AWS S3 to contacts."
1345
1584
  }
1346
1585
  },
1347
1586
  {
@@ -1350,237 +1589,696 @@ var contactContract = initContract7().router(
1350
1589
  }
1351
1590
  );
1352
1591
 
1353
- // src/cx-log/index.ts
1592
+ // src/ticket/index.ts
1354
1593
  import { initContract as initContract8 } from "@ts-rest/core";
1355
- import z29 from "zod";
1356
-
1357
- // src/cx-log/schema.ts
1358
- import z27 from "zod";
1359
- var CxLogSchema = DefaultEntitySchema.extend({
1360
- caseId: z27.number(),
1361
- entityId: z27.string().uuid(),
1362
- entityName: z27.string(),
1363
- contactId: z27.string().uuid().nullable(),
1364
- channel: z27.string().nullable(),
1365
- queueId: z27.string().uuid().nullable(),
1366
- agentId: z27.string().uuid().nullable(),
1367
- direction: z27.string().nullable(),
1368
- startedDate: z27.date().nullable(),
1369
- handledTime: z27.number().nullable(),
1370
- firstResponseTime: z27.number().nullable(),
1371
- disposition: z27.string().nullable()
1372
- });
1594
+ import z30 from "zod";
1373
1595
 
1374
- // src/cx-log/validation.ts
1596
+ // src/ticket/schema.ts
1375
1597
  import z28 from "zod";
1376
- var sentimentScoreSchema = z28.union([
1377
- z28.literal("positive"),
1378
- z28.literal("negative")
1379
- ]);
1380
- var CustomFieldQueryParamsSchema = z28.object({
1381
- attributeId: z28.string(),
1382
- value: z28.union([z28.string(), z28.array(z28.string())]),
1383
- type: z28.string().optional()
1598
+ var TicketCustomFieldSchema = DefaultEntitySchema.extend({
1599
+ textValue: z28.string().nullable(),
1600
+ booleanValue: z28.boolean().nullable(),
1601
+ numberValue: z28.number().nullable(),
1602
+ dateValue: z28.date().nullable(),
1603
+ attribute: AttributeSchema.omit({ options: true, group: true }),
1604
+ uploads: z28.array(
1605
+ z28.object({
1606
+ id: z28.string().uuid(),
1607
+ createdAt: z28.date(),
1608
+ updatedAt: z28.date(),
1609
+ deletedAt: z28.date().nullable(),
1610
+ customFieldId: z28.string(),
1611
+ upload: UploadSchema
1612
+ })
1613
+ )
1384
1614
  });
1385
- var GetAllCxLogQueryParamsSchema = DefaultQueryParamsSchema.extend({
1615
+ var TicketSchema = DefaultEntitySchema.extend({
1616
+ title: z28.string(),
1617
+ description: z28.string().nullable(),
1618
+ type: z28.string(),
1619
+ channel: z28.string(),
1620
+ priority: z28.string(),
1621
+ status: z28.string(),
1386
1622
  contactId: z28.string().uuid(),
1387
- caseId: z28.string(),
1388
- channelIds: z28.array(z28.string().uuid()),
1389
- queueId: z28.array(z28.string()),
1390
- agentIds: z28.array(z28.string()),
1391
- direction: z28.array(z28.union([z28.literal("inbound"), z28.literal("outbound")])),
1392
- disposition: z28.array(z28.string()),
1393
- sentimentScore: z28.array(sentimentScoreSchema),
1394
- csatScore: z28.string(),
1395
- sla: z28.array(z28.union([z28.literal("meet"), z28.literal("unmeet")])),
1396
- tags: z28.array(z28.string()),
1397
- // General tags
1398
- // Default contact attributes
1399
- name: z28.string(),
1400
- contactLabels: z28.array(z28.string()),
1401
- email: z28.string(),
1623
+ creatorId: z28.string().uuid(),
1624
+ assigneeId: z28.string().uuid(),
1625
+ reasonToAssign: z28.string().nullable(),
1626
+ ticketNumber: z28.number().optional(),
1627
+ customFields: z28.array(TicketCustomFieldSchema)
1628
+ });
1629
+ var TicketCountByContactSchema = z28.object({
1630
+ total: z28.coerce.number(),
1631
+ open: z28.coerce.number(),
1632
+ pending: z28.coerce.number(),
1633
+ closed: z28.coerce.number(),
1634
+ solved: z28.coerce.number()
1635
+ }).optional();
1636
+ var TicketParamsSchema = z28.object({
1637
+ page: z28.coerce.number().default(1),
1638
+ pageSize: z28.coerce.number().default(10)
1639
+ }).optional();
1640
+ var CustomFieldQuery = z28.object({
1641
+ attributeId: z28.string(),
1642
+ type: z28.string(),
1643
+ value: z28.union([z28.string(), z28.array(z28.string())])
1644
+ });
1645
+ var GetAllTicketQuerySchema = z28.object({
1646
+ page: z28.number().default(1),
1647
+ pageSize: z28.number().default(10),
1648
+ agent: z28.array(z28.string()),
1649
+ selectedDate: z28.string(),
1650
+ keyword: z28.string(),
1651
+ title: z28.string(),
1652
+ description: z28.string(),
1653
+ status: z28.array(z28.string()),
1654
+ priority: z28.array(z28.string()),
1402
1655
  channel: z28.array(z28.string()),
1403
- phone: z28.string(),
1404
- notes: z28.string(),
1405
- address: z28.string(),
1406
- company: z28.array(z28.string()),
1407
- // Custom fields
1408
- customFields: z28.array(CustomFieldQueryParamsSchema),
1409
- // Date filter
1410
- selectedDate: z28.string()
1411
- }).partial().optional();
1656
+ type: z28.array(z28.string()),
1657
+ ticketType: z28.array(z28.string()),
1658
+ contact: z28.array(z28.string()),
1659
+ tags: z28.array(z28.string()),
1660
+ categories: z28.array(z28.string()),
1661
+ customFields: z28.array(CustomFieldQuery)
1662
+ }).partial();
1412
1663
 
1413
- // src/cx-log/index.ts
1414
- var cxLogContract = initContract8().router({
1415
- findAll: {
1416
- method: "GET",
1417
- path: "/cx-logs",
1418
- headers: DefaultHeaderSchema,
1419
- responses: {
1420
- 200: DefaultSuccessResponseSchema.extend({
1421
- total: z29.number(),
1422
- page: z29.number(),
1423
- pageSize: z29.number(),
1424
- cxLogs: z29.array(CxLogSchema)
1425
- }),
1426
- 401: DefaultUnauthorizedSchema
1427
- },
1428
- query: GetAllCxLogQueryParamsSchema,
1429
- summary: "Get all cx-logs"
1664
+ // src/ticket/validation.ts
1665
+ import z29 from "zod";
1666
+ var BaseSchema2 = z29.object({
1667
+ isRequired: z29.boolean(),
1668
+ attributeId: z29.string()
1669
+ });
1670
+ var SingleValue2 = {
1671
+ value: z29.string()
1672
+ };
1673
+ var CreateTicketValidationSchema = z29.object({
1674
+ title: BaseSchema2.extend(SingleValue2),
1675
+ description: BaseSchema2.extend(SingleValue2),
1676
+ status: BaseSchema2.extend(SingleValue2),
1677
+ type: BaseSchema2.extend(SingleValue2),
1678
+ priority: BaseSchema2.extend(SingleValue2),
1679
+ contact: BaseSchema2.extend(SingleValue2),
1680
+ assignee: BaseSchema2.extend(SingleValue2),
1681
+ channel: BaseSchema2.extend(SingleValue2),
1682
+ tags: BaseSchema2.extend({ value: z29.array(z29.string()) }),
1683
+ categories: BaseSchema2.extend({ value: z29.array(z29.string()) }),
1684
+ customFields: z29.array(
1685
+ BaseSchema2.extend({
1686
+ value: z29.union([z29.string(), z29.array(z29.string())]),
1687
+ type: z29.string(),
1688
+ isDefaultAttribute: z29.boolean()
1689
+ })
1690
+ ),
1691
+ reasonToAssign: z29.object({ value: z29.string() })
1692
+ });
1693
+ var UpdateTicketValidationSchema = CreateTicketValidationSchema.extend(
1694
+ {
1695
+ id: z29.string()
1430
1696
  }
1697
+ );
1698
+ var TicketAttachmentRecordSchema = z29.object({
1699
+ bucketName: z29.string(),
1700
+ fileKey: z29.string(),
1701
+ fileName: z29.string(),
1702
+ fileSize: z29.coerce.number(),
1703
+ url: z29.string()
1431
1704
  });
1432
-
1433
- // src/extension/index.ts
1434
- import { initContract as initContract9 } from "@ts-rest/core";
1435
- import z31 from "zod";
1436
-
1437
- // src/extension/validation.ts
1438
- import { z as z30 } from "zod";
1439
- var CreateExtensionSchema = z30.object({
1440
- userId: z30.string().nullable(),
1441
- sipUserName: z30.string(),
1442
- extensionId: z30.coerce.number().nullable(),
1443
- extensionName: z30.string().nullable(),
1444
- telephonySignature: z30.string().nullable().optional()
1705
+ var CreateTicketAttachmentRecordsSchema = z29.object({
1706
+ ticketId: z29.string(),
1707
+ attributeId: z29.string(),
1708
+ ticketAttachmentRecords: z29.array(TicketAttachmentRecordSchema)
1445
1709
  });
1446
- var UpdateExtensionSchema = CreateExtensionSchema;
1447
1710
 
1448
- // src/extension/index.ts
1449
- var extensionContract = initContract9().router(
1711
+ // src/ticket/index.ts
1712
+ var ticketContract = initContract8().router(
1450
1713
  {
1451
- createExtension: {
1714
+ createTicket: {
1452
1715
  method: "POST",
1453
1716
  path: "",
1454
1717
  headers: DefaultHeaderSchema,
1455
- body: CreateExtensionSchema,
1456
1718
  responses: {
1457
1719
  201: DefaultSuccessResponseSchema.extend({
1458
- extension: ExtensionSchema
1720
+ message: TicketSchema
1721
+ }),
1722
+ 400: z30.object({
1723
+ message: z30.string()
1459
1724
  }),
1460
- 400: z31.object({
1461
- message: z31.string()
1725
+ 409: z30.object({
1726
+ message: z30.string()
1727
+ }),
1728
+ 500: z30.object({
1729
+ message: z30.string()
1462
1730
  }),
1463
1731
  401: DefaultUnauthorizedSchema,
1464
- 500: DefaultErrorResponseSchema
1732
+ 404: DefaultNotFoundSchema,
1733
+ 422: DefaultUnprocessibleSchema
1465
1734
  },
1466
- summary: "Create a extension."
1735
+ body: CreateTicketValidationSchema,
1736
+ summary: "Create a new ticket"
1467
1737
  },
1468
- getExtensions: {
1738
+ getAllTickets: {
1469
1739
  method: "GET",
1470
1740
  path: "",
1471
- query: z31.object({
1472
- page: z31.coerce.number().default(1),
1473
- pageSize: z31.coerce.number().default(10),
1474
- keyword: z31.string().optional()
1475
- }).optional(),
1741
+ query: GetAllTicketQuerySchema,
1476
1742
  headers: DefaultHeaderSchema,
1477
1743
  responses: {
1478
1744
  200: WithPagination(
1479
1745
  // The response data should contain the user relation.
1480
- ExtensionSchema.extend({
1481
- user: UserSchema
1482
- })
1746
+ TicketSchema
1483
1747
  ),
1484
- 400: z31.object({
1485
- message: z31.string()
1748
+ 400: z30.object({
1749
+ message: z30.string()
1486
1750
  }),
1487
1751
  401: DefaultUnauthorizedSchema,
1488
1752
  500: DefaultErrorResponseSchema
1489
1753
  },
1490
- summary: "Get all extensions"
1754
+ summary: "Get all tickets"
1491
1755
  },
1492
- getExtensionByUserId: {
1756
+ getTicketById: {
1493
1757
  method: "GET",
1494
- path: "/user/:userId",
1495
- pathParams: z31.object({ userId: z31.string() }),
1758
+ path: "/:id",
1759
+ pathParams: z30.object({ id: z30.string() }),
1496
1760
  headers: DefaultHeaderSchema,
1497
1761
  responses: {
1498
- 200: ExtensionSchema,
1499
- 400: z31.object({
1500
- message: z31.string()
1762
+ 200: TicketSchema,
1763
+ 400: z30.object({
1764
+ message: z30.string()
1501
1765
  }),
1502
1766
  401: DefaultUnauthorizedSchema,
1503
1767
  500: DefaultErrorResponseSchema
1504
1768
  },
1505
- summary: "Get extension by user id"
1769
+ summary: "Get ticket by id"
1506
1770
  },
1507
- getExtensionByDialpad: {
1771
+ getTicketByContactId: {
1508
1772
  method: "GET",
1509
- path: "/dialpad",
1510
- query: z31.object({
1511
- page: z31.coerce.number().default(1),
1512
- pageSize: z31.coerce.number().default(10),
1513
- keyword: z31.string().optional()
1514
- }).optional(),
1773
+ path: "/contact/:id",
1774
+ pathParams: z30.object({ id: z30.string() }),
1775
+ query: TicketParamsSchema,
1515
1776
  headers: DefaultHeaderSchema,
1516
1777
  responses: {
1517
- 200: WithPagination(ExtensionSchema),
1518
- 500: DefaultErrorResponseSchema,
1519
- 400: z31.object({
1520
- message: z31.string()
1778
+ 200: WithPagination(TicketSchema),
1779
+ 400: z30.object({
1780
+ message: z30.string()
1521
1781
  }),
1522
- 401: DefaultUnauthorizedSchema
1782
+ 401: DefaultUnauthorizedSchema,
1783
+ 500: DefaultErrorResponseSchema
1523
1784
  },
1524
- summary: "Get by dialpad"
1785
+ summary: "Get ticket by contact id."
1525
1786
  },
1526
- updateExtension: {
1787
+ updateTicket: {
1527
1788
  method: "PATCH",
1528
1789
  path: "/:id",
1529
- pathParams: z31.object({ id: z31.string() }),
1790
+ pathParams: z30.object({ id: z30.string() }),
1791
+ body: UpdateTicketValidationSchema,
1530
1792
  headers: DefaultHeaderSchema,
1531
- body: UpdateExtensionSchema,
1532
1793
  responses: {
1533
- 200: DefaultSuccessResponseSchema.extend({
1534
- extension: ExtensionSchema
1794
+ 201: DefaultSuccessResponseSchema.extend({
1795
+ message: TicketSchema
1535
1796
  }),
1536
- 500: DefaultErrorResponseSchema
1797
+ 400: z30.object({
1798
+ message: z30.string()
1799
+ }),
1800
+ 409: z30.object({
1801
+ message: z30.string()
1802
+ }),
1803
+ 500: z30.object({
1804
+ message: z30.string()
1805
+ }),
1806
+ 401: DefaultUnauthorizedSchema,
1807
+ 404: DefaultNotFoundSchema,
1808
+ 422: DefaultUnprocessibleSchema
1537
1809
  },
1538
- summary: "Update a extension."
1810
+ summary: "Update a contact"
1539
1811
  },
1540
- deleteExtension: {
1812
+ deleteTicket: {
1541
1813
  method: "DELETE",
1542
1814
  path: "/:id",
1543
- pathParams: z31.object({ id: z31.string() }),
1815
+ pathParams: z30.object({ id: z30.string() }),
1544
1816
  headers: DefaultHeaderSchema,
1545
1817
  body: null,
1546
1818
  responses: {
1547
- 200: DefaultSuccessResponseSchema.extend({ message: z31.string() }),
1819
+ 200: DefaultSuccessResponseSchema.extend({ message: z30.string() }),
1548
1820
  500: DefaultErrorResponseSchema
1549
1821
  },
1550
1822
  summary: "Delete a extension."
1551
- }
1552
- },
1553
- { pathPrefix: "extension" }
1554
- );
1555
-
1556
- // src/line/index.ts
1557
- import { initContract as initContract10 } from "@ts-rest/core";
1558
- import z34 from "zod";
1559
-
1560
- // src/line/schema.ts
1561
- import z32 from "zod";
1562
- var ConnectLineSchema = z32.object({
1563
- id: z32.string(),
1564
- accessToken: z32.string()
1565
- });
1566
-
1567
- // src/line/validation.ts
1568
- import z33 from "zod";
1569
- var SendLineStickerSchema = z33.object({
1570
- userId: z33.string().uuid(),
1571
- packageId: z33.string(),
1572
- stickerId: z33.string(),
1573
- accessToken: z33.string()
1574
- });
1575
-
1576
- // src/line/index.ts
1577
- var lineContract = initContract10().router({
1578
- sendSticker: {
1579
- method: "POST",
1580
- path: "sticker",
1581
- responses: {
1582
- 200: DefaultSuccessResponseSchema.extend({
1583
- data: z34.any()
1823
+ },
1824
+ updateDescription: {
1825
+ method: "PATCH",
1826
+ path: "/description/update/:id",
1827
+ pathParams: z30.object({ id: z30.string() }),
1828
+ body: z30.object({ description: z30.string() }),
1829
+ headers: DefaultHeaderSchema,
1830
+ responses: {
1831
+ 201: DefaultSuccessResponseSchema.extend({ message: z30.string() }),
1832
+ 400: z30.object({
1833
+ message: z30.string()
1834
+ }),
1835
+ 409: z30.object({
1836
+ message: z30.string()
1837
+ }),
1838
+ 500: z30.object({
1839
+ message: z30.string()
1840
+ }),
1841
+ 401: DefaultUnauthorizedSchema,
1842
+ 404: DefaultNotFoundSchema,
1843
+ 422: DefaultUnprocessibleSchema
1844
+ },
1845
+ summary: "Update a description from a ticket"
1846
+ },
1847
+ updateTitle: {
1848
+ method: "PATCH",
1849
+ path: "/title/update/:id",
1850
+ pathParams: z30.object({ id: z30.string() }),
1851
+ body: z30.object({ title: z30.string() }),
1852
+ headers: DefaultHeaderSchema,
1853
+ responses: {
1854
+ 200: DefaultSuccessResponseSchema.extend({ message: z30.string() }),
1855
+ 400: z30.object({
1856
+ message: z30.string()
1857
+ }),
1858
+ 409: z30.object({
1859
+ message: z30.string()
1860
+ }),
1861
+ 500: z30.object({
1862
+ message: z30.string()
1863
+ }),
1864
+ 401: DefaultUnauthorizedSchema,
1865
+ 404: DefaultNotFoundSchema,
1866
+ 422: DefaultUnprocessibleSchema
1867
+ },
1868
+ summary: "Update a title from a ticket"
1869
+ },
1870
+ updateType: {
1871
+ method: "PATCH",
1872
+ path: "/type/update/:id",
1873
+ pathParams: z30.object({ id: z30.string() }),
1874
+ body: z30.object({ type: z30.string() }),
1875
+ headers: DefaultHeaderSchema,
1876
+ responses: {
1877
+ 200: DefaultSuccessResponseSchema.extend({ message: z30.string() }),
1878
+ 400: z30.object({
1879
+ message: z30.string()
1880
+ }),
1881
+ 409: z30.object({
1882
+ message: z30.string()
1883
+ }),
1884
+ 500: z30.object({
1885
+ message: z30.string()
1886
+ }),
1887
+ 401: DefaultUnauthorizedSchema,
1888
+ 404: DefaultNotFoundSchema,
1889
+ 422: DefaultUnprocessibleSchema
1890
+ },
1891
+ summary: "Update a type from a ticket"
1892
+ },
1893
+ updateStatus: {
1894
+ method: "PATCH",
1895
+ path: "/status/update/:id",
1896
+ pathParams: z30.object({ id: z30.string() }),
1897
+ body: z30.object({ status: z30.string() }),
1898
+ headers: DefaultHeaderSchema,
1899
+ responses: {
1900
+ 200: DefaultSuccessResponseSchema.extend({ message: z30.string() }),
1901
+ 400: z30.object({
1902
+ message: z30.string()
1903
+ }),
1904
+ 409: z30.object({
1905
+ message: z30.string()
1906
+ }),
1907
+ 500: z30.object({
1908
+ message: z30.string()
1909
+ }),
1910
+ 401: DefaultUnauthorizedSchema,
1911
+ 404: DefaultNotFoundSchema,
1912
+ 422: DefaultUnprocessibleSchema
1913
+ },
1914
+ summary: "Update a status from a ticket"
1915
+ },
1916
+ updatePriority: {
1917
+ method: "PATCH",
1918
+ path: "/priority/update/:id",
1919
+ pathParams: z30.object({ id: z30.string() }),
1920
+ body: z30.object({ priority: z30.string() }),
1921
+ headers: DefaultHeaderSchema,
1922
+ responses: {
1923
+ 200: DefaultSuccessResponseSchema.extend({ message: z30.string() }),
1924
+ 400: z30.object({
1925
+ message: z30.string()
1926
+ }),
1927
+ 409: z30.object({
1928
+ message: z30.string()
1929
+ }),
1930
+ 500: z30.object({
1931
+ message: z30.string()
1932
+ }),
1933
+ 401: DefaultUnauthorizedSchema,
1934
+ 404: DefaultNotFoundSchema,
1935
+ 422: DefaultUnprocessibleSchema
1936
+ },
1937
+ summary: "Update a priority from a ticket"
1938
+ },
1939
+ updateChannel: {
1940
+ method: "PATCH",
1941
+ path: "/channel/update/:id",
1942
+ pathParams: z30.object({ id: z30.string() }),
1943
+ body: z30.object({ channel: z30.string() }),
1944
+ headers: DefaultHeaderSchema,
1945
+ responses: {
1946
+ 200: DefaultSuccessResponseSchema.extend({ message: z30.string() }),
1947
+ 400: z30.object({
1948
+ message: z30.string()
1949
+ }),
1950
+ 409: z30.object({
1951
+ message: z30.string()
1952
+ }),
1953
+ 500: z30.object({
1954
+ message: z30.string()
1955
+ }),
1956
+ 401: DefaultUnauthorizedSchema,
1957
+ 404: DefaultNotFoundSchema,
1958
+ 422: DefaultUnprocessibleSchema
1959
+ },
1960
+ summary: "Update a channel from a ticket"
1961
+ },
1962
+ updateTags: {
1963
+ method: "PATCH",
1964
+ path: "/tags/update/:id",
1965
+ pathParams: z30.object({ id: z30.string() }),
1966
+ body: z30.object({ tags: z30.array(z30.string()) }),
1967
+ headers: DefaultHeaderSchema,
1968
+ responses: {
1969
+ 200: DefaultSuccessResponseSchema.extend({ message: z30.string() }),
1970
+ 400: z30.object({
1971
+ message: z30.string()
1972
+ }),
1973
+ 409: z30.object({
1974
+ message: z30.string()
1975
+ }),
1976
+ 500: z30.object({
1977
+ message: z30.string()
1978
+ }),
1979
+ 401: DefaultUnauthorizedSchema,
1980
+ 404: DefaultNotFoundSchema,
1981
+ 422: DefaultUnprocessibleSchema
1982
+ },
1983
+ summary: "Update a tags from a ticket"
1984
+ },
1985
+ changeAssignee: {
1986
+ method: "PATCH",
1987
+ path: "/assignee/update/:id",
1988
+ pathParams: z30.object({ id: z30.string() }),
1989
+ body: z30.object({ ticketId: z30.string(), assigneeId: z30.string() }),
1990
+ headers: DefaultHeaderSchema,
1991
+ responses: {
1992
+ 200: TicketSchema,
1993
+ 400: z30.object({
1994
+ message: z30.string()
1995
+ }),
1996
+ 409: z30.object({
1997
+ message: z30.string()
1998
+ }),
1999
+ 500: z30.object({
2000
+ message: z30.string()
2001
+ }),
2002
+ 401: DefaultUnauthorizedSchema,
2003
+ 404: DefaultNotFoundSchema,
2004
+ 422: DefaultUnprocessibleSchema
2005
+ },
2006
+ summary: "Change assignee"
2007
+ },
2008
+ getTicketCountByContact: {
2009
+ method: "GET",
2010
+ path: "/ticket_count/contact/:id",
2011
+ pathParams: z30.object({ id: z30.string() }),
2012
+ headers: DefaultHeaderSchema,
2013
+ responses: {
2014
+ 200: TicketCountByContactSchema,
2015
+ 400: z30.object({
2016
+ message: z30.string()
2017
+ }),
2018
+ 401: DefaultUnauthorizedSchema,
2019
+ 500: DefaultErrorResponseSchema
2020
+ },
2021
+ summary: "Get ticket count by contact"
2022
+ },
2023
+ getTicketByContact: {
2024
+ method: "GET",
2025
+ path: "/contact/:id",
2026
+ pathParams: z30.object({ id: z30.string() }),
2027
+ query: z30.object({
2028
+ page: z30.coerce.number().default(1),
2029
+ pageSize: z30.coerce.number().default(10)
2030
+ }).optional(),
2031
+ headers: DefaultHeaderSchema,
2032
+ responses: {
2033
+ 200: WithPagination(TicketSchema),
2034
+ 400: z30.object({
2035
+ message: z30.string()
2036
+ }),
2037
+ 401: DefaultUnauthorizedSchema,
2038
+ 500: DefaultErrorResponseSchema
2039
+ },
2040
+ summary: "Get ticket by contact id"
2041
+ },
2042
+ createTicketAttachmentRecords: {
2043
+ method: "POST",
2044
+ path: "/attachment",
2045
+ headers: DefaultHeaderSchema,
2046
+ body: CreateTicketAttachmentRecordsSchema,
2047
+ responses: {
2048
+ 201: TicketCustomFieldSchema,
2049
+ 400: z30.object({
2050
+ message: z30.string()
2051
+ }),
2052
+ 409: z30.object({
2053
+ message: z30.string()
2054
+ }),
2055
+ 500: z30.object({
2056
+ message: z30.string()
2057
+ }),
2058
+ 401: DefaultUnauthorizedSchema,
2059
+ 404: DefaultNotFoundSchema,
2060
+ 422: DefaultUnprocessibleSchema
2061
+ },
2062
+ summary: "Create a new ticket attachment"
2063
+ }
2064
+ },
2065
+ { pathPrefix: "ticket" }
2066
+ );
2067
+
2068
+ // src/cx-log/index.ts
2069
+ import { initContract as initContract9 } from "@ts-rest/core";
2070
+ import z32 from "zod";
2071
+
2072
+ // src/cx-log/validation.ts
2073
+ import z31 from "zod";
2074
+ var sentimentScoreSchema = z31.union([
2075
+ z31.literal("positive"),
2076
+ z31.literal("negative")
2077
+ ]);
2078
+ var CustomFieldQueryParamsSchema = z31.object({
2079
+ attributeId: z31.string(),
2080
+ value: z31.union([z31.string(), z31.array(z31.string())]),
2081
+ type: z31.string().optional()
2082
+ });
2083
+ var GetAllCxLogQueryParamsSchema = DefaultQueryParamsSchema.extend({
2084
+ contactId: z31.string().uuid(),
2085
+ caseId: z31.string(),
2086
+ channelIds: z31.array(z31.string().uuid()),
2087
+ queueId: z31.array(z31.string()),
2088
+ agentIds: z31.array(z31.string()),
2089
+ direction: z31.array(z31.union([z31.literal("inbound"), z31.literal("outbound")])),
2090
+ disposition: z31.array(z31.string()),
2091
+ sentimentScore: z31.array(sentimentScoreSchema),
2092
+ csatScore: z31.string(),
2093
+ sla: z31.array(z31.union([z31.literal("meet"), z31.literal("unmeet")])),
2094
+ tags: z31.array(z31.string()),
2095
+ // General tags
2096
+ // Default contact attributes
2097
+ name: z31.string(),
2098
+ contactLabels: z31.array(z31.string()),
2099
+ email: z31.string(),
2100
+ channel: z31.array(z31.string()),
2101
+ phone: z31.string(),
2102
+ notes: z31.string(),
2103
+ address: z31.string(),
2104
+ company: z31.array(z31.string()),
2105
+ // Custom fields
2106
+ customFields: z31.array(CustomFieldQueryParamsSchema),
2107
+ // Date filter
2108
+ selectedDate: z31.string()
2109
+ }).partial().optional();
2110
+
2111
+ // src/cx-log/index.ts
2112
+ var cxLogContract = initContract9().router({
2113
+ findAll: {
2114
+ method: "GET",
2115
+ path: "/cx-logs",
2116
+ headers: DefaultHeaderSchema,
2117
+ responses: {
2118
+ 200: DefaultSuccessResponseSchema.extend({
2119
+ total: z32.number(),
2120
+ page: z32.number(),
2121
+ pageSize: z32.number(),
2122
+ cxLogs: z32.array(CxLogSchema)
2123
+ }),
2124
+ 401: DefaultUnauthorizedSchema
2125
+ },
2126
+ query: GetAllCxLogQueryParamsSchema,
2127
+ summary: "Get all cx-logs"
2128
+ }
2129
+ });
2130
+
2131
+ // src/extension/index.ts
2132
+ import { initContract as initContract10 } from "@ts-rest/core";
2133
+ import z34 from "zod";
2134
+
2135
+ // src/extension/validation.ts
2136
+ import { z as z33 } from "zod";
2137
+ var CreateExtensionSchema = z33.object({
2138
+ userId: z33.string().nullable(),
2139
+ sipUserName: z33.string(),
2140
+ extensionId: z33.coerce.number().nullable(),
2141
+ extensionName: z33.string().nullable(),
2142
+ telephonySignature: z33.string().nullable().optional()
2143
+ });
2144
+ var UpdateExtensionSchema = CreateExtensionSchema;
2145
+
2146
+ // src/extension/index.ts
2147
+ var extensionContract = initContract10().router(
2148
+ {
2149
+ createExtension: {
2150
+ method: "POST",
2151
+ path: "",
2152
+ headers: DefaultHeaderSchema,
2153
+ body: CreateExtensionSchema,
2154
+ responses: {
2155
+ 201: DefaultSuccessResponseSchema.extend({
2156
+ extension: ExtensionSchema
2157
+ }),
2158
+ 400: z34.object({
2159
+ message: z34.string()
2160
+ }),
2161
+ 401: DefaultUnauthorizedSchema,
2162
+ 500: DefaultErrorResponseSchema
2163
+ },
2164
+ summary: "Create a extension."
2165
+ },
2166
+ getExtensions: {
2167
+ method: "GET",
2168
+ path: "",
2169
+ query: z34.object({
2170
+ page: z34.coerce.number().default(1),
2171
+ pageSize: z34.coerce.number().default(10),
2172
+ keyword: z34.string().optional()
2173
+ }).optional(),
2174
+ headers: DefaultHeaderSchema,
2175
+ responses: {
2176
+ 200: WithPagination(
2177
+ // The response data should contain the user relation.
2178
+ ExtensionSchema.extend({
2179
+ user: UserSchema
2180
+ })
2181
+ ),
2182
+ 400: z34.object({
2183
+ message: z34.string()
2184
+ }),
2185
+ 401: DefaultUnauthorizedSchema,
2186
+ 500: DefaultErrorResponseSchema
2187
+ },
2188
+ summary: "Get all extensions"
2189
+ },
2190
+ getExtensionByUserId: {
2191
+ method: "GET",
2192
+ path: "/user/:userId",
2193
+ pathParams: z34.object({ userId: z34.string() }),
2194
+ headers: DefaultHeaderSchema,
2195
+ responses: {
2196
+ 200: ExtensionSchema,
2197
+ 400: z34.object({
2198
+ message: z34.string()
2199
+ }),
2200
+ 401: DefaultUnauthorizedSchema,
2201
+ 500: DefaultErrorResponseSchema
2202
+ },
2203
+ summary: "Get extension by user id"
2204
+ },
2205
+ getExtensionByDialpad: {
2206
+ method: "GET",
2207
+ path: "/dialpad",
2208
+ query: z34.object({
2209
+ page: z34.coerce.number().default(1),
2210
+ pageSize: z34.coerce.number().default(10),
2211
+ keyword: z34.string().optional()
2212
+ }).optional(),
2213
+ headers: DefaultHeaderSchema,
2214
+ responses: {
2215
+ 200: WithPagination(ExtensionSchema),
2216
+ 500: DefaultErrorResponseSchema,
2217
+ 400: z34.object({
2218
+ message: z34.string()
2219
+ }),
2220
+ 401: DefaultUnauthorizedSchema
2221
+ },
2222
+ summary: "Get by dialpad"
2223
+ },
2224
+ updateExtension: {
2225
+ method: "PATCH",
2226
+ path: "/:id",
2227
+ pathParams: z34.object({ id: z34.string() }),
2228
+ headers: DefaultHeaderSchema,
2229
+ body: UpdateExtensionSchema,
2230
+ responses: {
2231
+ 200: DefaultSuccessResponseSchema.extend({
2232
+ extension: ExtensionSchema
2233
+ }),
2234
+ 500: DefaultErrorResponseSchema
2235
+ },
2236
+ summary: "Update a extension."
2237
+ },
2238
+ deleteExtension: {
2239
+ method: "DELETE",
2240
+ path: "/:id",
2241
+ pathParams: z34.object({ id: z34.string() }),
2242
+ headers: DefaultHeaderSchema,
2243
+ body: null,
2244
+ responses: {
2245
+ 200: DefaultSuccessResponseSchema.extend({ message: z34.string() }),
2246
+ 500: DefaultErrorResponseSchema
2247
+ },
2248
+ summary: "Delete a extension."
2249
+ }
2250
+ },
2251
+ { pathPrefix: "extension" }
2252
+ );
2253
+
2254
+ // src/line/index.ts
2255
+ import { initContract as initContract11 } from "@ts-rest/core";
2256
+ import z37 from "zod";
2257
+
2258
+ // src/line/schema.ts
2259
+ import z35 from "zod";
2260
+ var ConnectLineSchema = z35.object({
2261
+ id: z35.string(),
2262
+ accessToken: z35.string()
2263
+ });
2264
+
2265
+ // src/line/validation.ts
2266
+ import z36 from "zod";
2267
+ var SendLineStickerSchema = z36.object({
2268
+ userId: z36.string().uuid(),
2269
+ packageId: z36.string(),
2270
+ stickerId: z36.string(),
2271
+ accessToken: z36.string()
2272
+ });
2273
+
2274
+ // src/line/index.ts
2275
+ var lineContract = initContract11().router({
2276
+ sendSticker: {
2277
+ method: "POST",
2278
+ path: "sticker",
2279
+ responses: {
2280
+ 200: DefaultSuccessResponseSchema.extend({
2281
+ data: z37.any()
1584
2282
  }),
1585
2283
  500: DefaultErrorResponseSchema
1586
2284
  },
@@ -1592,7 +2290,7 @@ var lineContract = initContract10().router({
1592
2290
  path: "connect",
1593
2291
  responses: {
1594
2292
  200: DefaultSuccessResponseSchema.extend({
1595
- data: z34.any()
2293
+ data: z37.any()
1596
2294
  }),
1597
2295
  500: DefaultErrorResponseSchema
1598
2296
  },
@@ -1602,16 +2300,16 @@ var lineContract = initContract10().router({
1602
2300
  });
1603
2301
 
1604
2302
  // src/mail/email-engine-webhooks-events.contract.ts
1605
- import { initContract as initContract11 } from "@ts-rest/core";
1606
- import z35 from "zod";
1607
- var emailEngineWebhooksEventsContract = initContract11().router({
2303
+ import { initContract as initContract12 } from "@ts-rest/core";
2304
+ import z38 from "zod";
2305
+ var emailEngineWebhooksEventsContract = initContract12().router({
1608
2306
  handleWebhooksEvents: {
1609
2307
  method: "POST",
1610
2308
  path: "/email_engine/webhooks",
1611
2309
  // we don't need to respone anything but added responses just for solving type error
1612
2310
  responses: {
1613
2311
  200: DefaultSuccessResponseSchema.extend({
1614
- message: z35.string()
2312
+ message: z38.string()
1615
2313
  })
1616
2314
  },
1617
2315
  body: null,
@@ -1620,189 +2318,189 @@ var emailEngineWebhooksEventsContract = initContract11().router({
1620
2318
  });
1621
2319
 
1622
2320
  // src/mail/mail-contract.ts
1623
- import { initContract as initContract16 } from "@ts-rest/core";
2321
+ import { initContract as initContract17 } from "@ts-rest/core";
1624
2322
 
1625
2323
  // src/mail/room-contract.ts
1626
- import { initContract as initContract12 } from "@ts-rest/core";
1627
- import z39 from "zod";
2324
+ import { initContract as initContract13 } from "@ts-rest/core";
2325
+ import z42 from "zod";
1628
2326
 
1629
2327
  // src/mail/schemas/room.schema.ts
1630
- import z38 from "zod";
2328
+ import z41 from "zod";
1631
2329
 
1632
2330
  // src/mail/schemas/account.schema.ts
1633
- import z36 from "zod";
1634
- var MailServerSchema = z36.object({
1635
- id: z36.string(),
1636
- createdAt: z36.date(),
1637
- updatedAt: z36.date(),
1638
- deletedAt: z36.date().nullable(),
1639
- name: z36.string(),
1640
- smtpHost: z36.string(),
1641
- smtpPort: z36.string(),
1642
- smtpTlsPort: z36.string(),
1643
- useTlsForSmtp: z36.boolean(),
1644
- imapHost: z36.string(),
1645
- imapPort: z36.string(),
1646
- imapTlsPort: z36.string(),
1647
- useTlsForImap: z36.boolean()
1648
- });
1649
- var MailAccountSchema = z36.object({
1650
- id: z36.string(),
1651
- createdAt: z36.date(),
1652
- updatedAt: z36.date(),
1653
- deletedAt: z36.date().nullable(),
1654
- name: z36.string(),
1655
- address: z36.string(),
1656
- accountId: z36.string(),
1657
- mailServerId: z36.string(),
2331
+ import z39 from "zod";
2332
+ var MailServerSchema = z39.object({
2333
+ id: z39.string(),
2334
+ createdAt: z39.date(),
2335
+ updatedAt: z39.date(),
2336
+ deletedAt: z39.date().nullable(),
2337
+ name: z39.string(),
2338
+ smtpHost: z39.string(),
2339
+ smtpPort: z39.string(),
2340
+ smtpTlsPort: z39.string(),
2341
+ useTlsForSmtp: z39.boolean(),
2342
+ imapHost: z39.string(),
2343
+ imapPort: z39.string(),
2344
+ imapTlsPort: z39.string(),
2345
+ useTlsForImap: z39.boolean()
2346
+ });
2347
+ var MailAccountSchema = z39.object({
2348
+ id: z39.string(),
2349
+ createdAt: z39.date(),
2350
+ updatedAt: z39.date(),
2351
+ deletedAt: z39.date().nullable(),
2352
+ name: z39.string(),
2353
+ address: z39.string(),
2354
+ accountId: z39.string(),
2355
+ mailServerId: z39.string(),
1658
2356
  mailServer: MailServerSchema,
1659
- state: z36.union([
1660
- z36.literal("init"),
1661
- z36.literal("syncing"),
1662
- z36.literal("connecting"),
1663
- z36.literal("connected"),
1664
- z36.literal("disconnected"),
1665
- z36.literal("authenticationError"),
1666
- z36.literal("connectError"),
1667
- z36.literal("unset")
2357
+ state: z39.union([
2358
+ z39.literal("init"),
2359
+ z39.literal("syncing"),
2360
+ z39.literal("connecting"),
2361
+ z39.literal("connected"),
2362
+ z39.literal("disconnected"),
2363
+ z39.literal("authenticationError"),
2364
+ z39.literal("connectError"),
2365
+ z39.literal("unset")
1668
2366
  ])
1669
2367
  });
1670
2368
 
1671
2369
  // src/mail/schemas/message.schema.ts
1672
- import z37 from "zod";
1673
- var AttachmentSchema = z37.object({
1674
- id: z37.string(),
1675
- createdAt: z37.date(),
1676
- updatedAt: z37.date(),
1677
- deletedAt: z37.nullable(z37.date()),
1678
- roomId: z37.string(),
1679
- messageId: z37.string(),
1680
- fileName: z37.string(),
1681
- fileType: z37.string(),
1682
- emailEngineAttachmentId: z37.string(),
1683
- uploadId: z37.string(),
1684
- upload: z37.object({
1685
- id: z37.string(),
1686
- createdAt: z37.date(),
1687
- updatedAt: z37.date(),
1688
- deletedAt: z37.nullable(z37.date()),
1689
- bucket_name: z37.string(),
1690
- file_name: z37.string(),
1691
- file_key: z37.string(),
1692
- file_size: z37.number(),
1693
- file_url: z37.string(),
1694
- extension_name: z37.string()
2370
+ import z40 from "zod";
2371
+ var AttachmentSchema = z40.object({
2372
+ id: z40.string(),
2373
+ createdAt: z40.date(),
2374
+ updatedAt: z40.date(),
2375
+ deletedAt: z40.nullable(z40.date()),
2376
+ roomId: z40.string(),
2377
+ messageId: z40.string(),
2378
+ fileName: z40.string(),
2379
+ fileType: z40.string(),
2380
+ emailEngineAttachmentId: z40.string(),
2381
+ uploadId: z40.string(),
2382
+ upload: z40.object({
2383
+ id: z40.string(),
2384
+ createdAt: z40.date(),
2385
+ updatedAt: z40.date(),
2386
+ deletedAt: z40.nullable(z40.date()),
2387
+ bucket_name: z40.string(),
2388
+ file_name: z40.string(),
2389
+ file_key: z40.string(),
2390
+ file_size: z40.number(),
2391
+ file_url: z40.string(),
2392
+ extension_name: z40.string()
1695
2393
  })
1696
2394
  });
1697
- var MessageSchema2 = z37.object({
1698
- id: z37.string(),
1699
- createdAt: z37.date(),
1700
- updatedAt: z37.date(),
1701
- deletedAt: z37.nullable(z37.date()),
1702
- roomId: z37.string(),
1703
- subject: z37.string(),
1704
- textPlain: z37.string(),
1705
- textHtml: z37.string(),
1706
- textId: z37.string(),
1707
- emailEngineEmailId: z37.string(),
1708
- emailEngineMessageId: z37.string(),
1709
- emailEngineReplyTo: z37.nullable(z37.string()),
1710
- direction: z37.string(),
1711
- date: z37.date(),
1712
- action: z37.string(),
1713
- unseen: z37.boolean(),
1714
- seemsLikeNew: z37.boolean(),
1715
- from: z37.array(MailUserSchema),
1716
- to: z37.array(MailUserSchema),
1717
- cc: z37.array(MailUserSchema),
1718
- bcc: z37.array(MailUserSchema),
1719
- attachments: z37.array(AttachmentSchema)
2395
+ var MessageSchema2 = z40.object({
2396
+ id: z40.string(),
2397
+ createdAt: z40.date(),
2398
+ updatedAt: z40.date(),
2399
+ deletedAt: z40.nullable(z40.date()),
2400
+ roomId: z40.string(),
2401
+ subject: z40.string(),
2402
+ textPlain: z40.string(),
2403
+ textHtml: z40.string(),
2404
+ textId: z40.string(),
2405
+ emailEngineEmailId: z40.string(),
2406
+ emailEngineMessageId: z40.string(),
2407
+ emailEngineReplyTo: z40.nullable(z40.string()),
2408
+ direction: z40.string(),
2409
+ date: z40.date(),
2410
+ action: z40.string(),
2411
+ unseen: z40.boolean(),
2412
+ seemsLikeNew: z40.boolean(),
2413
+ from: z40.array(MailUserSchema),
2414
+ to: z40.array(MailUserSchema),
2415
+ cc: z40.array(MailUserSchema),
2416
+ bcc: z40.array(MailUserSchema),
2417
+ attachments: z40.array(AttachmentSchema)
1720
2418
  });
1721
2419
 
1722
2420
  // src/mail/schemas/room.schema.ts
1723
- var MailUserSchema = z38.object({
1724
- id: z38.string(),
1725
- createdAt: z38.date(),
1726
- updatedAt: z38.date(),
1727
- deletedAt: z38.date().nullable(),
1728
- name: z38.string(),
1729
- address: z38.string()
1730
- });
1731
- var TagSchema2 = z38.object({
1732
- color: z38.string(),
1733
- id: z38.string(),
1734
- createdAt: z38.date(),
1735
- updatedAt: z38.date(),
1736
- deletedAt: z38.date().nullable(),
1737
- name: z38.string()
1738
- });
1739
- var UserModel = z38.object({
1740
- id: z38.string().uuid(),
1741
- createdAt: z38.date(),
1742
- updatedAt: z38.date(),
1743
- deletedAt: z38.date().nullable(),
1744
- name: z38.string(),
1745
- email: z38.string(),
1746
- address: z38.string().nullable(),
1747
- phone: z38.string().nullable(),
1748
- notification_count: z38.number().nullable()
1749
- });
1750
- var ActivityLogModel = z38.object({
1751
- id: z38.string(),
1752
- createdAt: z38.string(),
1753
- updatedAt: z38.string(),
1754
- deletedAt: z38.nullable(z38.string()),
1755
- description: z38.string(),
1756
- actorId: z38.string(),
1757
- roomId: z38.string(),
2421
+ var MailUserSchema = z41.object({
2422
+ id: z41.string(),
2423
+ createdAt: z41.date(),
2424
+ updatedAt: z41.date(),
2425
+ deletedAt: z41.date().nullable(),
2426
+ name: z41.string(),
2427
+ address: z41.string()
2428
+ });
2429
+ var TagSchema2 = z41.object({
2430
+ color: z41.string(),
2431
+ id: z41.string(),
2432
+ createdAt: z41.date(),
2433
+ updatedAt: z41.date(),
2434
+ deletedAt: z41.date().nullable(),
2435
+ name: z41.string()
2436
+ });
2437
+ var UserModel = z41.object({
2438
+ id: z41.string().uuid(),
2439
+ createdAt: z41.date(),
2440
+ updatedAt: z41.date(),
2441
+ deletedAt: z41.date().nullable(),
2442
+ name: z41.string(),
2443
+ email: z41.string(),
2444
+ address: z41.string().nullable(),
2445
+ phone: z41.string().nullable(),
2446
+ notification_count: z41.number().nullable()
2447
+ });
2448
+ var ActivityLogModel = z41.object({
2449
+ id: z41.string(),
2450
+ createdAt: z41.string(),
2451
+ updatedAt: z41.string(),
2452
+ deletedAt: z41.nullable(z41.string()),
2453
+ description: z41.string(),
2454
+ actorId: z41.string(),
2455
+ roomId: z41.string(),
1758
2456
  actor: UserModel
1759
2457
  });
1760
- var MessagesAndLogs = z38.array(z38.union([MessageSchema2, ActivityLogModel]));
1761
- var MailRoomSchema = z38.object({
1762
- id: z38.string(),
1763
- createdAt: z38.date(),
1764
- updatedAt: z38.date(),
1765
- deletedAt: z38.date().nullable(),
1766
- subject: z38.string(),
1767
- resolved: z38.boolean(),
1768
- assigneeId: z38.string().nullable(),
1769
- note: z38.string(),
1770
- mailId: z38.string(),
1771
- direction: z38.string(),
1772
- lastMessageId: z38.string(),
1773
- firstMessageId: z38.string(),
1774
- from: z38.array(MailUserSchema),
1775
- to: z38.array(MailUserSchema),
1776
- cc: z38.array(MailUserSchema),
1777
- bcc: z38.array(MailUserSchema),
2458
+ var MessagesAndLogs = z41.array(z41.union([MessageSchema2, ActivityLogModel]));
2459
+ var MailRoomSchema = z41.object({
2460
+ id: z41.string(),
2461
+ createdAt: z41.date(),
2462
+ updatedAt: z41.date(),
2463
+ deletedAt: z41.date().nullable(),
2464
+ subject: z41.string(),
2465
+ resolved: z41.boolean(),
2466
+ assigneeId: z41.string().nullable(),
2467
+ note: z41.string(),
2468
+ mailId: z41.string(),
2469
+ direction: z41.string(),
2470
+ lastMessageId: z41.string(),
2471
+ firstMessageId: z41.string(),
2472
+ from: z41.array(MailUserSchema),
2473
+ to: z41.array(MailUserSchema),
2474
+ cc: z41.array(MailUserSchema),
2475
+ bcc: z41.array(MailUserSchema),
1778
2476
  firstMessage: MessageSchema2,
1779
2477
  lastMessage: MessageSchema2,
1780
- tags: z38.array(TagSchema2),
2478
+ tags: z41.array(TagSchema2),
1781
2479
  assignee: UserModel,
1782
- messages: z38.array(MessageSchema2),
2480
+ messages: z41.array(MessageSchema2),
1783
2481
  messagesAndLogs: MessagesAndLogs,
1784
2482
  mail: MailAccountSchema,
1785
- unReadMessageCount: z38.number()
1786
- });
1787
- var AttachmentSchema2 = z38.object({
1788
- fileName: z38.string(),
1789
- fileType: z38.string(),
1790
- emailEngineAttachmentId: z38.string(),
1791
- uploadId: z38.string(),
1792
- messageId: z38.string(),
1793
- roomId: z38.string(),
2483
+ unReadMessageCount: z41.number()
2484
+ });
2485
+ var AttachmentSchema2 = z41.object({
2486
+ fileName: z41.string(),
2487
+ fileType: z41.string(),
2488
+ emailEngineAttachmentId: z41.string(),
2489
+ uploadId: z41.string(),
2490
+ messageId: z41.string(),
2491
+ roomId: z41.string(),
1794
2492
  upload: UploadSchema
1795
2493
  });
1796
2494
 
1797
2495
  // src/mail/room-contract.ts
1798
- var roomContract = initContract12().router(
2496
+ var roomContract = initContract13().router(
1799
2497
  {
1800
2498
  create: {
1801
2499
  method: "POST",
1802
2500
  path: "/",
1803
2501
  responses: {
1804
2502
  200: DefaultSuccessResponseSchema.extend({
1805
- message: z39.string()
2503
+ message: z42.string()
1806
2504
  }),
1807
2505
  ...DefaultResponses
1808
2506
  },
@@ -1812,19 +2510,19 @@ var roomContract = initContract12().router(
1812
2510
  getAll: {
1813
2511
  method: "GET",
1814
2512
  path: "",
1815
- query: z39.object({
1816
- page: z39.coerce.number().default(1),
1817
- pageSize: z39.coerce.number().default(10),
1818
- keyword: z39.string().optional(),
1819
- assigneeId: z39.string().uuid().optional().nullable(),
1820
- resolved: z39.boolean().or(z39.string().transform((value) => value.toLowerCase() === "true")).optional().nullable()
2513
+ query: z42.object({
2514
+ page: z42.coerce.number().default(1),
2515
+ pageSize: z42.coerce.number().default(10),
2516
+ keyword: z42.string().optional(),
2517
+ assigneeId: z42.string().uuid().optional().nullable(),
2518
+ resolved: z42.boolean().or(z42.string().transform((value) => value.toLowerCase() === "true")).optional().nullable()
1821
2519
  }),
1822
2520
  responses: {
1823
2521
  200: DefaultSuccessResponseSchema.extend({
1824
- data: z39.array(MailRoomSchema),
1825
- total: z39.number(),
1826
- page: z39.number(),
1827
- pageSize: z39.number()
2522
+ data: z42.array(MailRoomSchema),
2523
+ total: z42.number(),
2524
+ page: z42.number(),
2525
+ pageSize: z42.number()
1828
2526
  }),
1829
2527
  ...DefaultResponses
1830
2528
  },
@@ -1833,8 +2531,8 @@ var roomContract = initContract12().router(
1833
2531
  getById: {
1834
2532
  method: "GET",
1835
2533
  path: "/:id",
1836
- pathParams: z39.object({
1837
- id: z39.string().uuid()
2534
+ pathParams: z42.object({
2535
+ id: z42.string().uuid()
1838
2536
  }),
1839
2537
  responses: {
1840
2538
  200: DefaultSuccessResponseSchema.extend({
@@ -1847,12 +2545,12 @@ var roomContract = initContract12().router(
1847
2545
  getAttachments: {
1848
2546
  method: "GET",
1849
2547
  path: "/:id/attachments",
1850
- pathParams: z39.object({
1851
- id: z39.string().uuid()
2548
+ pathParams: z42.object({
2549
+ id: z42.string().uuid()
1852
2550
  }),
1853
2551
  responses: {
1854
2552
  200: DefaultSuccessResponseSchema.extend({
1855
- data: z39.array(AttachmentSchema2)
2553
+ data: z42.array(AttachmentSchema2)
1856
2554
  }),
1857
2555
  ...DefaultResponses
1858
2556
  },
@@ -1861,12 +2559,12 @@ var roomContract = initContract12().router(
1861
2559
  getParticipants: {
1862
2560
  method: "GET",
1863
2561
  path: "/:id/participants",
1864
- pathParams: z39.object({
1865
- id: z39.string().uuid()
2562
+ pathParams: z42.object({
2563
+ id: z42.string().uuid()
1866
2564
  }),
1867
2565
  responses: {
1868
2566
  200: DefaultSuccessResponseSchema.extend({
1869
- data: z39.array(MailUserSchema)
2567
+ data: z42.array(MailUserSchema)
1870
2568
  }),
1871
2569
  ...DefaultResponses
1872
2570
  },
@@ -1875,8 +2573,8 @@ var roomContract = initContract12().router(
1875
2573
  update: {
1876
2574
  method: "PATCH",
1877
2575
  path: "/:id",
1878
- pathParams: z39.object({
1879
- id: z39.string()
2576
+ pathParams: z42.object({
2577
+ id: z42.string()
1880
2578
  }),
1881
2579
  responses: {
1882
2580
  200: DefaultSuccessResponseSchema.extend({
@@ -1884,15 +2582,15 @@ var roomContract = initContract12().router(
1884
2582
  }),
1885
2583
  ...DefaultResponses
1886
2584
  },
1887
- body: z39.object({
1888
- resolved: z39.boolean().or(
1889
- z39.union([z39.literal("true"), z39.literal("false")]).transform((value) => value.toLowerCase() === "true")
2585
+ body: z42.object({
2586
+ resolved: z42.boolean().or(
2587
+ z42.union([z42.literal("true"), z42.literal("false")]).transform((value) => value.toLowerCase() === "true")
1890
2588
  ).optional().nullable(),
1891
- assigneeId: z39.string().uuid().optional().nullable(),
1892
- note: z39.string().optional(),
1893
- tags: z39.array(z39.string().uuid()).optional(),
1894
- handover: z39.boolean().or(
1895
- z39.union([z39.literal("true"), z39.literal("false")]).transform((value) => value.toLowerCase() === "true")
2589
+ assigneeId: z42.string().uuid().optional().nullable(),
2590
+ note: z42.string().optional(),
2591
+ tags: z42.array(z42.string().uuid()).optional(),
2592
+ handover: z42.boolean().or(
2593
+ z42.union([z42.literal("true"), z42.literal("false")]).transform((value) => value.toLowerCase() === "true")
1896
2594
  ).optional().nullable()
1897
2595
  }),
1898
2596
  summary: "Update a mail room by id"
@@ -1900,12 +2598,12 @@ var roomContract = initContract12().router(
1900
2598
  markAsRead: {
1901
2599
  method: "GET",
1902
2600
  path: "/:id",
1903
- pathParams: z39.object({
1904
- id: z39.string().uuid()
2601
+ pathParams: z42.object({
2602
+ id: z42.string().uuid()
1905
2603
  }),
1906
2604
  responses: {
1907
2605
  200: DefaultSuccessResponseSchema.extend({
1908
- message: z39.string()
2606
+ message: z42.string()
1909
2607
  }),
1910
2608
  ...DefaultResponses
1911
2609
  },
@@ -1918,55 +2616,55 @@ var roomContract = initContract12().router(
1918
2616
  );
1919
2617
 
1920
2618
  // src/mail/account-contract.ts
1921
- import { initContract as initContract13 } from "@ts-rest/core";
1922
- import z41 from "zod";
2619
+ import { initContract as initContract14 } from "@ts-rest/core";
2620
+ import z44 from "zod";
1923
2621
 
1924
2622
  // src/mail/schemas/account-validation.schema.ts
1925
- import z40 from "zod";
2623
+ import z43 from "zod";
1926
2624
  var AccountContractsValidationSchemas = {
1927
2625
  create: {
1928
- input: z40.object({
1929
- address: z40.string().email("Email address must be valid email."),
1930
- name: z40.string().min(1, "Account name cannot be empty."),
1931
- password: z40.string().min(1, "Password cannot be empty."),
1932
- mailServerId: z40.string().uuid("Invalid mail_server_id")
2626
+ input: z43.object({
2627
+ address: z43.string().email("Email address must be valid email."),
2628
+ name: z43.string().min(1, "Account name cannot be empty."),
2629
+ password: z43.string().min(1, "Password cannot be empty."),
2630
+ mailServerId: z43.string().uuid("Invalid mail_server_id")
1933
2631
  })
1934
2632
  },
1935
2633
  getById: {
1936
- input: z40.object({
1937
- id: z40.string().uuid()
2634
+ input: z43.object({
2635
+ id: z43.string().uuid()
1938
2636
  }),
1939
2637
  output: MailAccountSchema
1940
2638
  },
1941
2639
  getAll: {
1942
- output: z40.array(MailAccountSchema)
2640
+ output: z43.array(MailAccountSchema)
1943
2641
  },
1944
2642
  update: {
1945
2643
  input: MailAccountSchema,
1946
2644
  output: MailAccountSchema
1947
2645
  },
1948
2646
  disconnect: {
1949
- input: z40.object({
1950
- id: z40.string().uuid()
2647
+ input: z43.object({
2648
+ id: z43.string().uuid()
1951
2649
  }),
1952
2650
  output: MailAccountSchema
1953
2651
  },
1954
2652
  reconnect: {
1955
- input: z40.object({
1956
- id: z40.string()
2653
+ input: z43.object({
2654
+ id: z43.string()
1957
2655
  }),
1958
2656
  output: MailAccountSchema
1959
2657
  },
1960
2658
  delete: {
1961
- input: z40.object({
1962
- id: z40.string()
2659
+ input: z43.object({
2660
+ id: z43.string()
1963
2661
  }),
1964
2662
  output: MailAccountSchema
1965
2663
  }
1966
2664
  };
1967
2665
 
1968
2666
  // src/mail/account-contract.ts
1969
- var accountContract = initContract13().router(
2667
+ var accountContract = initContract14().router(
1970
2668
  {
1971
2669
  //#region ........register account
1972
2670
  create: {
@@ -1975,16 +2673,16 @@ var accountContract = initContract13().router(
1975
2673
  responses: {
1976
2674
  201: DefaultSuccessResponseSchema.extend({
1977
2675
  // data: AccountContractsValidationSchemas.create.output,
1978
- message: z41.string()
2676
+ message: z44.string()
1979
2677
  }),
1980
- 400: z41.object({
1981
- message: z41.string()
2678
+ 400: z44.object({
2679
+ message: z44.string()
1982
2680
  }),
1983
- 409: z41.object({
1984
- message: z41.string()
2681
+ 409: z44.object({
2682
+ message: z44.string()
1985
2683
  }),
1986
- 500: z41.object({
1987
- message: z41.string()
2684
+ 500: z44.object({
2685
+ message: z44.string()
1988
2686
  }),
1989
2687
  ...DefaultResponses
1990
2688
  },
@@ -2013,7 +2711,7 @@ var accountContract = initContract13().router(
2013
2711
  path: "",
2014
2712
  responses: {
2015
2713
  200: DefaultSuccessResponseSchema.extend({
2016
- data: z41.any()
2714
+ data: z44.any()
2017
2715
  // data: AccountContractsValidationSchemas.getAll.output,
2018
2716
  }),
2019
2717
  ...DefaultResponses
@@ -2025,8 +2723,8 @@ var accountContract = initContract13().router(
2025
2723
  update: {
2026
2724
  method: "PATCH",
2027
2725
  path: "/:id",
2028
- pathParams: z41.object({
2029
- id: z41.string().uuid()
2726
+ pathParams: z44.object({
2727
+ id: z44.string().uuid()
2030
2728
  }),
2031
2729
  responses: {
2032
2730
  201: DefaultSuccessResponseSchema.extend({
@@ -2075,7 +2773,7 @@ var accountContract = initContract13().router(
2075
2773
  pathParams: AccountContractsValidationSchemas.delete.input,
2076
2774
  responses: {
2077
2775
  200: DefaultSuccessResponseSchema.extend({
2078
- message: z41.string()
2776
+ message: z44.string()
2079
2777
  }),
2080
2778
  ...DefaultResponses
2081
2779
  },
@@ -2091,16 +2789,16 @@ var accountContract = initContract13().router(
2091
2789
  );
2092
2790
 
2093
2791
  // src/mail/mail-server-contract.ts
2094
- import { initContract as initContract14 } from "@ts-rest/core";
2095
- import z42 from "zod";
2096
- var serverContract = initContract14().router(
2792
+ import { initContract as initContract15 } from "@ts-rest/core";
2793
+ import z45 from "zod";
2794
+ var serverContract = initContract15().router(
2097
2795
  {
2098
2796
  create: {
2099
2797
  method: "POST",
2100
2798
  path: "/",
2101
2799
  responses: {
2102
2800
  200: DefaultSuccessResponseSchema.extend({
2103
- message: z42.string()
2801
+ message: z45.string()
2104
2802
  }),
2105
2803
  ...DefaultResponses
2106
2804
  },
@@ -2110,12 +2808,12 @@ var serverContract = initContract14().router(
2110
2808
  get: {
2111
2809
  method: "GET",
2112
2810
  path: "/:id",
2113
- pathParams: z42.object({
2114
- id: z42.string()
2811
+ pathParams: z45.object({
2812
+ id: z45.string()
2115
2813
  }),
2116
2814
  responses: {
2117
2815
  200: DefaultSuccessResponseSchema.extend({
2118
- message: z42.string()
2816
+ message: z45.string()
2119
2817
  }),
2120
2818
  ...DefaultResponses
2121
2819
  },
@@ -2124,12 +2822,12 @@ var serverContract = initContract14().router(
2124
2822
  update: {
2125
2823
  method: "PATCH",
2126
2824
  path: "/:id",
2127
- pathParams: z42.object({
2128
- id: z42.string()
2825
+ pathParams: z45.object({
2826
+ id: z45.string()
2129
2827
  }),
2130
2828
  responses: {
2131
2829
  200: DefaultSuccessResponseSchema.extend({
2132
- message: z42.string()
2830
+ message: z45.string()
2133
2831
  }),
2134
2832
  ...DefaultResponses
2135
2833
  },
@@ -2139,12 +2837,12 @@ var serverContract = initContract14().router(
2139
2837
  delete: {
2140
2838
  method: "PATCH",
2141
2839
  path: "/:id",
2142
- pathParams: z42.object({
2143
- id: z42.string()
2840
+ pathParams: z45.object({
2841
+ id: z45.string()
2144
2842
  }),
2145
2843
  responses: {
2146
2844
  200: DefaultSuccessResponseSchema.extend({
2147
- message: z42.string()
2845
+ message: z45.string()
2148
2846
  }),
2149
2847
  ...DefaultResponses
2150
2848
  },
@@ -2158,51 +2856,51 @@ var serverContract = initContract14().router(
2158
2856
  );
2159
2857
 
2160
2858
  // src/mail/message-contract.ts
2161
- import { initContract as initContract15 } from "@ts-rest/core";
2162
- import z44 from "zod";
2859
+ import { initContract as initContract16 } from "@ts-rest/core";
2860
+ import z47 from "zod";
2163
2861
 
2164
2862
  // src/mail/schemas/message-validation.schema.ts
2165
- import z43 from "zod";
2166
- var MailParticipant = z43.object({
2167
- name: z43.string().optional(),
2168
- address: z43.string().email()
2863
+ import z46 from "zod";
2864
+ var MailParticipant = z46.object({
2865
+ name: z46.string().optional(),
2866
+ address: z46.string().email()
2169
2867
  });
2170
2868
  var MessageContractsValidationsSchema = {
2171
2869
  submit: {
2172
- input: z43.object({
2173
- subject: z43.string(),
2174
- text: z43.string(),
2175
- html: z43.string(),
2870
+ input: z46.object({
2871
+ subject: z46.string(),
2872
+ text: z46.string(),
2873
+ html: z46.string(),
2176
2874
  from: MailParticipant,
2177
- to: z43.array(MailParticipant),
2178
- cc: z43.array(MailParticipant).optional(),
2179
- bcc: z43.array(MailParticipant).optional(),
2180
- reference: z43.object({
2181
- messageId: z43.string(),
2182
- action: z43.union([z43.literal("reply"), z43.literal("forward")])
2875
+ to: z46.array(MailParticipant),
2876
+ cc: z46.array(MailParticipant).optional(),
2877
+ bcc: z46.array(MailParticipant).optional(),
2878
+ reference: z46.object({
2879
+ messageId: z46.string(),
2880
+ action: z46.union([z46.literal("reply"), z46.literal("forward")])
2183
2881
  }).optional(),
2184
- attachments: z43.array(
2185
- z43.object({
2186
- fileType: z43.string(),
2187
- fileName: z43.string(),
2188
- fileKey: z43.string(),
2189
- fileSize: z43.number(),
2190
- bucketName: z43.string(),
2191
- presignedUrl: z43.string()
2882
+ attachments: z46.array(
2883
+ z46.object({
2884
+ fileType: z46.string(),
2885
+ fileName: z46.string(),
2886
+ fileKey: z46.string(),
2887
+ fileSize: z46.number(),
2888
+ bucketName: z46.string(),
2889
+ presignedUrl: z46.string()
2192
2890
  })
2193
2891
  ).optional()
2194
2892
  }),
2195
- output: z43.object({
2196
- response: z43.string(),
2197
- messageId: z43.string(),
2198
- sendAt: z43.string(),
2199
- queueId: z43.string()
2893
+ output: z46.object({
2894
+ response: z46.string(),
2895
+ messageId: z46.string(),
2896
+ sendAt: z46.string(),
2897
+ queueId: z46.string()
2200
2898
  })
2201
2899
  }
2202
2900
  };
2203
2901
 
2204
2902
  // src/mail/message-contract.ts
2205
- var messageContract = initContract15().router(
2903
+ var messageContract = initContract16().router(
2206
2904
  {
2207
2905
  submit: {
2208
2906
  method: "POST",
@@ -2221,8 +2919,8 @@ var messageContract = initContract15().router(
2221
2919
  getById: {
2222
2920
  method: "GET",
2223
2921
  path: "/:id",
2224
- pathParams: z44.object({
2225
- id: z44.string()
2922
+ pathParams: z47.object({
2923
+ id: z47.string()
2226
2924
  }),
2227
2925
  responses: {
2228
2926
  200: DefaultSuccessResponseSchema.extend({
@@ -2240,7 +2938,7 @@ var messageContract = initContract15().router(
2240
2938
  );
2241
2939
 
2242
2940
  // src/mail/mail-contract.ts
2243
- var mailContract = initContract16().router({
2941
+ var mailContract = initContract17().router({
2244
2942
  room: roomContract,
2245
2943
  message: messageContract,
2246
2944
  account: accountContract,
@@ -2248,14 +2946,15 @@ var mailContract = initContract16().router({
2248
2946
  });
2249
2947
 
2250
2948
  // src/messenger/index.ts
2251
- import { initContract as initContract17 } from "@ts-rest/core";
2252
- var messengerContract = initContract17().router({
2949
+ import { initContract as initContract18 } from "@ts-rest/core";
2950
+ var messengerContract = initContract18().router({
2253
2951
  sendMessage: {
2254
2952
  method: "POST",
2255
2953
  path: "/message",
2256
2954
  body: SendMessageToPlatformSchema,
2257
2955
  responses: {
2258
- 200: DefaultSuccessResponseSchema
2956
+ 200: SendMessageResponseSchema,
2957
+ 500: DefaultErrorResponseSchema
2259
2958
  }
2260
2959
  }
2261
2960
  }, {
@@ -2263,18 +2962,18 @@ var messengerContract = initContract17().router({
2263
2962
  });
2264
2963
 
2265
2964
  // src/permission/index.ts
2266
- import { initContract as initContract18 } from "@ts-rest/core";
2267
- import z45 from "zod";
2268
- var permissionContract = initContract18().router(
2965
+ import { initContract as initContract19 } from "@ts-rest/core";
2966
+ import z48 from "zod";
2967
+ var permissionContract = initContract19().router(
2269
2968
  {
2270
2969
  getPermissions: {
2271
2970
  method: "GET",
2272
2971
  path: "",
2273
2972
  headers: DefaultHeaderSchema,
2274
2973
  responses: {
2275
- 200: z45.object({ permissions: PermissionSchema.array() }),
2276
- 400: z45.object({
2277
- message: z45.string()
2974
+ 200: z48.object({ permissions: PermissionSchema.array() }),
2975
+ 400: z48.object({
2976
+ message: z48.string()
2278
2977
  }),
2279
2978
  401: DefaultUnauthorizedSchema,
2280
2979
  500: DefaultErrorResponseSchema
@@ -2286,21 +2985,21 @@ var permissionContract = initContract18().router(
2286
2985
  );
2287
2986
 
2288
2987
  // src/role/index.ts
2289
- import { initContract as initContract19 } from "@ts-rest/core";
2290
- import z47 from "zod";
2988
+ import { initContract as initContract20 } from "@ts-rest/core";
2989
+ import z50 from "zod";
2291
2990
 
2292
2991
  // src/role/validation.ts
2293
- import { z as z46 } from "zod";
2294
- var CreateRoleSchema = z46.object({
2295
- systemName: z46.string(),
2296
- displayName: z46.string(),
2297
- description: z46.string().nullable(),
2298
- permissions: z46.array(z46.string())
2992
+ import { z as z49 } from "zod";
2993
+ var CreateRoleSchema = z49.object({
2994
+ systemName: z49.string(),
2995
+ displayName: z49.string(),
2996
+ description: z49.string().nullable(),
2997
+ permissions: z49.array(z49.string())
2299
2998
  });
2300
2999
  var UpdateRoleSchema = CreateRoleSchema;
2301
3000
 
2302
3001
  // src/role/index.ts
2303
- var roleContract = initContract19().router(
3002
+ var roleContract = initContract20().router(
2304
3003
  {
2305
3004
  createRole: {
2306
3005
  method: "POST",
@@ -2311,8 +3010,8 @@ var roleContract = initContract19().router(
2311
3010
  201: DefaultSuccessResponseSchema.extend({
2312
3011
  role: RoleSchema
2313
3012
  }),
2314
- 400: z47.object({
2315
- message: z47.string()
3013
+ 400: z50.object({
3014
+ message: z50.string()
2316
3015
  }),
2317
3016
  401: DefaultUnauthorizedSchema,
2318
3017
  500: DefaultErrorResponseSchema
@@ -2322,15 +3021,15 @@ var roleContract = initContract19().router(
2322
3021
  getRoles: {
2323
3022
  method: "GET",
2324
3023
  path: "",
2325
- query: z47.object({
2326
- page: z47.coerce.number().default(1),
2327
- pageSize: z47.coerce.number().default(10)
3024
+ query: z50.object({
3025
+ page: z50.coerce.number().default(1),
3026
+ pageSize: z50.coerce.number().default(10)
2328
3027
  }).optional(),
2329
3028
  headers: DefaultHeaderSchema,
2330
3029
  responses: {
2331
3030
  200: WithPagination(RoleSchema),
2332
- 400: z47.object({
2333
- message: z47.string()
3031
+ 400: z50.object({
3032
+ message: z50.string()
2334
3033
  }),
2335
3034
  401: DefaultUnauthorizedSchema,
2336
3035
  500: DefaultErrorResponseSchema
@@ -2340,15 +3039,15 @@ var roleContract = initContract19().router(
2340
3039
  updateRole: {
2341
3040
  method: "PATCH",
2342
3041
  path: "/:id",
2343
- pathParams: z47.object({ id: z47.string() }),
3042
+ pathParams: z50.object({ id: z50.string() }),
2344
3043
  headers: DefaultHeaderSchema,
2345
3044
  body: UpdateRoleSchema,
2346
3045
  responses: {
2347
3046
  201: DefaultSuccessResponseSchema.extend({
2348
3047
  role: RoleSchema
2349
3048
  }),
2350
- 400: z47.object({
2351
- message: z47.string()
3049
+ 400: z50.object({
3050
+ message: z50.string()
2352
3051
  }),
2353
3052
  401: DefaultUnauthorizedSchema,
2354
3053
  500: DefaultErrorResponseSchema
@@ -2358,11 +3057,11 @@ var roleContract = initContract19().router(
2358
3057
  deleteRole: {
2359
3058
  method: "DELETE",
2360
3059
  path: "/:id",
2361
- pathParams: z47.object({ id: z47.string() }),
3060
+ pathParams: z50.object({ id: z50.string() }),
2362
3061
  headers: DefaultHeaderSchema,
2363
3062
  body: null,
2364
3063
  responses: {
2365
- 200: DefaultSuccessResponseSchema.extend({ message: z47.string() }),
3064
+ 200: DefaultSuccessResponseSchema.extend({ message: z50.string() }),
2366
3065
  500: DefaultErrorResponseSchema
2367
3066
  },
2368
3067
  summary: "Delete a role."
@@ -2372,23 +3071,23 @@ var roleContract = initContract19().router(
2372
3071
  );
2373
3072
 
2374
3073
  // src/tag/index.ts
2375
- import { initContract as initContract20 } from "@ts-rest/core";
2376
- import z49 from "zod";
3074
+ import { initContract as initContract21 } from "@ts-rest/core";
3075
+ import z52 from "zod";
2377
3076
 
2378
3077
  // src/tag/validation.ts
2379
- import { z as z48 } from "zod";
2380
- var CreateTagSchema = z48.object({
2381
- name: z48.string(),
3078
+ import { z as z51 } from "zod";
3079
+ var CreateTagSchema = z51.object({
3080
+ name: z51.string(),
2382
3081
  group: TagGroupSchema
2383
3082
  });
2384
- var GetTagsSchema = z48.object({
3083
+ var GetTagsSchema = z51.object({
2385
3084
  group: TagGroupSchema.default("general"),
2386
- keyword: z48.string()
3085
+ keyword: z51.string()
2387
3086
  }).partial().optional();
2388
- var UpdateTagSchema = z48.object({ name: z48.string() });
3087
+ var UpdateTagSchema = z51.object({ name: z51.string() });
2389
3088
 
2390
3089
  // src/tag/index.ts
2391
- var tagContract = initContract20().router(
3090
+ var tagContract = initContract21().router(
2392
3091
  {
2393
3092
  createTag: {
2394
3093
  method: "POST",
@@ -2408,7 +3107,7 @@ var tagContract = initContract20().router(
2408
3107
  query: GetTagsSchema,
2409
3108
  responses: {
2410
3109
  200: DefaultSuccessResponseSchema.extend({
2411
- tags: z49.array(TagSchema)
3110
+ tags: z52.array(TagSchema)
2412
3111
  }),
2413
3112
  500: DefaultErrorResponseSchema
2414
3113
  },
@@ -2417,7 +3116,7 @@ var tagContract = initContract20().router(
2417
3116
  updateTag: {
2418
3117
  method: "PATCH",
2419
3118
  path: "/:id",
2420
- pathParams: z49.object({ id: z49.string() }),
3119
+ pathParams: z52.object({ id: z52.string() }),
2421
3120
  body: UpdateTagSchema,
2422
3121
  responses: {
2423
3122
  200: DefaultSuccessResponseSchema.extend({
@@ -2430,11 +3129,11 @@ var tagContract = initContract20().router(
2430
3129
  deleteTag: {
2431
3130
  method: "DELETE",
2432
3131
  path: "/:id",
2433
- pathParams: z49.object({ id: z49.string() }),
2434
- body: z49.any().optional(),
3132
+ pathParams: z52.object({ id: z52.string() }),
3133
+ body: z52.any().optional(),
2435
3134
  // We don't need the body.
2436
3135
  responses: {
2437
- 200: DefaultSuccessResponseSchema.extend({ message: z49.string() }),
3136
+ 200: DefaultSuccessResponseSchema.extend({ message: z52.string() }),
2438
3137
  500: DefaultErrorResponseSchema
2439
3138
  },
2440
3139
  headers: DefaultHeaderSchema
@@ -2446,41 +3145,41 @@ var tagContract = initContract20().router(
2446
3145
  );
2447
3146
 
2448
3147
  // src/telephony-agent-presence-status/index.ts
2449
- import { initContract as initContract21 } from "@ts-rest/core";
2450
- import z52 from "zod";
3148
+ import { initContract as initContract22 } from "@ts-rest/core";
3149
+ import z55 from "zod";
2451
3150
 
2452
3151
  // src/telephony-agent-presence-status/schema.ts
2453
- import z50 from "zod";
3152
+ import z53 from "zod";
2454
3153
  var PresenceStatusSchema = DefaultEntitySchema.extend({
2455
- status: z50.string(),
2456
- description: z50.string()
3154
+ status: z53.string(),
3155
+ description: z53.string()
2457
3156
  });
2458
3157
  var UserPresenceStatusSchema = DefaultEntitySchema.extend({
2459
3158
  user: UserSchema,
2460
3159
  presenceStatus: PresenceStatusSchema,
2461
- customPresenceStatus: z50.string().nullable().optional()
3160
+ customPresenceStatus: z53.string().nullable().optional()
2462
3161
  });
2463
3162
 
2464
3163
  // src/telephony-agent-presence-status/validation.ts
2465
- import { z as z51 } from "zod";
2466
- var UpdateUserStatusSchema = z51.object({
2467
- userId: z51.string(),
2468
- presenceStatusId: z51.string().nullable().optional(),
2469
- customPreseneStatus: z51.string().nullable().optional(),
2470
- reason: z51.string()
3164
+ import { z as z54 } from "zod";
3165
+ var UpdateUserStatusSchema = z54.object({
3166
+ userId: z54.string(),
3167
+ presenceStatusId: z54.string().nullable().optional(),
3168
+ customPreseneStatus: z54.string().nullable().optional(),
3169
+ reason: z54.string()
2471
3170
  });
2472
3171
 
2473
3172
  // src/telephony-agent-presence-status/index.ts
2474
- var telephonyAgentPresenceStatusContract = initContract21().router(
3173
+ var telephonyAgentPresenceStatusContract = initContract22().router(
2475
3174
  {
2476
3175
  getAllStatus: {
2477
3176
  method: "GET",
2478
3177
  path: "/presence_status",
2479
3178
  headers: DefaultHeaderSchema,
2480
3179
  responses: {
2481
- 200: z52.array(PresenceStatusSchema),
2482
- 400: z52.object({
2483
- message: z52.string()
3180
+ 200: z55.array(PresenceStatusSchema),
3181
+ 400: z55.object({
3182
+ message: z55.string()
2484
3183
  }),
2485
3184
  401: DefaultUnauthorizedSchema,
2486
3185
  500: DefaultErrorResponseSchema
@@ -2492,9 +3191,9 @@ var telephonyAgentPresenceStatusContract = initContract21().router(
2492
3191
  path: "/agents/presence_status",
2493
3192
  headers: DefaultHeaderSchema,
2494
3193
  responses: {
2495
- 200: z52.array(UserPresenceStatusSchema),
2496
- 400: z52.object({
2497
- message: z52.string()
3194
+ 200: z55.array(UserPresenceStatusSchema),
3195
+ 400: z55.object({
3196
+ message: z55.string()
2498
3197
  }),
2499
3198
  401: DefaultUnauthorizedSchema,
2500
3199
  500: DefaultErrorResponseSchema
@@ -2504,12 +3203,12 @@ var telephonyAgentPresenceStatusContract = initContract21().router(
2504
3203
  getAgentStatus: {
2505
3204
  method: "GET",
2506
3205
  path: "/presence_status/check_update/:userId",
2507
- pathParams: z52.object({ userId: z52.string() }),
3206
+ pathParams: z55.object({ userId: z55.string() }),
2508
3207
  headers: DefaultHeaderSchema,
2509
3208
  responses: {
2510
3209
  200: UserPresenceStatusSchema,
2511
- 400: z52.object({
2512
- message: z52.string()
3210
+ 400: z55.object({
3211
+ message: z55.string()
2513
3212
  }),
2514
3213
  401: DefaultUnauthorizedSchema,
2515
3214
  500: DefaultErrorResponseSchema
@@ -2525,8 +3224,8 @@ var telephonyAgentPresenceStatusContract = initContract21().router(
2525
3224
  200: DefaultSuccessResponseSchema.extend({
2526
3225
  userPresenceStatu: UserPresenceStatusSchema
2527
3226
  }),
2528
- 400: z52.object({
2529
- message: z52.string()
3227
+ 400: z55.object({
3228
+ message: z55.string()
2530
3229
  }),
2531
3230
  401: DefaultUnauthorizedSchema,
2532
3231
  500: DefaultErrorResponseSchema
@@ -2538,42 +3237,42 @@ var telephonyAgentPresenceStatusContract = initContract21().router(
2538
3237
  );
2539
3238
 
2540
3239
  // src/telephony-extension/index.ts
2541
- import { initContract as initContract22 } from "@ts-rest/core";
2542
- import z54 from "zod";
3240
+ import { initContract as initContract23 } from "@ts-rest/core";
3241
+ import z57 from "zod";
2543
3242
 
2544
3243
  // src/telephony-extension/schema.ts
2545
- import z53 from "zod";
2546
- var TelephonyExtensionSchema = z53.object({
2547
- errcode: z53.coerce.number(),
2548
- errmsg: z53.string(),
2549
- total_number: z53.coerce.number(),
2550
- data: z53.array(
2551
- z53.object({
2552
- id: z53.coerce.number(),
2553
- online_status: z53.object({
2554
- fx_phone: z53.object({ status: z53.coerce.number() }),
2555
- sip_phone: z53.object({
2556
- status: z53.coerce.number(),
2557
- ext_dev_type: z53.string().optional()
2558
- }),
2559
- linkus_desktop: z53.object({ status: z53.coerce.number() }),
2560
- linkus_mobile: z53.object({ status: z53.coerce.number() }),
2561
- linkus_web: z53.object({
2562
- status: z53.coerce.number(),
2563
- ext_dev_type: z53.string().optional()
3244
+ import z56 from "zod";
3245
+ var TelephonyExtensionSchema = z56.object({
3246
+ errcode: z56.coerce.number(),
3247
+ errmsg: z56.string(),
3248
+ total_number: z56.coerce.number(),
3249
+ data: z56.array(
3250
+ z56.object({
3251
+ id: z56.coerce.number(),
3252
+ online_status: z56.object({
3253
+ fx_phone: z56.object({ status: z56.coerce.number() }),
3254
+ sip_phone: z56.object({
3255
+ status: z56.coerce.number(),
3256
+ ext_dev_type: z56.string().optional()
3257
+ }),
3258
+ linkus_desktop: z56.object({ status: z56.coerce.number() }),
3259
+ linkus_mobile: z56.object({ status: z56.coerce.number() }),
3260
+ linkus_web: z56.object({
3261
+ status: z56.coerce.number(),
3262
+ ext_dev_type: z56.string().optional()
2564
3263
  })
2565
3264
  }).optional(),
2566
- presence_status: z53.string().optional(),
2567
- number: z53.string().optional(),
2568
- caller_id_name: z53.string().optional(),
2569
- role_name: z53.string().optional(),
2570
- email_addr: z53.string().optional()
3265
+ presence_status: z56.string().optional(),
3266
+ number: z56.string().optional(),
3267
+ caller_id_name: z56.string().optional(),
3268
+ role_name: z56.string().optional(),
3269
+ email_addr: z56.string().optional()
2571
3270
  })
2572
3271
  )
2573
3272
  });
2574
3273
 
2575
3274
  // src/telephony-extension/index.ts
2576
- var telephonyExtensionContract = initContract22().router(
3275
+ var telephonyExtensionContract = initContract23().router(
2577
3276
  {
2578
3277
  getTelephonyExtensions: {
2579
3278
  method: "GET",
@@ -2582,8 +3281,8 @@ var telephonyExtensionContract = initContract22().router(
2582
3281
  query: null,
2583
3282
  responses: {
2584
3283
  200: TelephonyExtensionSchema,
2585
- 400: z54.object({
2586
- message: z54.string()
3284
+ 400: z57.object({
3285
+ message: z57.string()
2587
3286
  }),
2588
3287
  401: DefaultUnauthorizedSchema,
2589
3288
  500: DefaultErrorResponseSchema
@@ -2595,26 +3294,26 @@ var telephonyExtensionContract = initContract22().router(
2595
3294
  );
2596
3295
 
2597
3296
  // src/user/index.ts
2598
- import { initContract as initContract23 } from "@ts-rest/core";
2599
- import z56 from "zod";
3297
+ import { initContract as initContract24 } from "@ts-rest/core";
3298
+ import z59 from "zod";
2600
3299
 
2601
3300
  // src/user/validation.ts
2602
- import { z as z55 } from "zod";
2603
- var CreateUserSchema = z55.object({
2604
- name: z55.string(),
2605
- email: z55.string().email(),
2606
- address: z55.string().nullable(),
2607
- phone: z55.string().nullable(),
2608
- password: z55.string(),
2609
- notificationCount: z55.number().nullable().optional(),
2610
- roles: z55.array(z55.string())
3301
+ import { z as z58 } from "zod";
3302
+ var CreateUserSchema = z58.object({
3303
+ name: z58.string(),
3304
+ email: z58.string().email(),
3305
+ address: z58.string().nullable(),
3306
+ phone: z58.string().nullable(),
3307
+ password: z58.string(),
3308
+ notificationCount: z58.number().nullable().optional(),
3309
+ roles: z58.array(z58.string())
2611
3310
  });
2612
3311
  var UpdateUserSchema = CreateUserSchema.extend({
2613
- newPassword: z55.string()
3312
+ newPassword: z58.string()
2614
3313
  });
2615
3314
 
2616
3315
  // src/user/index.ts
2617
- var userContract = initContract23().router(
3316
+ var userContract = initContract24().router(
2618
3317
  {
2619
3318
  createUser: {
2620
3319
  method: "POST",
@@ -2625,8 +3324,8 @@ var userContract = initContract23().router(
2625
3324
  201: DefaultSuccessResponseSchema.extend({
2626
3325
  user: UserSchema
2627
3326
  }),
2628
- 400: z56.object({
2629
- message: z56.string()
3327
+ 400: z59.object({
3328
+ message: z59.string()
2630
3329
  }),
2631
3330
  401: DefaultUnauthorizedSchema
2632
3331
  },
@@ -2636,15 +3335,15 @@ var userContract = initContract23().router(
2636
3335
  method: "GET",
2637
3336
  path: "",
2638
3337
  headers: DefaultHeaderSchema,
2639
- query: z56.object({
2640
- page: z56.coerce.number().default(1),
2641
- pageSize: z56.coerce.number().default(10),
2642
- keyword: z56.string().optional()
3338
+ query: z59.object({
3339
+ page: z59.coerce.number().default(1),
3340
+ pageSize: z59.coerce.number().default(10),
3341
+ keyword: z59.string().optional()
2643
3342
  }).optional(),
2644
3343
  responses: {
2645
3344
  200: WithPagination(UserSchema),
2646
- 400: z56.object({
2647
- message: z56.string()
3345
+ 400: z59.object({
3346
+ message: z59.string()
2648
3347
  }),
2649
3348
  401: DefaultUnauthorizedSchema,
2650
3349
  500: DefaultErrorResponseSchema
@@ -2654,12 +3353,12 @@ var userContract = initContract23().router(
2654
3353
  getUserById: {
2655
3354
  method: "GET",
2656
3355
  path: "/:id",
2657
- pathParams: z56.object({ id: z56.string() }),
3356
+ pathParams: z59.object({ id: z59.string() }),
2658
3357
  headers: DefaultHeaderSchema,
2659
3358
  responses: {
2660
3359
  200: UserSchema,
2661
- 400: z56.object({
2662
- message: z56.string()
3360
+ 400: z59.object({
3361
+ message: z59.string()
2663
3362
  }),
2664
3363
  401: DefaultUnauthorizedSchema
2665
3364
  },
@@ -2668,15 +3367,15 @@ var userContract = initContract23().router(
2668
3367
  updateUser: {
2669
3368
  method: "PATCH",
2670
3369
  path: "/:id",
2671
- pathParams: z56.object({ id: z56.string() }),
3370
+ pathParams: z59.object({ id: z59.string() }),
2672
3371
  headers: DefaultHeaderSchema,
2673
3372
  body: UpdateUserSchema,
2674
3373
  responses: {
2675
3374
  201: DefaultSuccessResponseSchema.extend({
2676
3375
  role: UserSchema
2677
3376
  }),
2678
- 400: z56.object({
2679
- message: z56.string()
3377
+ 400: z59.object({
3378
+ message: z59.string()
2680
3379
  }),
2681
3380
  401: DefaultUnauthorizedSchema
2682
3381
  },
@@ -2685,11 +3384,11 @@ var userContract = initContract23().router(
2685
3384
  deleteUser: {
2686
3385
  method: "DELETE",
2687
3386
  path: "/:id",
2688
- pathParams: z56.object({ id: z56.string() }),
3387
+ pathParams: z59.object({ id: z59.string() }),
2689
3388
  headers: DefaultHeaderSchema,
2690
3389
  body: null,
2691
3390
  responses: {
2692
- 200: DefaultSuccessResponseSchema.extend({ message: z56.string() }),
3391
+ 200: DefaultSuccessResponseSchema.extend({ message: z59.string() }),
2693
3392
  500: DefaultErrorResponseSchema
2694
3393
  },
2695
3394
  summary: "Delete a user."
@@ -2699,28 +3398,28 @@ var userContract = initContract23().router(
2699
3398
  );
2700
3399
 
2701
3400
  // src/user-presence-status-log/index.ts
2702
- import { initContract as initContract24 } from "@ts-rest/core";
2703
- import z59 from "zod";
3401
+ import { initContract as initContract25 } from "@ts-rest/core";
3402
+ import z62 from "zod";
2704
3403
 
2705
3404
  // src/user-presence-status-log/schema.ts
2706
- import z57 from "zod";
3405
+ import z60 from "zod";
2707
3406
  var UserPresenceStatusLogSchema = DefaultEntitySchema.extend({
2708
3407
  user: UserSchema,
2709
3408
  previousPresenceStatus: PresenceStatusSchema,
2710
3409
  newPresenceStatus: PresenceStatusSchema,
2711
- reason: z57.string()
3410
+ reason: z60.string()
2712
3411
  });
2713
3412
 
2714
3413
  // src/user-presence-status-log/validation.ts
2715
- import z58 from "zod";
2716
- var UserPresenceStatusLogParamsSchema = z58.object({
2717
- page: z58.coerce.number().default(1),
2718
- pageSize: z58.coerce.number().default(10),
2719
- selectedDate: z58.string().optional()
3414
+ import z61 from "zod";
3415
+ var UserPresenceStatusLogParamsSchema = z61.object({
3416
+ page: z61.coerce.number().default(1),
3417
+ pageSize: z61.coerce.number().default(10),
3418
+ selectedDate: z61.string().optional()
2720
3419
  }).optional();
2721
3420
 
2722
3421
  // src/user-presence-status-log/index.ts
2723
- var userPresenceStatusLogContract = initContract24().router(
3422
+ var userPresenceStatusLogContract = initContract25().router(
2724
3423
  {
2725
3424
  getUserPresenceStatusLog: {
2726
3425
  method: "GET",
@@ -2729,8 +3428,8 @@ var userPresenceStatusLogContract = initContract24().router(
2729
3428
  headers: DefaultHeaderSchema,
2730
3429
  responses: {
2731
3430
  200: WithPagination(UserPresenceStatusLogSchema),
2732
- 400: z59.object({
2733
- message: z59.string()
3431
+ 400: z62.object({
3432
+ message: z62.string()
2734
3433
  }),
2735
3434
  401: DefaultUnauthorizedSchema,
2736
3435
  500: DefaultErrorResponseSchema
@@ -2742,43 +3441,43 @@ var userPresenceStatusLogContract = initContract24().router(
2742
3441
  );
2743
3442
 
2744
3443
  // src/widget/index.ts
2745
- import { initContract as initContract25 } from "@ts-rest/core";
2746
- import z62 from "zod";
3444
+ import { initContract as initContract26 } from "@ts-rest/core";
3445
+ import z65 from "zod";
2747
3446
 
2748
3447
  // src/widget/schema.ts
2749
- import z60 from "zod";
2750
- var FieldsSchema = z60.object({ data: z60.array(z60.string()) });
2751
- var WidgetPositionSchema = z60.union([
2752
- z60.literal("menu"),
2753
- z60.literal("ticket_detail"),
2754
- z60.literal("contact_detail")
3448
+ import z63 from "zod";
3449
+ var FieldsSchema = z63.object({ data: z63.array(z63.string()) });
3450
+ var WidgetPositionSchema = z63.union([
3451
+ z63.literal("menu"),
3452
+ z63.literal("ticket_detail"),
3453
+ z63.literal("contact_detail")
2755
3454
  ]);
2756
3455
  var WidgetSchema = DefaultEntitySchema.extend({
2757
- name: z60.string(),
2758
- description: z60.string().nullable(),
3456
+ name: z63.string(),
3457
+ description: z63.string().nullable(),
2759
3458
  position: WidgetPositionSchema.nullable(),
2760
3459
  fields: FieldsSchema,
2761
- url: z60.string()
3460
+ url: z63.string()
2762
3461
  });
2763
3462
 
2764
3463
  // src/widget/validation.ts
2765
- import z61 from "zod";
2766
- var CreateWidgetSchema = z61.object({
2767
- name: z61.string(),
2768
- description: z61.string(),
2769
- url: z61.string(),
3464
+ import z64 from "zod";
3465
+ var CreateWidgetSchema = z64.object({
3466
+ name: z64.string(),
3467
+ description: z64.string(),
3468
+ url: z64.string(),
2770
3469
  position: WidgetPositionSchema,
2771
- fields: z61.object({
3470
+ fields: z64.object({
2772
3471
  data: (
2773
3472
  // Array of attribute system names
2774
- z61.array(z61.string())
3473
+ z64.array(z64.string())
2775
3474
  )
2776
3475
  }).optional()
2777
3476
  });
2778
3477
  var UpdateWidgetSchema = CreateWidgetSchema;
2779
3478
 
2780
3479
  // src/widget/index.ts
2781
- var widgetContract = initContract25().router(
3480
+ var widgetContract = initContract26().router(
2782
3481
  {
2783
3482
  createWidget: {
2784
3483
  method: "POST",
@@ -2789,8 +3488,8 @@ var widgetContract = initContract25().router(
2789
3488
  201: DefaultSuccessResponseSchema.extend({
2790
3489
  widget: WidgetSchema
2791
3490
  }),
2792
- 400: z62.object({
2793
- message: z62.string()
3491
+ 400: z65.object({
3492
+ message: z65.string()
2794
3493
  }),
2795
3494
  401: DefaultUnauthorizedSchema,
2796
3495
  500: DefaultErrorResponseSchema
@@ -2800,17 +3499,17 @@ var widgetContract = initContract25().router(
2800
3499
  getWidgets: {
2801
3500
  method: "GET",
2802
3501
  path: "",
2803
- query: z62.object({
2804
- page: z62.coerce.number().default(1),
2805
- pageSize: z62.coerce.number().default(10),
2806
- keyword: z62.coerce.string().optional()
3502
+ query: z65.object({
3503
+ page: z65.coerce.number().default(1),
3504
+ pageSize: z65.coerce.number().default(10),
3505
+ keyword: z65.coerce.string().optional()
2807
3506
  }).optional(),
2808
3507
  headers: DefaultHeaderSchema,
2809
3508
  responses: {
2810
3509
  200: WithPagination(WidgetSchema),
2811
3510
  500: DefaultErrorResponseSchema,
2812
- 400: z62.object({
2813
- message: z62.string()
3511
+ 400: z65.object({
3512
+ message: z65.string()
2814
3513
  }),
2815
3514
  401: DefaultUnauthorizedSchema
2816
3515
  },
@@ -2821,9 +3520,9 @@ var widgetContract = initContract25().router(
2821
3520
  path: "/menu",
2822
3521
  headers: DefaultHeaderSchema,
2823
3522
  responses: {
2824
- 200: z62.array(WidgetSchema),
2825
- 400: z62.object({
2826
- message: z62.string()
3523
+ 200: z65.array(WidgetSchema),
3524
+ 400: z65.object({
3525
+ message: z65.string()
2827
3526
  }),
2828
3527
  401: DefaultUnauthorizedSchema,
2829
3528
  500: DefaultErrorResponseSchema
@@ -2835,9 +3534,9 @@ var widgetContract = initContract25().router(
2835
3534
  path: "/ticket_detail",
2836
3535
  headers: DefaultHeaderSchema,
2837
3536
  responses: {
2838
- 200: z62.array(WidgetSchema),
2839
- 400: z62.object({
2840
- message: z62.string()
3537
+ 200: z65.array(WidgetSchema),
3538
+ 400: z65.object({
3539
+ message: z65.string()
2841
3540
  }),
2842
3541
  401: DefaultUnauthorizedSchema,
2843
3542
  500: DefaultErrorResponseSchema
@@ -2849,9 +3548,9 @@ var widgetContract = initContract25().router(
2849
3548
  path: "/contact_detail",
2850
3549
  headers: DefaultHeaderSchema,
2851
3550
  responses: {
2852
- 200: z62.array(WidgetSchema),
2853
- 400: z62.object({
2854
- message: z62.string()
3551
+ 200: z65.array(WidgetSchema),
3552
+ 400: z65.object({
3553
+ message: z65.string()
2855
3554
  }),
2856
3555
  401: DefaultUnauthorizedSchema,
2857
3556
  500: DefaultErrorResponseSchema
@@ -2861,12 +3560,12 @@ var widgetContract = initContract25().router(
2861
3560
  getWidgetById: {
2862
3561
  method: "GET",
2863
3562
  path: "/:id",
2864
- pathParams: z62.object({ id: z62.string() }),
3563
+ pathParams: z65.object({ id: z65.string() }),
2865
3564
  headers: DefaultHeaderSchema,
2866
3565
  responses: {
2867
3566
  200: WidgetSchema,
2868
- 400: z62.object({
2869
- message: z62.string()
3567
+ 400: z65.object({
3568
+ message: z65.string()
2870
3569
  }),
2871
3570
  401: DefaultUnauthorizedSchema,
2872
3571
  500: DefaultErrorResponseSchema
@@ -2900,14 +3599,14 @@ var widgetContract = initContract25().router(
2900
3599
  updateWidget: {
2901
3600
  method: "PATCH",
2902
3601
  path: "/:id",
2903
- pathParams: z62.object({ id: z62.string() }),
3602
+ pathParams: z65.object({ id: z65.string() }),
2904
3603
  headers: DefaultHeaderSchema,
2905
3604
  responses: {
2906
3605
  201: DefaultSuccessResponseSchema.extend({
2907
3606
  widget: WidgetSchema
2908
3607
  }),
2909
- 400: z62.object({
2910
- message: z62.string()
3608
+ 400: z65.object({
3609
+ message: z65.string()
2911
3610
  }),
2912
3611
  401: DefaultUnauthorizedSchema
2913
3612
  },
@@ -2917,11 +3616,11 @@ var widgetContract = initContract25().router(
2917
3616
  deleteWidget: {
2918
3617
  method: "DELETE",
2919
3618
  path: "/:id",
2920
- pathParams: z62.object({ id: z62.string() }),
3619
+ pathParams: z65.object({ id: z65.string() }),
2921
3620
  headers: DefaultHeaderSchema,
2922
3621
  body: null,
2923
3622
  responses: {
2924
- 200: DefaultSuccessResponseSchema.extend({ message: z62.string() }),
3623
+ 200: DefaultSuccessResponseSchema.extend({ message: z65.string() }),
2925
3624
  500: DefaultErrorResponseSchema
2926
3625
  },
2927
3626
  summary: "Delete a widget."
@@ -2931,33 +3630,33 @@ var widgetContract = initContract25().router(
2931
3630
  );
2932
3631
 
2933
3632
  // src/wrap-up-form/index.ts
2934
- import { initContract as initContract26 } from "@ts-rest/core";
2935
- import z65 from "zod";
3633
+ import { initContract as initContract27 } from "@ts-rest/core";
3634
+ import z68 from "zod";
2936
3635
 
2937
3636
  // src/wrap-up-form/schema.ts
2938
- import z63 from "zod";
3637
+ import z66 from "zod";
2939
3638
  var WrapUpFormSchema = DefaultEntitySchema.extend({
2940
- note: z63.string().nullable(),
2941
- disposition: z63.string().nullable(),
2942
- callFrom: z63.string().nullable(),
2943
- callTo: z63.string().nullable(),
2944
- tags: z63.array(TagSchema)
3639
+ note: z66.string().nullable(),
3640
+ disposition: z66.string().nullable(),
3641
+ callFrom: z66.string().nullable(),
3642
+ callTo: z66.string().nullable(),
3643
+ tags: z66.array(TagSchema)
2945
3644
  });
2946
3645
 
2947
3646
  // src/wrap-up-form/validation.ts
2948
- import { z as z64 } from "zod";
2949
- var CreateWrapUpFormSchema = z64.object({
2950
- note: z64.string().nullable().optional(),
2951
- disposition: z64.string().nullable().optional(),
2952
- callFrom: z64.string().nullable().optional(),
2953
- callTo: z64.string().nullable().optional()
3647
+ import { z as z67 } from "zod";
3648
+ var CreateWrapUpFormSchema = z67.object({
3649
+ note: z67.string().nullable().optional(),
3650
+ disposition: z67.string().nullable().optional(),
3651
+ callFrom: z67.string().nullable().optional(),
3652
+ callTo: z67.string().nullable().optional()
2954
3653
  });
2955
3654
  var UpdateWrapUpFormSchema = CreateWrapUpFormSchema.extend({
2956
- tags: z64.array(z64.string()).optional()
3655
+ tags: z67.array(z67.string()).optional()
2957
3656
  });
2958
3657
 
2959
3658
  // src/wrap-up-form/index.ts
2960
- var wrapUpFormContract = initContract26().router(
3659
+ var wrapUpFormContract = initContract27().router(
2961
3660
  {
2962
3661
  createWrapUpForm: {
2963
3662
  method: "POST",
@@ -2968,8 +3667,8 @@ var wrapUpFormContract = initContract26().router(
2968
3667
  201: DefaultSuccessResponseSchema.extend({
2969
3668
  wrapUpForm: WrapUpFormSchema
2970
3669
  }),
2971
- 400: z65.object({
2972
- message: z65.string()
3670
+ 400: z68.object({
3671
+ message: z68.string()
2973
3672
  }),
2974
3673
  401: DefaultUnauthorizedSchema,
2975
3674
  500: DefaultErrorResponseSchema
@@ -2979,15 +3678,15 @@ var wrapUpFormContract = initContract26().router(
2979
3678
  getWrapUpForms: {
2980
3679
  method: "GET",
2981
3680
  path: "",
2982
- query: z65.object({
2983
- page: z65.coerce.number().default(1),
2984
- pageSize: z65.coerce.number().default(10)
3681
+ query: z68.object({
3682
+ page: z68.coerce.number().default(1),
3683
+ pageSize: z68.coerce.number().default(10)
2985
3684
  }).optional(),
2986
3685
  headers: DefaultHeaderSchema,
2987
3686
  responses: {
2988
3687
  200: WithPagination(WrapUpFormSchema),
2989
- 400: z65.object({
2990
- message: z65.string()
3688
+ 400: z68.object({
3689
+ message: z68.string()
2991
3690
  }),
2992
3691
  401: DefaultUnauthorizedSchema,
2993
3692
  500: DefaultErrorResponseSchema
@@ -2997,15 +3696,15 @@ var wrapUpFormContract = initContract26().router(
2997
3696
  updateWrapUpForm: {
2998
3697
  method: "PATCH",
2999
3698
  path: "/:id",
3000
- pathParams: z65.object({ id: z65.string() }),
3699
+ pathParams: z68.object({ id: z68.string() }),
3001
3700
  headers: DefaultHeaderSchema,
3002
3701
  body: UpdateWrapUpFormSchema,
3003
3702
  responses: {
3004
3703
  201: DefaultSuccessResponseSchema.extend({
3005
3704
  wrapUpForm: WrapUpFormSchema
3006
3705
  }),
3007
- 400: z65.object({
3008
- message: z65.string()
3706
+ 400: z68.object({
3707
+ message: z68.string()
3009
3708
  }),
3010
3709
  401: DefaultUnauthorizedSchema,
3011
3710
  500: DefaultErrorResponseSchema
@@ -3017,7 +3716,7 @@ var wrapUpFormContract = initContract26().router(
3017
3716
  );
3018
3717
 
3019
3718
  // src/contract.ts
3020
- var apiContract = initContract27().router({
3719
+ var apiContract = initContract28().router({
3021
3720
  auth: authContract,
3022
3721
  mail: mailContract,
3023
3722
  cxLog: cxLogContract,
@@ -3036,13 +3735,14 @@ var apiContract = initContract27().router({
3036
3735
  aws: awsContract,
3037
3736
  agentPresenceStatus: telephonyAgentPresenceStatusContract,
3038
3737
  userPresenceStatusLog: userPresenceStatusLogContract,
3039
- contact: contactContract
3738
+ contact: contactContract,
3739
+ ticket: ticketContract
3040
3740
  });
3041
- var platformContract = initContract27().router({
3741
+ var platformContract = initContract28().router({
3042
3742
  line: lineContract,
3043
3743
  messenger: messengerContract
3044
3744
  });
3045
- var chatContract = initContract27().router({
3745
+ var chatContract = initContract28().router({
3046
3746
  main: mainChatContract
3047
3747
  });
3048
3748
  export {