@kl1/contracts 1.0.43 → 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
  });
@@ -1322,6 +1324,7 @@ var mainChatContract = initContract6().router(
1322
1324
  path: "/message",
1323
1325
  body: SendMessageSchema,
1324
1326
  responses: {
1327
+ 422: DefaultErrorResponseSchema,
1325
1328
  500: DefaultErrorResponseSchema
1326
1329
  },
1327
1330
  summary: "Send message to room"
@@ -4977,7 +4980,7 @@ var activityLogContract = initContract31().router(
4977
4980
  );
4978
4981
 
4979
4982
  // src/telephony-cdr/index.ts
4980
- import z84 from "zod";
4983
+ import z85 from "zod";
4981
4984
 
4982
4985
  // src/telephony-cdr/validation.ts
4983
4986
  import z83 from "zod";
@@ -5020,9 +5023,239 @@ var GetRecentTelephonyCdrSchema = DefaultQueryParamsSchema.extend({
5020
5023
  notes: z83.string().optional()
5021
5024
  });
5022
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
+ });
5023
5096
 
5024
5097
  // src/telephony-cdr/index.ts
5025
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
5026
5259
  var telephonyCdrContract = initContract32().router(
5027
5260
  {
5028
5261
  findAll: {
@@ -5032,10 +5265,10 @@ var telephonyCdrContract = initContract32().router(
5032
5265
  query: GetAllTelephonyCdrSchema,
5033
5266
  responses: {
5034
5267
  200: DefaultSuccessResponseSchema.extend({
5035
- total: z84.number(),
5036
- page: z84.number(),
5037
- pageSize: z84.number(),
5038
- telephonyCdrs: z84.array(TelephonyCdrSchema)
5268
+ total: z85.number(),
5269
+ page: z85.number(),
5270
+ pageSize: z85.number(),
5271
+ telephonyCdrs: z85.array(TelephonyCdrSchema)
5039
5272
  }),
5040
5273
  401: DefaultUnauthorizedSchema
5041
5274
  },
@@ -5048,10 +5281,10 @@ var telephonyCdrContract = initContract32().router(
5048
5281
  query: GetAllTelephonyCdrSchema,
5049
5282
  responses: {
5050
5283
  200: DefaultSuccessResponseSchema.extend({
5051
- total: z84.number(),
5052
- page: z84.number(),
5053
- pageSize: z84.number(),
5054
- telephonyCdrs: z84.array(TelephonyCdrSchema)
5284
+ total: z85.number(),
5285
+ page: z85.number(),
5286
+ pageSize: z85.number(),
5287
+ telephonyCdrs: z85.array(TelephonyCdrSchema)
5055
5288
  }),
5056
5289
  401: DefaultUnauthorizedSchema
5057
5290
  },
@@ -5064,10 +5297,10 @@ var telephonyCdrContract = initContract32().router(
5064
5297
  query: GetRecentTelephonyCdrSchema,
5065
5298
  responses: {
5066
5299
  200: DefaultSuccessResponseSchema.extend({
5067
- total: z84.number(),
5068
- page: z84.number(),
5069
- pageSize: z84.number(),
5070
- telephonyCdrs: z84.array(CreateTelephonyCdrSchema)
5300
+ total: z85.number(),
5301
+ page: z85.number(),
5302
+ pageSize: z85.number(),
5303
+ telephonyCdrs: z85.array(TelephonyCdrSchema)
5071
5304
  }),
5072
5305
  401: DefaultUnauthorizedSchema
5073
5306
  },
@@ -5083,20 +5316,31 @@ var telephonyCdrContract = initContract32().router(
5083
5316
  401: DefaultUnauthorizedSchema
5084
5317
  },
5085
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."
5086
5330
  }
5087
5331
  },
5088
5332
  { pathPrefix: "telephony-cdr" }
5089
5333
  );
5090
5334
 
5091
5335
  // src/evaluate-form/index.ts
5092
- import z86 from "zod";
5336
+ import z87 from "zod";
5093
5337
 
5094
5338
  // src/evaluate-form/validation.ts
5095
- import z85 from "zod";
5096
- var CreateEvaluateFormSchema = z85.object({
5097
- cxLogId: z85.string().uuid(),
5098
- sentimentScore: z85.string().nullable().optional(),
5099
- 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()
5100
5344
  });
5101
5345
  var UpdateEvaluateFormSchema = CreateEvaluateFormSchema.partial();
5102
5346
 
@@ -5110,7 +5354,7 @@ var evaluateFormContract = initContract33().router(
5110
5354
  body: CreateEvaluateFormSchema,
5111
5355
  responses: {
5112
5356
  201: DefaultSuccessResponseSchema.extend({
5113
- message: z86.string()
5357
+ message: z87.string()
5114
5358
  }),
5115
5359
  401: DefaultUnauthorizedSchema
5116
5360
  },