@kl1/contracts 1.0.42 → 1.0.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -906,7 +906,9 @@ var TelephonyCdrSchema = DefaultEntitySchema.extend({
906
906
  upload: UploadSchema.optional().nullable(),
907
907
  serialNumber: z24.string().nullable(),
908
908
  extensionId: z24.string().uuid().nullable(),
909
- extension: ExtensionSchema.optional().nullable(),
909
+ extension: ExtensionSchema.extend({
910
+ user: UserSchema.optional().nullable()
911
+ }).optional().nullable(),
910
912
  telephonyQueueId: z24.string().uuid().nullable(),
911
913
  contactId: z24.string().nullable()
912
914
  });
@@ -1108,7 +1110,7 @@ var MessageAttachmentSchema = z29.object({
1108
1110
  fileKey: z29.string(),
1109
1111
  fileName: z29.string(),
1110
1112
  fileSize: z29.number(),
1111
- url: z29.string(),
1113
+ url: z29.string().nullable(),
1112
1114
  fileType: z29.string(),
1113
1115
  thumbnailUrl: z29.string().optional()
1114
1116
  });
@@ -1122,7 +1124,7 @@ var SendMessageSchema = z29.object({
1122
1124
  message: z29.string().optional(),
1123
1125
  messageAttachments: MessageAttachmentSchema.optional(),
1124
1126
  user: UserSchema.optional(),
1125
- sticker: StickerSchema
1127
+ sticker: StickerSchema.optional()
1126
1128
  });
1127
1129
  var SolveRoomSchema = z29.object({
1128
1130
  roomId: z29.string(),
@@ -1195,7 +1197,12 @@ var SendMessageToPlatformSchema = z29.object({
1195
1197
  url: z29.string().optional(),
1196
1198
  previewUrl: z29.string().optional(),
1197
1199
  imageSetId: z29.string().optional(),
1198
- upload: UploadSchema.optional(),
1200
+ upload: z29.object({
1201
+ bucketName: z29.string(),
1202
+ fileName: z29.string(),
1203
+ fileSize: z29.number(),
1204
+ fileKey: z29.string()
1205
+ }).optional(),
1199
1206
  sender: z29.object({
1200
1207
  name: z29.string(),
1201
1208
  email: z29.string().email(),
@@ -1317,6 +1324,7 @@ var mainChatContract = initContract6().router(
1317
1324
  path: "/message",
1318
1325
  body: SendMessageSchema,
1319
1326
  responses: {
1327
+ 422: DefaultErrorResponseSchema,
1320
1328
  500: DefaultErrorResponseSchema
1321
1329
  },
1322
1330
  summary: "Send message to room"
@@ -4972,7 +4980,7 @@ var activityLogContract = initContract31().router(
4972
4980
  );
4973
4981
 
4974
4982
  // src/telephony-cdr/index.ts
4975
- import z84 from "zod";
4983
+ import z85 from "zod";
4976
4984
 
4977
4985
  // src/telephony-cdr/validation.ts
4978
4986
  import z83 from "zod";
@@ -5015,9 +5023,239 @@ var GetRecentTelephonyCdrSchema = DefaultQueryParamsSchema.extend({
5015
5023
  notes: z83.string().optional()
5016
5024
  });
5017
5025
  var GetExportTelephonyCdrSchema = GetRecentTelephonyCdrSchema;
5026
+ var GetYeastarCallReportSchema = DefaultQueryParamsSchema.extend({
5027
+ reportType: z83.enum([
5028
+ "extcallstatistics",
5029
+ "extcallactivity",
5030
+ "trunkactivity",
5031
+ "queuesatisfaction",
5032
+ "queueavgwaittalktime",
5033
+ "queueperformance",
5034
+ "queueagentmisscalls",
5035
+ "queueagentinoutcalls"
5036
+ ]),
5037
+ selectedDate: z83.string().optional(),
5038
+ communicationType: z83.enum(["Inbound", "Outbound", "Internal"]).optional(),
5039
+ time: z83.string().optional(),
5040
+ queueList: z83.array(z83.string()).optional(),
5041
+ queueId: z83.string().optional(),
5042
+ trunkList: z83.array(z83.string()).optional(),
5043
+ extensionList: z83.array(z83.string()).optional()
5044
+ }).superRefine((input, ctx) => {
5045
+ var _a, _b, _c;
5046
+ if ((input.reportType === "extcallstatistics" || input.reportType === "queuesatisfaction" || input.reportType === "queueperformance") && (input.selectedDate === null || input.selectedDate === "")) {
5047
+ ctx.addIssue({
5048
+ code: z83.ZodIssueCode.custom,
5049
+ path: ["selectedDate"],
5050
+ message: "selectedDate is required."
5051
+ });
5052
+ }
5053
+ if (input.reportType === "extcallstatistics" && (input.communicationType === null || input.selectedDate === "")) {
5054
+ ctx.addIssue({
5055
+ code: z83.ZodIssueCode.custom,
5056
+ path: ["communicationType"],
5057
+ message: "communicationType is required."
5058
+ });
5059
+ }
5060
+ if ((input.reportType === "extcallactivity" || input.reportType === "queueavgwaittalktime" || input.reportType === "trunkactivity") && (input.time === null || input.time === "")) {
5061
+ ctx.addIssue({
5062
+ code: z83.ZodIssueCode.custom,
5063
+ path: ["time"],
5064
+ message: "time is required."
5065
+ });
5066
+ }
5067
+ if ((input.reportType === "queueavgwaittalktime" || input.reportType === "queueperformance") && (((_a = input.queueList) == null ? void 0 : _a.length) || 0) < 0) {
5068
+ ctx.addIssue({
5069
+ code: z83.ZodIssueCode.custom,
5070
+ path: ["queueList"],
5071
+ message: "queueList is required."
5072
+ });
5073
+ }
5074
+ if ((input.reportType === "queuesatisfaction" || input.reportType === "queueagentmisscalls") && (input.queueId === null || input.queueId === "")) {
5075
+ ctx.addIssue({
5076
+ code: z83.ZodIssueCode.custom,
5077
+ path: ["queueId"],
5078
+ message: "queueId is required."
5079
+ });
5080
+ }
5081
+ if (input.reportType === "trunkactivity" && (((_b = input.trunkList) == null ? void 0 : _b.length) || 0) < 0) {
5082
+ ctx.addIssue({
5083
+ code: z83.ZodIssueCode.custom,
5084
+ path: ["trunkList"],
5085
+ message: "trunkList is required."
5086
+ });
5087
+ }
5088
+ if ((input.reportType === "extcallstatistics" || input.reportType === "extcallactivity") && (((_c = input.extensionList) == null ? void 0 : _c.length) || 0) < 0) {
5089
+ ctx.addIssue({
5090
+ code: z83.ZodIssueCode.custom,
5091
+ path: ["extensionList"],
5092
+ message: "extensionList is required."
5093
+ });
5094
+ }
5095
+ });
5018
5096
 
5019
5097
  // src/telephony-cdr/index.ts
5020
5098
  import { initContract as initContract32 } from "@ts-rest/core";
5099
+
5100
+ // src/telephony-cdr/call-report.schema.ts
5101
+ import z84 from "zod";
5102
+ var ExtCallStatisticsList = z84.object({
5103
+ /** @example "ext_num" */
5104
+ ext_num: z84.string(),
5105
+ /** @example "ext_name" */
5106
+ ext_name: z84.string(),
5107
+ /** @example 0 */
5108
+ answered_calls: z84.number(),
5109
+ /** @example 0 */
5110
+ no_answer_calls: z84.number(),
5111
+ /** @example 0 */
5112
+ busy_calls: z84.number(),
5113
+ /** @example 0 */
5114
+ failed_calls: z84.number(),
5115
+ /** @example 0 */
5116
+ voicemail_calls: z84.number(),
5117
+ /** @example 0 */
5118
+ total_holding_time: z84.number(),
5119
+ /** @example 0 */
5120
+ total_talking_time: z84.number(),
5121
+ /** @example "src_name" */
5122
+ src_name: z84.string(),
5123
+ /** @example 0 */
5124
+ total_call_count: z84.number(),
5125
+ /** @example "mobile" */
5126
+ mobile: z84.string()
5127
+ });
5128
+ var ExtStatistic = z84.object({
5129
+ ext_num: z84.string(),
5130
+ ext_name: z84.string(),
5131
+ answered_calls: z84.number(),
5132
+ no_answer_calls: z84.number(),
5133
+ busy_calls: z84.number(),
5134
+ failed_calls: z84.number(),
5135
+ voicemail_calls: z84.number(),
5136
+ total_holding_time: z84.number(),
5137
+ total_talking_time: z84.number(),
5138
+ time: z84.number(),
5139
+ mobile: z84.string()
5140
+ });
5141
+ var ExtCallActivityList = z84.object({
5142
+ time: z84.number(),
5143
+ answered_calls: z84.number(),
5144
+ no_answer_calls: z84.number(),
5145
+ busy_calls: z84.number(),
5146
+ failed_calls: z84.number(),
5147
+ voicemail_calls: z84.number(),
5148
+ total_holding_time: z84.number(),
5149
+ total_talking_time: z84.number(),
5150
+ ext_statistics: z84.array(ExtStatistic)
5151
+ });
5152
+ var TrunkList = z84.object({
5153
+ trunk_name: z84.string(),
5154
+ total_calls: z84.number()
5155
+ });
5156
+ var TrunkActivityList = z84.object({
5157
+ time: z84.number(),
5158
+ trunk_list: z84.array(TrunkList)
5159
+ });
5160
+ var QueueAvgWaitTalkTimeList = z84.object({
5161
+ time: z84.number(),
5162
+ avg_wait_time: z84.number(),
5163
+ avg_talk_time: z84.number()
5164
+ });
5165
+ var SatisfactionList = z84.object({
5166
+ press_key: z84.string(),
5167
+ total: z84.number(),
5168
+ key_point: z84.number().optional()
5169
+ });
5170
+ var agentListSchema = z84.object({
5171
+ agent_name: z84.string(),
5172
+ agent_num: z84.string(),
5173
+ satisfaction_list: z84.array(SatisfactionList).optional(),
5174
+ total_key: z84.number().optional(),
5175
+ total_point: z84.number().optional(),
5176
+ average_point: z84.number().optional()
5177
+ });
5178
+ var QueueSatisfaction = z84.object({
5179
+ queue_name: z84.string(),
5180
+ queue_num: z84.string(),
5181
+ satisfaction_list: z84.array(SatisfactionList).optional(),
5182
+ agent_list: z84.array(agentListSchema).optional(),
5183
+ total_key: z84.number().optional(),
5184
+ total_point: z84.number().optional(),
5185
+ average_point: z84.number().optional()
5186
+ });
5187
+ var QueuePerformanceList = z84.object({
5188
+ queue: z84.string(),
5189
+ total_calls: z84.number(),
5190
+ answered_calls: z84.number(),
5191
+ missed_calls: z84.number(),
5192
+ abandoned_calls: z84.number(),
5193
+ average_waiting_time: z84.number(),
5194
+ average_talking_time: z84.number(),
5195
+ max_waiting_time: z84.number(),
5196
+ answered_rate: z84.number(),
5197
+ missed_rate: z84.number(),
5198
+ abandoned_rate: z84.number(),
5199
+ sla: z84.number()
5200
+ });
5201
+ var QueueAgentMissCallsList = z84.object({
5202
+ agent_name: z84.string(),
5203
+ agent_num: z84.string(),
5204
+ time: z84.string(),
5205
+ total_wait_time: z84.number(),
5206
+ src_name: z84.string(),
5207
+ src_num: z84.string(),
5208
+ queue_status: z84.string(),
5209
+ polling_attempts: z84.number(),
5210
+ missed_reason: z84.string()
5211
+ });
5212
+ var QueueAgentInOutCallsList = z84.object({
5213
+ agent_name: z84.string(),
5214
+ agent_num: z84.string(),
5215
+ inbound_calls: z84.number(),
5216
+ inbound_duration: z84.number(),
5217
+ outbound_calls: z84.number(),
5218
+ outbound_duration: z84.number(),
5219
+ total_calls: z84.number(),
5220
+ total_duration: z84.number(),
5221
+ average_talk_duration: z84.number()
5222
+ });
5223
+ var CallReportModel = z84.object({
5224
+ errcode: z84.number(),
5225
+ errmsg: z84.string(),
5226
+ total_number: z84.number(),
5227
+ is_12hour: z84.number().optional(),
5228
+ ext_call_statistics_list: z84.array(ExtCallStatisticsList).optional(),
5229
+ ext_call_activity_list: z84.array(ExtCallActivityList).optional(),
5230
+ trunk_activity_list: z84.array(TrunkActivityList).optional(),
5231
+ queue_avg_wait_talk_time_list: z84.array(QueueAvgWaitTalkTimeList).optional(),
5232
+ queue_satisfaction: QueueSatisfaction.optional(),
5233
+ queue_performance_list: z84.array(QueuePerformanceList).optional(),
5234
+ queue_agent_miss_calls_list: z84.array(QueueAgentMissCallsList).optional(),
5235
+ queue_agent_in_out_calls_list: z84.array(QueueAgentInOutCallsList).optional(),
5236
+ callback_result: z84.string(),
5237
+ page: z84.number().optional(),
5238
+ pageSize: z84.number().optional()
5239
+ });
5240
+ var CallReportSchema = z84.object({
5241
+ errcode: z84.number(),
5242
+ errmsg: z84.string(),
5243
+ total_number: z84.number(),
5244
+ is_12hour: z84.number().optional(),
5245
+ ext_call_statistics_list: z84.array(ExtCallStatisticsList).optional(),
5246
+ ext_call_activity_list: z84.array(ExtCallActivityList).optional(),
5247
+ trunk_activity_list: z84.array(TrunkActivityList).optional(),
5248
+ queue_avg_wait_talk_time_list: z84.array(QueueAvgWaitTalkTimeList).optional(),
5249
+ queue_satisfaction: QueueSatisfaction.optional(),
5250
+ queue_performance_list: z84.array(QueuePerformanceList).optional(),
5251
+ queue_agent_miss_calls_list: z84.array(QueueAgentMissCallsList).optional(),
5252
+ queue_agent_in_out_calls_list: z84.array(QueueAgentInOutCallsList).optional(),
5253
+ callback_result: z84.string(),
5254
+ page: z84.number().optional(),
5255
+ pageSize: z84.number().optional()
5256
+ });
5257
+
5258
+ // src/telephony-cdr/index.ts
5021
5259
  var telephonyCdrContract = initContract32().router(
5022
5260
  {
5023
5261
  findAll: {
@@ -5027,10 +5265,10 @@ var telephonyCdrContract = initContract32().router(
5027
5265
  query: GetAllTelephonyCdrSchema,
5028
5266
  responses: {
5029
5267
  200: DefaultSuccessResponseSchema.extend({
5030
- total: z84.number(),
5031
- page: z84.number(),
5032
- pageSize: z84.number(),
5033
- telephonyCdrs: z84.array(TelephonyCdrSchema)
5268
+ total: z85.number(),
5269
+ page: z85.number(),
5270
+ pageSize: z85.number(),
5271
+ telephonyCdrs: z85.array(TelephonyCdrSchema)
5034
5272
  }),
5035
5273
  401: DefaultUnauthorizedSchema
5036
5274
  },
@@ -5043,10 +5281,10 @@ var telephonyCdrContract = initContract32().router(
5043
5281
  query: GetAllTelephonyCdrSchema,
5044
5282
  responses: {
5045
5283
  200: DefaultSuccessResponseSchema.extend({
5046
- total: z84.number(),
5047
- page: z84.number(),
5048
- pageSize: z84.number(),
5049
- telephonyCdrs: z84.array(TelephonyCdrSchema)
5284
+ total: z85.number(),
5285
+ page: z85.number(),
5286
+ pageSize: z85.number(),
5287
+ telephonyCdrs: z85.array(TelephonyCdrSchema)
5050
5288
  }),
5051
5289
  401: DefaultUnauthorizedSchema
5052
5290
  },
@@ -5059,10 +5297,10 @@ var telephonyCdrContract = initContract32().router(
5059
5297
  query: GetRecentTelephonyCdrSchema,
5060
5298
  responses: {
5061
5299
  200: DefaultSuccessResponseSchema.extend({
5062
- total: z84.number(),
5063
- page: z84.number(),
5064
- pageSize: z84.number(),
5065
- telephonyCdrs: z84.array(CreateTelephonyCdrSchema)
5300
+ total: z85.number(),
5301
+ page: z85.number(),
5302
+ pageSize: z85.number(),
5303
+ telephonyCdrs: z85.array(TelephonyCdrSchema)
5066
5304
  }),
5067
5305
  401: DefaultUnauthorizedSchema
5068
5306
  },
@@ -5078,20 +5316,31 @@ var telephonyCdrContract = initContract32().router(
5078
5316
  401: DefaultUnauthorizedSchema
5079
5317
  },
5080
5318
  summary: "Get recent telephony cdr."
5319
+ },
5320
+ yeastarCallReport: {
5321
+ method: "POST",
5322
+ path: "/yeastar_call_report",
5323
+ headers: DefaultHeaderSchema,
5324
+ body: GetYeastarCallReportSchema,
5325
+ responses: {
5326
+ 200: CallReportSchema,
5327
+ 401: DefaultUnauthorizedSchema
5328
+ },
5329
+ summary: "Get yeastar call report."
5081
5330
  }
5082
5331
  },
5083
5332
  { pathPrefix: "telephony-cdr" }
5084
5333
  );
5085
5334
 
5086
5335
  // src/evaluate-form/index.ts
5087
- import z86 from "zod";
5336
+ import z87 from "zod";
5088
5337
 
5089
5338
  // src/evaluate-form/validation.ts
5090
- import z85 from "zod";
5091
- var CreateEvaluateFormSchema = z85.object({
5092
- cxLogId: z85.string().uuid(),
5093
- sentimentScore: z85.string().nullable().optional(),
5094
- csatScore: z85.string().nullable().optional()
5339
+ import z86 from "zod";
5340
+ var CreateEvaluateFormSchema = z86.object({
5341
+ cxLogId: z86.string().uuid(),
5342
+ sentimentScore: z86.string().nullable().optional(),
5343
+ csatScore: z86.string().nullable().optional()
5095
5344
  });
5096
5345
  var UpdateEvaluateFormSchema = CreateEvaluateFormSchema.partial();
5097
5346
 
@@ -5105,7 +5354,7 @@ var evaluateFormContract = initContract33().router(
5105
5354
  body: CreateEvaluateFormSchema,
5106
5355
  responses: {
5107
5356
  201: DefaultSuccessResponseSchema.extend({
5108
- message: z86.string()
5357
+ message: z87.string()
5109
5358
  }),
5110
5359
  401: DefaultUnauthorizedSchema
5111
5360
  },