hgs-twilio-class-lib 1.1.53 → 1.1.55

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 (480) hide show
  1. package/lib/aws/abstract/ServiceObjectStore.d.ts +9 -0
  2. package/lib/aws/abstract/ServiceObjectStore.js +10 -1
  3. package/lib/aws/abstract/ServiceOpenRequest.d.ts +7 -0
  4. package/lib/aws/abstract/ServiceOpenRequest.js +10 -1
  5. package/lib/aws/abstract/ServiceRequest.d.ts +3 -0
  6. package/lib/aws/abstract/ServiceRequest.js +7 -1
  7. package/lib/aws/abstract/ServiceResource.d.ts +20 -0
  8. package/lib/aws/abstract/ServiceResource.js +31 -1
  9. package/lib/aws/abstract/ServiceResourceFactory.d.ts +13 -0
  10. package/lib/aws/abstract/ServiceResourceFactory.js +14 -1
  11. package/lib/aws/abstract/ServiceTransaction.d.ts +6 -0
  12. package/lib/aws/abstract/ServiceTransaction.js +11 -1
  13. package/lib/aws/impl/AWSAPIConfig.d.ts +14 -0
  14. package/lib/aws/impl/AWSAPIConfig.js +38 -1
  15. package/lib/aws/impl/AWSClient.d.ts +5 -0
  16. package/lib/aws/impl/AWSClient.js +21 -1
  17. package/lib/aws/impl/AWSConnectAPIConfig.d.ts +17 -0
  18. package/lib/aws/impl/AWSConnectAPIConfig.js +38 -1
  19. package/lib/aws/impl/DynamoDB/DynamoOpenRequest.d.ts +18 -0
  20. package/lib/aws/impl/DynamoDB/DynamoOpenRequest.js +24 -1
  21. package/lib/aws/impl/DynamoDB/DynamoRequest.d.ts +16 -0
  22. package/lib/aws/impl/DynamoDB/DynamoRequest.js +21 -1
  23. package/lib/aws/impl/DynamoDB/DynamoResourse.d.ts +29 -0
  24. package/lib/aws/impl/DynamoDB/DynamoResourse.js +45 -1
  25. package/lib/aws/impl/DynamoDB/DynamoServiceFactory.d.ts +16 -0
  26. package/lib/aws/impl/DynamoDB/DynamoServiceFactory.js +63 -1
  27. package/lib/aws/impl/DynamoDB/DynamoTable.d.ts +26 -0
  28. package/lib/aws/impl/DynamoDB/DynamoTable.js +126 -1
  29. package/lib/aws/impl/DynamoDB/DynamoTransaction.d.ts +21 -0
  30. package/lib/aws/impl/DynamoDB/DynamoTransaction.js +37 -1
  31. package/lib/aws/impl/HoopServices/HoopService.d.ts +28 -0
  32. package/lib/aws/impl/HoopServices/HoopService.js +124 -1
  33. package/lib/aws/impl/HoopServices/HoopServiceFactory.d.ts +17 -0
  34. package/lib/aws/impl/HoopServices/HoopServiceFactory.js +53 -1
  35. package/lib/aws/impl/HoopServices/HoopServiceOpenRequest.d.ts +18 -0
  36. package/lib/aws/impl/HoopServices/HoopServiceOpenRequest.js +24 -1
  37. package/lib/aws/impl/HoopServices/HoopServiceResource.d.ts +29 -0
  38. package/lib/aws/impl/HoopServices/HoopServiceResource.js +46 -1
  39. package/lib/aws/impl/HoopServices/HoopServiceTransaction.d.ts +22 -0
  40. package/lib/aws/impl/HoopServices/HoopServiceTransaction.js +37 -1
  41. package/lib/aws/interface/IDirection.d.ts +2 -0
  42. package/lib/aws/interface/IDirection.js +2 -1
  43. package/lib/aws/interface/ILink.d.ts +2 -0
  44. package/lib/aws/interface/ILink.js +2 -1
  45. package/lib/aws/interface/IServiceDBOpenRequest.d.ts +3 -0
  46. package/lib/aws/interface/IServiceDBOpenRequest.js +2 -1
  47. package/lib/aws/interface/IServiceObjectStore.d.ts +3 -0
  48. package/lib/aws/interface/IServiceObjectStore.js +2 -1
  49. package/lib/aws/interface/IServiceObjectStoreParameters.d.ts +4 -0
  50. package/lib/aws/interface/IServiceObjectStoreParameters.js +2 -1
  51. package/lib/aws/interface/IServiceRequest.d.ts +3 -0
  52. package/lib/aws/interface/IServiceRequest.js +2 -1
  53. package/lib/aws/interface/IServiceResource.d.ts +7 -0
  54. package/lib/aws/interface/IServiceResource.js +2 -1
  55. package/lib/aws/interface/IServiceTransation.d.ts +3 -0
  56. package/lib/aws/interface/IServiceTransation.js +2 -1
  57. package/lib/aws/interface/ISubResourceUri.d.ts +2 -0
  58. package/lib/aws/interface/ISubResourceUri.js +2 -1
  59. package/lib/aws/interface/ISyncItemData.d.ts +0 -0
  60. package/lib/aws/interface/ISyncItemData.js +1 -1
  61. package/lib/aws/interface/ISyncObjectStoreParameters.d.ts +0 -0
  62. package/lib/aws/interface/ISyncObjectStoreParameters.js +1 -1
  63. package/lib/aws/interface/ISyncTransactionOptions.d.ts +4 -0
  64. package/lib/aws/interface/ISyncTransactionOptions.js +2 -1
  65. package/lib/common/abstract/CommonError.d.ts +8 -0
  66. package/lib/common/abstract/CommonError.js +12 -1
  67. package/lib/common/abstract/Database.d.ts +44 -0
  68. package/lib/common/abstract/Database.js +58 -1
  69. package/lib/common/abstract/DatabaseClient.d.ts +11 -0
  70. package/lib/common/abstract/DatabaseClient.js +21 -1
  71. package/lib/common/abstract/DatabaseClientConfig.d.ts +5 -0
  72. package/lib/common/abstract/DatabaseClientConfig.js +9 -1
  73. package/lib/common/abstract/DatabaseFactory.d.ts +70 -0
  74. package/lib/common/abstract/DatabaseFactory.js +32 -1
  75. package/lib/common/abstract/DatabaseObjectStore.d.ts +29 -0
  76. package/lib/common/abstract/DatabaseObjectStore.js +13 -1
  77. package/lib/common/abstract/DatabaseOpenRequest.d.ts +24 -0
  78. package/lib/common/abstract/DatabaseOpenRequest.js +13 -1
  79. package/lib/common/abstract/DatabaseRequest.d.ts +21 -0
  80. package/lib/common/abstract/DatabaseRequest.js +14 -1
  81. package/lib/common/abstract/DatabaseTransaction.d.ts +22 -0
  82. package/lib/common/abstract/DatabaseTransaction.js +13 -1
  83. package/lib/common/abstract/Filter.d.ts +12 -0
  84. package/lib/common/abstract/Filter.js +30 -1
  85. package/lib/common/enum/ErrorTypes.d.ts +4 -0
  86. package/lib/common/enum/ErrorTypes.js +9 -1
  87. package/lib/common/enum/FilterTypes.d.ts +10 -0
  88. package/lib/common/enum/FilterTypes.js +14 -1
  89. package/lib/common/interface/IDatabaesInfo.d.ts +2 -0
  90. package/lib/common/interface/IDatabaesInfo.js +2 -1
  91. package/lib/common/interface/IDatabase.d.ts +4 -0
  92. package/lib/common/interface/IDatabase.js +2 -1
  93. package/lib/common/interface/IDatabaseClient.d.ts +5 -0
  94. package/lib/common/interface/IDatabaseClient.js +2 -1
  95. package/lib/common/interface/IDatabaseConfig.d.ts +8 -0
  96. package/lib/common/interface/IDatabaseConfig.js +10 -1
  97. package/lib/common/interface/IDatabaseDBOpenRequest.d.ts +2 -0
  98. package/lib/common/interface/IDatabaseDBOpenRequest.js +2 -1
  99. package/lib/common/interface/IDatabaseFactory.d.ts +21 -0
  100. package/lib/common/interface/IDatabaseFactory.js +2 -1
  101. package/lib/common/interface/IDatabaseObjectStore.d.ts +2 -0
  102. package/lib/common/interface/IDatabaseObjectStore.js +2 -1
  103. package/lib/common/interface/IDatabaseObjectStoreParameters.d.ts +2 -0
  104. package/lib/common/interface/IDatabaseObjectStoreParameters.js +2 -1
  105. package/lib/common/interface/IDatabaseRecord.d.ts +2 -0
  106. package/lib/common/interface/IDatabaseRecord.js +2 -1
  107. package/lib/common/interface/IDatabaseRequest.d.ts +2 -0
  108. package/lib/common/interface/IDatabaseRequest.js +2 -1
  109. package/lib/common/interface/IDatabaseTransaction.d.ts +2 -0
  110. package/lib/common/interface/IDatabaseTransaction.js +2 -1
  111. package/lib/common/interface/IDatabaseTransactionOptions.d.ts +2 -0
  112. package/lib/common/interface/IDatabaseTransactionOptions.js +2 -1
  113. package/lib/common/interface/IError.d.ts +5 -0
  114. package/lib/common/interface/IError.js +2 -1
  115. package/lib/common/interface/IErrorDetails.d.ts +6 -0
  116. package/lib/common/interface/IErrorDetails.js +2 -1
  117. package/lib/common/interface/IFilter.d.ts +25 -0
  118. package/lib/common/interface/IFilter.js +2 -1
  119. package/lib/common/type/DatabaseReadyType.d.ts +1 -0
  120. package/lib/common/type/DatabaseReadyType.js +2 -1
  121. package/lib/common/type/FilterInputType.d.ts +1 -0
  122. package/lib/common/type/FilterInputType.js +2 -1
  123. package/lib/common/type/SearchParameterType.d.ts +15 -0
  124. package/lib/common/type/SearchParameterType.js +3 -1
  125. package/lib/common/utils/dateFormat.d.ts +1 -0
  126. package/lib/common/utils/dateFormat.js +58 -1
  127. package/lib/common/utils/filter.d.ts +1 -0
  128. package/lib/common/utils/filter.js +99 -1
  129. package/lib/common/utils/newFilter.d.ts +1 -0
  130. package/lib/common/utils/newFilter.js +126 -1
  131. package/lib/common/utils/pagination.d.ts +1 -0
  132. package/lib/common/utils/pagination.js +9 -1
  133. package/lib/common/utils/search.d.ts +1 -0
  134. package/lib/common/utils/search.js +14 -1
  135. package/lib/common/utils/sort.d.ts +1 -0
  136. package/lib/common/utils/sort.js +13 -1
  137. package/lib/config/AWSConfig.d.ts +6 -0
  138. package/lib/config/AWSConfig.js +9 -1
  139. package/lib/config/DatabaseConfig.d.ts +33 -0
  140. package/lib/config/DatabaseConfig.js +36 -1
  141. package/lib/config/TwilioConfig.d.ts +4 -0
  142. package/lib/config/TwilioConfig.js +7 -1
  143. package/lib/controller/Common.d.ts +20 -0
  144. package/lib/controller/Common.js +57 -1
  145. package/lib/controller/DatabaseFactoryCollection.d.ts +6 -0
  146. package/lib/controller/DatabaseFactoryCollection.js +14 -1
  147. package/lib/controller/MainController.d.ts +6 -0
  148. package/lib/controller/MainController.js +174 -1
  149. package/lib/controller/aws/HoopBuisnessHours.d.ts +23 -0
  150. package/lib/controller/aws/HoopBuisnessHours.js +408 -1
  151. package/lib/controller/aws/HoopOperationsController.d.ts +9 -0
  152. package/lib/controller/aws/HoopOperationsController.js +86 -1
  153. package/lib/controller/aws/HoopOverrideBranchesController.d.ts +7 -0
  154. package/lib/controller/aws/HoopOverrideBranchesController.js +40 -1
  155. package/lib/controller/aws/HoopProfilesListController.d.ts +8 -0
  156. package/lib/controller/aws/HoopProfilesListController.js +61 -1
  157. package/lib/controller/aws/PlaybackScreenrecordings.d.ts +9 -0
  158. package/lib/controller/aws/PlaybackScreenrecordings.js +63 -1
  159. package/lib/controller/twilio/AgentActionsController.d.ts +54 -0
  160. package/lib/controller/twilio/AgentActionsController.js +177 -1
  161. package/lib/controller/twilio/AgentScorecardController.d.ts +53 -0
  162. package/lib/controller/twilio/AgentScorecardController.js +173 -1
  163. package/lib/controller/twilio/AuditLogController.d.ts +15 -0
  164. package/lib/controller/twilio/AuditLogController.js +137 -1
  165. package/lib/controller/twilio/CallLogsController.d.ts +12 -0
  166. package/lib/controller/twilio/CallLogsController.js +131 -1
  167. package/lib/controller/twilio/CallbackAndVoicemailController.d.ts +12 -0
  168. package/lib/controller/twilio/CallbackAndVoicemailController.js +114 -1
  169. package/lib/controller/twilio/ChannelSettingTaskInfoController.d.ts +11 -0
  170. package/lib/controller/twilio/ChannelSettingTaskInfoController.js +117 -1
  171. package/lib/controller/twilio/ChannelSettingsController.d.ts +16 -0
  172. package/lib/controller/twilio/ChannelSettingsController.js +142 -1
  173. package/lib/controller/twilio/CxConfigAssetController.d.ts +12 -0
  174. package/lib/controller/twilio/CxConfigAssetController.js +128 -1
  175. package/lib/controller/twilio/CxConfigController.d.ts +18 -0
  176. package/lib/controller/twilio/CxConfigController.js +112 -1
  177. package/lib/controller/twilio/CxConfigExternalNumbersController.d.ts +12 -0
  178. package/lib/controller/twilio/CxConfigExternalNumbersController.js +138 -1
  179. package/lib/controller/twilio/CxConfigOther.d.ts +16 -0
  180. package/lib/controller/twilio/CxConfigOther.js +128 -1
  181. package/lib/controller/twilio/CxConfigQueueMenuController.d.ts +12 -0
  182. package/lib/controller/twilio/CxConfigQueueMenuController.js +129 -1
  183. package/lib/controller/twilio/CxConfigUIconfigController.d.ts +12 -0
  184. package/lib/controller/twilio/CxConfigUIconfigController.js +132 -1
  185. package/lib/controller/twilio/GPMController.d.ts +12 -0
  186. package/lib/controller/twilio/GPMController.js +151 -1
  187. package/lib/controller/twilio/HoopBusinessHoursController.d.ts +18 -0
  188. package/lib/controller/twilio/HoopBusinessHoursController.js +285 -1
  189. package/lib/controller/twilio/HoopHolidaysController.d.ts +14 -0
  190. package/lib/controller/twilio/HoopHolidaysController.js +150 -1
  191. package/lib/controller/twilio/HoopMainController.d.ts +13 -0
  192. package/lib/controller/twilio/HoopMainController.js +297 -1
  193. package/lib/controller/twilio/HoopNotesController.d.ts +14 -0
  194. package/lib/controller/twilio/HoopNotesController.js +149 -1
  195. package/lib/controller/twilio/HoopOperationsController.d.ts +14 -0
  196. package/lib/controller/twilio/HoopOperationsController.js +138 -1
  197. package/lib/controller/twilio/HoopOverrideBranchesController.d.ts +14 -0
  198. package/lib/controller/twilio/HoopOverrideBranchesController.js +137 -1
  199. package/lib/controller/twilio/HoopPartialDaysController.d.ts +14 -0
  200. package/lib/controller/twilio/HoopPartialDaysController.js +150 -1
  201. package/lib/controller/twilio/HoopProfilesListController.d.ts +14 -0
  202. package/lib/controller/twilio/HoopProfilesListController.js +147 -1
  203. package/lib/controller/twilio/NavigationController.d.ts +13 -0
  204. package/lib/controller/twilio/NavigationController.js +170 -1
  205. package/lib/controller/twilio/QualityFormsController.d.ts +12 -0
  206. package/lib/controller/twilio/QualityFormsController.js +129 -1
  207. package/lib/controller/twilio/QuickLinkController.d.ts +11 -0
  208. package/lib/controller/twilio/QuickLinkController.js +122 -1
  209. package/lib/controller/twilio/RealTimeReportQueueDetailsController.d.ts +14 -0
  210. package/lib/controller/twilio/RealTimeReportQueueDetailsController.js +126 -1
  211. package/lib/controller/twilio/RealTimeReportsWGDetailsController.d.ts +53 -0
  212. package/lib/controller/twilio/RealTimeReportsWGDetailsController.js +160 -1
  213. package/lib/controller/twilio/TaskInfoPanelController.d.ts +15 -0
  214. package/lib/controller/twilio/TaskInfoPanelController.js +134 -1
  215. package/lib/controller/twilio/filterImpl/AgentScorecardFilter.d.ts +12 -0
  216. package/lib/controller/twilio/filterImpl/AgentScorecardFilter.js +52 -1
  217. package/lib/controller/twilio/filterImpl/AuditLogsFilter.d.ts +12 -0
  218. package/lib/controller/twilio/filterImpl/AuditLogsFilter.js +89 -1
  219. package/lib/controller/twilio/filterImpl/CXConfigPromptFilter.d.ts +12 -0
  220. package/lib/controller/twilio/filterImpl/CXConfigPromptFilter.js +81 -1
  221. package/lib/controller/twilio/filterImpl/CallLogsFilter.d.ts +20 -0
  222. package/lib/controller/twilio/filterImpl/CallLogsFilter.js +101 -1
  223. package/lib/controller/twilio/filterImpl/CxConfigAssetFilter.d.ts +12 -0
  224. package/lib/controller/twilio/filterImpl/CxConfigAssetFilter.js +59 -1
  225. package/lib/controller/twilio/filterImpl/CxConfigExternalNumbersFilter.d.ts +12 -0
  226. package/lib/controller/twilio/filterImpl/CxConfigExternalNumbersFilter.js +67 -1
  227. package/lib/controller/twilio/filterImpl/CxConfigOtherFilter.d.ts +14 -0
  228. package/lib/controller/twilio/filterImpl/CxConfigOtherFilter.js +52 -1
  229. package/lib/controller/twilio/filterImpl/CxConfigQueueMenuFilter.d.ts +17 -0
  230. package/lib/controller/twilio/filterImpl/CxConfigQueueMenuFilter.js +78 -1
  231. package/lib/controller/twilio/filterImpl/CxConfigUIconfigFilter.d.ts +12 -0
  232. package/lib/controller/twilio/filterImpl/CxConfigUIconfigFilter.js +51 -1
  233. package/lib/controller/twilio/filterImpl/HoopHolidaysFilter.d.ts +12 -0
  234. package/lib/controller/twilio/filterImpl/HoopHolidaysFilter.js +55 -1
  235. package/lib/controller/twilio/filterImpl/HoopNotesFilter.d.ts +12 -0
  236. package/lib/controller/twilio/filterImpl/HoopNotesFilter.js +51 -1
  237. package/lib/controller/twilio/filterImpl/HoopPartialDaysFilter.d.ts +12 -0
  238. package/lib/controller/twilio/filterImpl/HoopPartialDaysFilter.js +55 -1
  239. package/lib/controller/twilio/filterImpl/MainFilterService.d.ts +4 -0
  240. package/lib/controller/twilio/filterImpl/MainFilterService.js +108 -1
  241. package/lib/controller/twilio/filterImpl/NavigationFilter.d.ts +20 -0
  242. package/lib/controller/twilio/filterImpl/NavigationFilter.js +90 -1
  243. package/lib/controller/twilio/filterImpl/QueueDetailsFilter.d.ts +14 -0
  244. package/lib/controller/twilio/filterImpl/QueueDetailsFilter.js +53 -1
  245. package/lib/controller/twilio/filterImpl/TaskCompleteFilter.d.ts +12 -0
  246. package/lib/controller/twilio/filterImpl/TaskCompleteFilter.js +62 -1
  247. package/lib/controller/twilio/filterImpl/TaskInfoPanelFilter.d.ts +12 -0
  248. package/lib/controller/twilio/filterImpl/TaskInfoPanelFilter.js +52 -1
  249. package/lib/express/ApiResponse.d.ts +15 -0
  250. package/lib/express/ApiResponse.js +11 -1
  251. package/lib/express/RequestValidator.d.ts +50 -0
  252. package/lib/express/RequestValidator.js +77 -1
  253. package/lib/express/RequireParamsPicker.d.ts +7 -0
  254. package/lib/express/RequireParamsPicker.js +14 -1
  255. package/lib/express/ValidateRequireParameters.d.ts +3 -0
  256. package/lib/express/ValidateRequireParameters.js +39 -1
  257. package/lib/index.d.ts +39 -0
  258. package/lib/index.js +100 -1
  259. package/lib/models/BatchUpdateSkills.model.d.ts +0 -0
  260. package/lib/models/BatchUpdateSkills.model.js +11 -1
  261. package/lib/models/CannedMessage.model.d.ts +4 -0
  262. package/lib/models/CannedMessage.model.js +1 -1
  263. package/lib/models/ChannelSettingsTaskInfo.model.d.ts +87 -0
  264. package/lib/models/ChannelSettingsTaskInfo.model.js +1 -1
  265. package/lib/models/CustomerFeedback.model.d.ts +9 -0
  266. package/lib/models/CustomerFeedback.model.js +1 -1
  267. package/lib/models/Filter.model.d.ts +15 -0
  268. package/lib/models/Filter.model.js +2 -1
  269. package/lib/models/Hoop.model.d.ts +9 -0
  270. package/lib/models/Hoop.model.js +9 -1
  271. package/lib/models/Navigation.model.d.ts +28 -0
  272. package/lib/models/Navigation.model.js +8 -1
  273. package/lib/models/Roles.Model.d.ts +8 -0
  274. package/lib/models/Roles.Model.js +1 -1
  275. package/lib/models/abstract/BaseModel.d.ts +17 -0
  276. package/lib/models/abstract/BaseModel.js +40 -1
  277. package/lib/models/impl/AgentActionsLogsModel.d.ts +27 -0
  278. package/lib/models/impl/AgentActionsLogsModel.js +89 -1
  279. package/lib/models/impl/AgentActionsModel.d.ts +19 -0
  280. package/lib/models/impl/AgentActionsModel.js +60 -1
  281. package/lib/models/impl/AgentScorecardModel.d.ts +66 -0
  282. package/lib/models/impl/AgentScorecardModel.js +282 -1
  283. package/lib/models/impl/AuditLogsModel.d.ts +31 -0
  284. package/lib/models/impl/AuditLogsModel.js +146 -1
  285. package/lib/models/impl/CallLogsModel.d.ts +37 -0
  286. package/lib/models/impl/CallLogsModel.js +109 -1
  287. package/lib/models/impl/CallStatisticsModel.d.ts +16 -0
  288. package/lib/models/impl/CallStatisticsModel.js +52 -1
  289. package/lib/models/impl/CategoryDetailsModel.d.ts +17 -0
  290. package/lib/models/impl/CategoryDetailsModel.js +44 -1
  291. package/lib/models/impl/MemberModel.d.ts +42 -0
  292. package/lib/models/impl/MemberModel.js +170 -1
  293. package/lib/models/impl/ModelValidationError.d.ts +6 -0
  294. package/lib/models/impl/ModelValidationError.js +15 -1
  295. package/lib/models/impl/NavigationModel.d.ts +39 -0
  296. package/lib/models/impl/NavigationModel.js +126 -1
  297. package/lib/models/impl/PerformanceStatisticsModel.d.ts +41 -0
  298. package/lib/models/impl/PerformanceStatisticsModel.js +129 -1
  299. package/lib/models/impl/PlaybackScreenrecordings.d.ts +39 -0
  300. package/lib/models/impl/PlaybackScreenrecordings.js +133 -1
  301. package/lib/models/impl/ProfileModel.d.ts +23 -0
  302. package/lib/models/impl/ProfileModel.js +102 -1
  303. package/lib/models/impl/QualityFormsModel.d.ts +39 -0
  304. package/lib/models/impl/QualityFormsModel.js +150 -1
  305. package/lib/models/impl/QuestionDetailsModel.d.ts +39 -0
  306. package/lib/models/impl/QuestionDetailsModel.js +173 -1
  307. package/lib/models/impl/QueueDetailsModel.d.ts +63 -0
  308. package/lib/models/impl/QueueDetailsModel.js +261 -1
  309. package/lib/models/impl/QueueModel.d.ts +39 -0
  310. package/lib/models/impl/QueueModel.js +156 -1
  311. package/lib/models/impl/QuickLinkModel.d.ts +24 -0
  312. package/lib/models/impl/QuickLinkModel.js +122 -1
  313. package/lib/models/impl/StatisticsNumberDetailsModel.d.ts +18 -0
  314. package/lib/models/impl/StatisticsNumberDetailsModel.js +72 -1
  315. package/lib/models/impl/StatisticsTimeDetailsModel.d.ts +18 -0
  316. package/lib/models/impl/StatisticsTimeDetailsModel.js +72 -1
  317. package/lib/models/impl/TaskAttributesModel.d.ts +31 -0
  318. package/lib/models/impl/TaskAttributesModel.js +108 -1
  319. package/lib/models/impl/TaskChannelModel.d.ts +15 -0
  320. package/lib/models/impl/TaskChannelModel.js +69 -1
  321. package/lib/models/impl/TaskComplete.d.ts +0 -0
  322. package/lib/models/impl/TaskComplete.js +1 -1
  323. package/lib/models/impl/TaskInfoPanelModel.d.ts +16 -0
  324. package/lib/models/impl/TaskInfoPanelModel.js +69 -1
  325. package/lib/models/impl/TaskModel.d.ts +59 -0
  326. package/lib/models/impl/TaskModel.js +234 -1
  327. package/lib/models/impl/WorkGroupDetailsModel.d.ts +63 -0
  328. package/lib/models/impl/WorkGroupDetailsModel.js +281 -1
  329. package/lib/models/impl/callbackandvoicemail/CallbackAndVoicemailModel.d.ts +33 -0
  330. package/lib/models/impl/callbackandvoicemail/CallbackAndVoicemailModel.js +140 -1
  331. package/lib/models/impl/callbackandvoicemail/CallbackAndVoicemailNamespace.d.ts +8 -0
  332. package/lib/models/impl/callbackandvoicemail/CallbackAndVoicemailNamespace.js +12 -1
  333. package/lib/models/impl/callbackandvoicemail/CallbackModel.d.ts +19 -0
  334. package/lib/models/impl/callbackandvoicemail/CallbackModel.js +82 -1
  335. package/lib/models/impl/callbackandvoicemail/VoicemailModel.d.ts +25 -0
  336. package/lib/models/impl/callbackandvoicemail/VoicemailModel.js +108 -1
  337. package/lib/models/impl/channelsettings/ChannelSettingModel.d.ts +68 -0
  338. package/lib/models/impl/channelsettings/ChannelSettingModel.js +240 -1
  339. package/lib/models/impl/channelsettings/ChannelSettingTaskInfoModel.d.ts +31 -0
  340. package/lib/models/impl/channelsettings/ChannelSettingTaskInfoModel.js +106 -1
  341. package/lib/models/impl/channelsettings/TaskInfoAttributeModel.d.ts +25 -0
  342. package/lib/models/impl/channelsettings/TaskInfoAttributeModel.js +80 -1
  343. package/lib/models/impl/channelsettings/TaskInfoModel.d.ts +13 -0
  344. package/lib/models/impl/channelsettings/TaskInfoModel.js +52 -1
  345. package/lib/models/impl/cxconfig/CxConfigNamespace.d.ts +16 -0
  346. package/lib/models/impl/cxconfig/CxConfigNamespace.js +20 -1
  347. package/lib/models/impl/cxconfig/CxConfigUIConfigModel.d.ts +27 -0
  348. package/lib/models/impl/cxconfig/CxConfigUIConfigModel.js +173 -1
  349. package/lib/models/impl/cxconfig/CxConfiguratorConfigModel.d.ts +24 -0
  350. package/lib/models/impl/cxconfig/CxConfiguratorConfigModel.js +103 -1
  351. package/lib/models/impl/cxconfig/CxConfiguratorExternalNumbersModel.d.ts +24 -0
  352. package/lib/models/impl/cxconfig/CxConfiguratorExternalNumbersModel.js +149 -1
  353. package/lib/models/impl/cxconfig/CxConfiguratorGPMAssetModel.d.ts +27 -0
  354. package/lib/models/impl/cxconfig/CxConfiguratorGPMAssetModel.js +179 -1
  355. package/lib/models/impl/cxconfig/CxConfiguratorGPMPromptModel.d.ts +40 -0
  356. package/lib/models/impl/cxconfig/CxConfiguratorGPMPromptModel.js +213 -1
  357. package/lib/models/impl/cxconfig/CxConfiguratorOtherModel.d.ts +27 -0
  358. package/lib/models/impl/cxconfig/CxConfiguratorOtherModel.js +159 -1
  359. package/lib/models/impl/cxconfig/CxConfiguratorQueueMenuModel.d.ts +40 -0
  360. package/lib/models/impl/cxconfig/CxConfiguratorQueueMenuModel.js +128 -1
  361. package/lib/models/impl/hoop/HoopBusinessHoursModel.d.ts +39 -0
  362. package/lib/models/impl/hoop/HoopBusinessHoursModel.js +122 -1
  363. package/lib/models/impl/hoop/HoopDescriptionModel.d.ts +16 -0
  364. package/lib/models/impl/hoop/HoopDescriptionModel.js +64 -1
  365. package/lib/models/impl/hoop/HoopHolidaysImplModel.d.ts +25 -0
  366. package/lib/models/impl/hoop/HoopHolidaysImplModel.js +118 -1
  367. package/lib/models/impl/hoop/HoopNotesImplModel.d.ts +25 -0
  368. package/lib/models/impl/hoop/HoopNotesImplModel.js +117 -1
  369. package/lib/models/impl/hoop/HoopOperationsImplModel.d.ts +28 -0
  370. package/lib/models/impl/hoop/HoopOperationsImplModel.js +161 -1
  371. package/lib/models/impl/hoop/HoopOverrideImplModel.d.ts +22 -0
  372. package/lib/models/impl/hoop/HoopOverrideImplModel.js +143 -1
  373. package/lib/models/impl/hoop/HoopPartialDaysImplModel.d.ts +31 -0
  374. package/lib/models/impl/hoop/HoopPartialDaysImplModel.js +140 -1
  375. package/lib/models/impl/hoop/HoopProfilesListImplModel.d.ts +22 -0
  376. package/lib/models/impl/hoop/HoopProfilesListImplModel.js +104 -1
  377. package/lib/models/impl/hoop/HoopWeeklyTimingModel.d.ts +22 -0
  378. package/lib/models/impl/hoop/HoopWeeklyTimingModel.js +86 -1
  379. package/lib/models/index.d.ts +25 -0
  380. package/lib/models/index.js +53 -1
  381. package/lib/models/interface/IBaseModel.d.ts +11 -0
  382. package/lib/models/interface/IBaseModel.js +2 -1
  383. package/lib/models/types/AgentScorecard.type.d.ts +6 -0
  384. package/lib/models/types/AgentScorecard.type.js +7 -1
  385. package/lib/models/types/AuditLog.type.d.ts +13 -0
  386. package/lib/models/types/AuditLog.type.js +10 -1
  387. package/lib/models/types/CallLog.type.d.ts +16 -0
  388. package/lib/models/types/CallLog.type.js +10 -1
  389. package/lib/models/types/ChannelSetting.type.d.ts +7 -0
  390. package/lib/models/types/ChannelSetting.type.js +11 -1
  391. package/lib/models/types/CxConfig.type.d.ts +72 -0
  392. package/lib/models/types/CxConfig.type.js +43 -1
  393. package/lib/models/types/Hoop.type.d.ts +9 -0
  394. package/lib/models/types/Hoop.type.js +13 -1
  395. package/lib/models/types/Navigation.type.d.ts +11 -0
  396. package/lib/models/types/Navigation.type.js +8 -1
  397. package/lib/models/types/Profile.type.d.ts +1 -0
  398. package/lib/models/types/Profile.type.js +2 -1
  399. package/lib/models/types/QueueDetails.type.d.ts +6 -0
  400. package/lib/models/types/QueueDetails.type.js +7 -1
  401. package/lib/models/types/TaskComplete.type.d.ts +7 -0
  402. package/lib/models/types/TaskComplete.type.js +6 -1
  403. package/lib/models/types/TaskInfoPanel.type.d.ts +6 -0
  404. package/lib/models/types/TaskInfoPanel.type.js +7 -1
  405. package/lib/server.d.ts +1 -0
  406. package/lib/server.js +39 -1
  407. package/lib/twilio/abstract/ServiceObjectStore.d.ts +6 -0
  408. package/lib/twilio/abstract/ServiceObjectStore.js +10 -1
  409. package/lib/twilio/abstract/ServiceOpenRequest.d.ts +7 -0
  410. package/lib/twilio/abstract/ServiceOpenRequest.js +10 -1
  411. package/lib/twilio/abstract/ServiceRequest.d.ts +3 -0
  412. package/lib/twilio/abstract/ServiceRequest.js +7 -1
  413. package/lib/twilio/abstract/ServiceResource.d.ts +23 -0
  414. package/lib/twilio/abstract/ServiceResource.js +37 -1
  415. package/lib/twilio/abstract/ServiceResourceFactory.d.ts +15 -0
  416. package/lib/twilio/abstract/ServiceResourceFactory.js +18 -1
  417. package/lib/twilio/abstract/ServiceTransaction.d.ts +6 -0
  418. package/lib/twilio/abstract/ServiceTransaction.js +11 -1
  419. package/lib/twilio/abstract/SyncServiceItemResource.d.ts +31 -0
  420. package/lib/twilio/abstract/SyncServiceItemResource.js +60 -1
  421. package/lib/twilio/abstract/TwilioClientConfig.d.ts +0 -0
  422. package/lib/twilio/abstract/TwilioClientConfig.js +1 -1
  423. package/lib/twilio/impl/TwilioAPIKeyConfig.d.ts +14 -0
  424. package/lib/twilio/impl/TwilioAPIKeyConfig.js +31 -1
  425. package/lib/twilio/impl/TwilioAuthTokenConfig.d.ts +11 -0
  426. package/lib/twilio/impl/TwilioAuthTokenConfig.js +24 -1
  427. package/lib/twilio/impl/TwilioClient.d.ts +6 -0
  428. package/lib/twilio/impl/TwilioClient.js +21 -1
  429. package/lib/twilio/impl/message/messageService.d.ts +0 -0
  430. package/lib/twilio/impl/message/messageService.js +42 -1
  431. package/lib/twilio/impl/sync/SyncDocument.d.ts +24 -0
  432. package/lib/twilio/impl/sync/SyncDocument.js +52 -1
  433. package/lib/twilio/impl/sync/SyncDocumentTransaction.d.ts +20 -0
  434. package/lib/twilio/impl/sync/SyncDocumentTransaction.js +31 -1
  435. package/lib/twilio/impl/sync/SyncList.d.ts +24 -0
  436. package/lib/twilio/impl/sync/SyncList.js +52 -1
  437. package/lib/twilio/impl/sync/SyncListItem.d.ts +5 -0
  438. package/lib/twilio/impl/sync/SyncListItem.js +22 -1
  439. package/lib/twilio/impl/sync/SyncListTransaction.d.ts +20 -0
  440. package/lib/twilio/impl/sync/SyncListTransaction.js +31 -1
  441. package/lib/twilio/impl/sync/SyncMap.d.ts +25 -0
  442. package/lib/twilio/impl/sync/SyncMap.js +139 -1
  443. package/lib/twilio/impl/sync/SyncMapItem.d.ts +5 -0
  444. package/lib/twilio/impl/sync/SyncMapItem.js +7 -1
  445. package/lib/twilio/impl/sync/SyncMapTransaction.d.ts +22 -0
  446. package/lib/twilio/impl/sync/SyncMapTransaction.js +38 -1
  447. package/lib/twilio/impl/sync/SyncOpenRequest.d.ts +18 -0
  448. package/lib/twilio/impl/sync/SyncOpenRequest.js +24 -1
  449. package/lib/twilio/impl/sync/SyncRequest.d.ts +16 -0
  450. package/lib/twilio/impl/sync/SyncRequest.js +21 -1
  451. package/lib/twilio/impl/sync/SyncResource.d.ts +50 -0
  452. package/lib/twilio/impl/sync/SyncResource.js +97 -1
  453. package/lib/twilio/impl/sync/SyncServiceFactory.d.ts +22 -0
  454. package/lib/twilio/impl/sync/SyncServiceFactory.js +117 -1
  455. package/lib/twilio/interface/IDirection.d.ts +2 -0
  456. package/lib/twilio/interface/IDirection.js +2 -1
  457. package/lib/twilio/interface/ILink.d.ts +2 -0
  458. package/lib/twilio/interface/ILink.js +2 -1
  459. package/lib/twilio/interface/IServiceDBOpenRequest.d.ts +3 -0
  460. package/lib/twilio/interface/IServiceDBOpenRequest.js +2 -1
  461. package/lib/twilio/interface/IServiceObjectStore.d.ts +3 -0
  462. package/lib/twilio/interface/IServiceObjectStore.js +2 -1
  463. package/lib/twilio/interface/IServiceObjectStoreParameters.d.ts +4 -0
  464. package/lib/twilio/interface/IServiceObjectStoreParameters.js +2 -1
  465. package/lib/twilio/interface/IServiceRequest.d.ts +3 -0
  466. package/lib/twilio/interface/IServiceRequest.js +2 -1
  467. package/lib/twilio/interface/IServiceResource.d.ts +8 -0
  468. package/lib/twilio/interface/IServiceResource.js +2 -1
  469. package/lib/twilio/interface/IServiceTransation.d.ts +3 -0
  470. package/lib/twilio/interface/IServiceTransation.js +2 -1
  471. package/lib/twilio/interface/ISubResourceUri.d.ts +2 -0
  472. package/lib/twilio/interface/ISubResourceUri.js +2 -1
  473. package/lib/twilio/interface/ISyncItemData.d.ts +0 -0
  474. package/lib/twilio/interface/ISyncItemData.js +1 -1
  475. package/lib/twilio/interface/ISyncObjectStoreParameters.d.ts +0 -0
  476. package/lib/twilio/interface/ISyncObjectStoreParameters.js +1 -1
  477. package/lib/twilio/interface/ISyncTransactionOptions.d.ts +4 -0
  478. package/lib/twilio/interface/ISyncTransactionOptions.js +2 -1
  479. package/package.json +9 -5
  480. package/lib/models/abstract/BaseModelOld.js +0 -1
@@ -1 +1,408 @@
1
- Object.defineProperty(exports,"__esModule",{value:!0}),exports.HoopBusinessHoursControllerAConnect=void 0;const e=require("tslib"),t=e.__importDefault(require("moment-timezone")),i=require("./HoopProfilesListController"),o=require("./HoopOverrideBranchesController"),n=require("./HoopOperationsController"),r=require("../../models/impl/hoop/HoopBusinessHoursModel"),s=require("../../models/impl/hoop/HoopDescriptionModel"),a=require("../../models/impl/hoop/HoopWeeklyTimingModel"),d=require("../../models/types/Hoop.type");exports.HoopBusinessHoursControllerAConnect=class{constructor(e){this._dbFactory=e}getBusinessHours(d){return e.__awaiter(this,void 0,void 0,(function*(){try{const l=new r.HoopBusinessHoursModel(!0,!1,!1,!0,new s.HoopDescriptionModel("","",""),{},[],"",new Date(Date.now()),"EST"),m=new i.HoopProfilesListControllerAConnect(this._dbFactory),f=(yield m.get({instanceId:d.instanceId})).find((e=>e.profileName===d.profileName));if(!f)throw new Error(`Profile with name '${d.profileName}' not found.`);const u=new n.HoopOperationsControllerAConnect(this._dbFactory),p=yield u.getAll({instanceId:d.instanceId,hoursOfOperationId:f.profileId,itemsPerPage:0,pageNo:0}),c=new o.HoopOverrideBranchesControllerAConnect(this._dbFactory),g=yield c.getAll({instanceId:d.instanceId,hoursOfOperationId:f.profileId,itemsPerPage:0,pageNo:0}),y=p.length>0?p[0].timeZone:"EST",h=(new Date).toLocaleString("en-US",{timeZone:y,weekday:"long"}).toUpperCase(),D=t.default.tz(l.timeZone).format("YYYY-MM-DD"),T=p.map((t=>e.__awaiter(this,void 0,void 0,(function*(){const e=new a.HoopWeeklyTimingModel(t.day,t.day,yield this.formatTime(t.beginTime),yield this.formatTime(t.endTime),t.day);if(e.validationMessages.length>0)throw e.validationMessages;return e.serialize})))),M=yield Promise.all(T),v=yield this.groupWeeklyTimings(M);l.weeklyTiming=v,yield this.evaluateTodayBusinessHours(h,p,l,D);const H=g.result.HoursOfOperationOverrideList;for(const e of H)if((0,t.default)(D).isBetween(e.EffectiveFrom,e.EffectiveTill,null,"[]")){l.isOpen=!1,l.isRegularDay=!1;const t=new s.HoopDescriptionModel(e.Name,"00:00:00","00:00:00");if(t.validationMessages.length>0)throw t.validationMessages;if(l.description=t.serialize,e.Config.length>0){e.LastModifiedTime=g.result.LastModifiedTime;const t=yield u.mapOperations(e.Config,l.timeZone,e);yield this.evaluateTodayBusinessHours(h,t,l,D),l.isRegularDay=!1}l.description.hoopDesc=e.Name}if(l.validationMessages.length>0)throw l.validationMessages;if(l.weeklyTimingString=yield this.generateBusinessHoursString(l.weeklyTiming,l.timeZone),!1===l.isOpen){const e=yield this.findNextReopeningDate(t.default.tz(l.timeZone),l.timeZone,M,H);l.reopenTiming=e.toDate()}return l.serialize}catch(e){return e}}))}formatTime(t){return e.__awaiter(this,void 0,void 0,(function*(){return t.toISOString().slice(11,19)}))}evaluateTodayBusinessHours(i,o,n,r){return e.__awaiter(this,void 0,void 0,(function*(){const e=o.filter((e=>e.day===i));if(e.length>0){n.timeZone=e[0].timeZone;let i=!1;for(const o of e){const e=t.default.utc(o.beginTime.toISOString()).format(),r=t.default.utc(o.endTime.toISOString()).format(),a=(0,t.default)().tz(o.timeZone).format(),d=a>=e&&a<=r;i=i||d;const l=new s.HoopDescriptionModel(d?"Normal Business Hours":"Out of Business Hours",yield this.formatTime(o.beginTime),yield this.formatTime(o.endTime));if(l.validationMessages.length>0)throw l.validationMessages;if(n.description=l.serialize,d)break}n.isOpen=i,n.isRegularDay=!0}else{n.isOpen=!1,n.isRegularDay=!1;const e=new s.HoopDescriptionModel("Out of Business Hours","00:00:00","00:00:00");if(e.validationMessages.length>0)throw e.validationMessages;n.description=e.serialize}}))}groupWeeklyTimings(t){return e.__awaiter(this,void 0,void 0,(function*(){const e=Object.keys(d.AvailableDay).filter((e=>isNaN(Number(e)))).map((e=>e.toUpperCase()));return[...t].sort(((t,i)=>{const o=e.indexOf(t.startDay.toUpperCase())-e.indexOf(i.startDay.toUpperCase());return 0===o?t.startTime.localeCompare(i.startTime):o})).reduce(((t,i)=>{const o=t[t.length-1];if(o&&o.startTime===i.startTime&&o.endTime===i.endTime&&e.indexOf(i.startDay)===e.indexOf(o.endDay)+1)o.endDay=i.endDay,o.description=`${o.startDay}-${o.endDay}`;else{const e=new a.HoopWeeklyTimingModel(i.startDay,i.endDay,i.startTime,i.endTime,i.startDay);if(e.validationMessages.length>0)throw e.validationMessages;t.push(e.serialize)}return t}),[])}))}generateBusinessHoursString(t,i){return e.__awaiter(this,void 0,void 0,(function*(){const e=e=>{let[t,i]=e.split(":"),o=parseInt(t)>=12?"PM":"AM";return parseInt(t)>12?t=(parseInt(t)-12).toString().padStart(2,"0"):0===parseInt(t)&&(t="12"),`${t}:${i} ${o}`};return t.map((t=>t.startDay===t.endDay?`${t.startDay} from ${e(t.startTime)} to ${e(t.endTime)} ${i}`:`${t.startDay} through ${t.endDay} from ${e(t.startTime)} to ${e(t.endTime)} ${i}`)).join(", ")}))}findNextReopeningDate(i,o,n,r){return e.__awaiter(this,void 0,void 0,(function*(){if(!n||0===n.length)throw new Error("Weekly schedule is empty. Cannot determine the next reopening date.");let e=0,s=i,a="";i.format("dddd").toUpperCase();let d=s.format("dddd").toUpperCase();for(;;){if(n.find((e=>e.startDay===d))){const e=yield this.checkHolidayOverride(s,r,o);if(e){if(e.nextOpeningDay&&!0===e.hasReopeningTime){a=e.nextOpeningDay;break}s=e.nextOpeningDay&&!1===e.hasReopeningTime?e.nextOpeningDay:t.default.tz(s,o).add(1,"days")}else{const e=n.filter((e=>e.startDay===s.format("dddd").toUpperCase())),i=yield this.checkTimingsForToday(s,e,o);if(i){a=i;break}s=t.default.tz(s,o).add(1,"days")}}else{s=t.default.tz(i,o).add(e,"days"),d=s.format("dddd").toUpperCase();const l=yield this.checkHolidayOverride(s,r,o);if(l){if(l.nextOpeningDay&&!0===l.hasReopeningTime){a=l.nextOpeningDay;break}l.nextOpeningDay&&!1===l.hasReopeningTime?(n.find((e=>e.startDay===d)),s=l.nextOpeningDay,e+=1):e+=1}else e+=1}}if(!a){const e=n.find((e=>e.startDay===s.format("dddd").toUpperCase()));a=t.default.tz(`${s.format("YYYY-MM-DD")}T${e.startTime}`,o)}return a}))}checkHolidayOverride(i,o,n){return e.__awaiter(this,void 0,void 0,(function*(){const e=i.format("dddd").toUpperCase(),r=i.format("YYYY-MM-DD");for(const s in o){const a=o[s].EffectiveFrom,d=o[s].EffectiveTill;if(r>=a&&r<=d){if(o[s].Config.length>0){const t=o[s].Config.filter((t=>t.Day===e));let r="";try{const e=yield this.determineOpeningTime(i,t,n);r=e||""}catch(e){return void console.error("Error in determineOpeningTime:",e)}return{nextOpeningDay:r,hasReopeningTime:!0}}return{nextOpeningDay:t.default.tz(d,n).add(1,"days"),hasReopeningTime:!1}}}}))}determineOpeningTime(i,o,n){return e.__awaiter(this,void 0,void 0,(function*(){try{const e=[...o].sort(((e,t)=>60*e.StartTime.Hours+e.StartTime.Minutes-(60*t.StartTime.Hours+t.StartTime.Minutes)));if(0===e.length)throw Error;let r=[];return e.forEach((e=>{const o=t.default.tz(n).format("YYYY-MM-DD"),s=(0,t.default)(i).set({hour:e.StartTime.Hours,minute:e.StartTime.Minutes,second:0}),a=(0,t.default)(i).set({hour:e.EndTime.Hours,minute:e.EndTime.Minutes,second:0});o!==s.format("YYYY-MM-DD")&&r.push(s),i.isBefore(s)&&i.isBefore(a)&&r.push(s)})),r[0]}catch(e){throw console.error("Error in determineOpeningTime:",e),e}}))}checkTimingsForToday(i,o,n){return e.__awaiter(this,void 0,void 0,(function*(){const e=o.sort(((e,t)=>e.startTime.localeCompare(t.startTime)));let r=[];return e.forEach((e=>{const o=t.default.tz(n).format("YYYY-MM-DD"),s=t.default.tz(`${i.format("YYYY-MM-DD")} ${e.startTime}`,"YYYY-MM-DD HH:mm:ss",n),a=t.default.tz(`${i.format("YYYY-MM-DD")} ${e.endTime}`,"YYYY-MM-DD HH:mm:ss",n);o!==s.format("YYYY-MM-DD")&&r.push(s),i.isBefore(s)&&i.isBefore(a)&&r.push(s)})),r[0]}))}};
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.HoopBusinessHoursControllerAConnect = void 0;
16
+ const moment_timezone_1 = __importDefault(require("moment-timezone"));
17
+ const HoopProfilesListController_1 = require("./HoopProfilesListController");
18
+ const HoopOverrideBranchesController_1 = require("./HoopOverrideBranchesController");
19
+ const HoopOperationsController_1 = require("./HoopOperationsController");
20
+ const HoopBusinessHoursModel_1 = require("../../models/impl/hoop/HoopBusinessHoursModel");
21
+ const HoopDescriptionModel_1 = require("../../models/impl/hoop/HoopDescriptionModel");
22
+ const HoopWeeklyTimingModel_1 = require("../../models/impl/hoop/HoopWeeklyTimingModel");
23
+ const Hoop_type_1 = require("../../models/types/Hoop.type");
24
+ class HoopBusinessHoursControllerAConnect {
25
+ constructor(dbFactory) {
26
+ this._dbFactory = dbFactory;
27
+ }
28
+ /**
29
+ * Method to get business hours based on the profile ID.
30
+ * @param query - Object containing the profileName and instanceId
31
+ * @returns - Business hours status
32
+ */
33
+ getBusinessHours(query) {
34
+ return __awaiter(this, void 0, void 0, function* () {
35
+ try {
36
+ // Initialize HoopBusinessHoursModel
37
+ const scheduleInfo = new HoopBusinessHoursModel_1.HoopBusinessHoursModel(true, // isOpen
38
+ false, // isHoliday
39
+ false, // isPartialDay
40
+ true, // isRegularDay
41
+ new HoopDescriptionModel_1.HoopDescriptionModel("", "", ""), // Description
42
+ {}, // Override branches
43
+ [], // Weekly timing
44
+ "", // Weekly timing string
45
+ new Date(Date.now()), // reopen timing string
46
+ "EST" // Time zone
47
+ );
48
+ // Initialize necessary controllers for fetching data
49
+ const profilesListController = new HoopProfilesListController_1.HoopProfilesListControllerAConnect(this._dbFactory);
50
+ const profileInfo = yield profilesListController.get({
51
+ instanceId: query.instanceId,
52
+ });
53
+ const profile = profileInfo.find((p) => p.profileName === query.profileName);
54
+ if (!profile) {
55
+ throw new Error(`Profile with name '${query.profileName}' not found.`);
56
+ }
57
+ const operationsController = new HoopOperationsController_1.HoopOperationsControllerAConnect(this._dbFactory);
58
+ const operationHours = yield operationsController.getAll({
59
+ instanceId: query.instanceId,
60
+ hoursOfOperationId: profile.profileId,
61
+ itemsPerPage: 0,
62
+ pageNo: 0,
63
+ });
64
+ const overridesController = new HoopOverrideBranchesController_1.HoopOverrideBranchesControllerAConnect(this._dbFactory);
65
+ const overrides = yield overridesController.getAll({
66
+ instanceId: query.instanceId,
67
+ hoursOfOperationId: profile.profileId,
68
+ itemsPerPage: 0,
69
+ pageNo: 0,
70
+ });
71
+ const timeZone = operationHours.length > 0 ? operationHours[0].timeZone : "EST";
72
+ const currentDay = new Date()
73
+ .toLocaleString("en-US", { timeZone: timeZone, weekday: "long" })
74
+ .toUpperCase();
75
+ const currentDate = moment_timezone_1.default.tz(scheduleInfo.timeZone).format("YYYY-MM-DD");
76
+ const weeklyTimings = operationHours.map((item) => __awaiter(this, void 0, void 0, function* () {
77
+ const weeklyTiming = new HoopWeeklyTimingModel_1.HoopWeeklyTimingModel(item.day, item.day, yield this.formatTime(item.beginTime), yield this.formatTime(item.endTime), item.day);
78
+ // Validate weeklyTiming
79
+ if (weeklyTiming.validationMessages.length > 0) {
80
+ throw weeklyTiming.validationMessages; // Throw error if data validation fails
81
+ }
82
+ // Serialize weeklyTiming
83
+ return weeklyTiming.serialize;
84
+ }));
85
+ const resolvedWeeklyTimings = yield Promise.all(weeklyTimings);
86
+ const groupedTimings = yield this.groupWeeklyTimings(resolvedWeeklyTimings);
87
+ scheduleInfo.weeklyTiming = groupedTimings;
88
+ yield this.evaluateTodayBusinessHours(currentDay, operationHours, scheduleInfo, currentDate);
89
+ const HoursOfOperationOverrideList = overrides.result.HoursOfOperationOverrideList;
90
+ // Check overrides for current
91
+ for (const overridesItem of HoursOfOperationOverrideList) {
92
+ if ((0, moment_timezone_1.default)(currentDate).isBetween(overridesItem.EffectiveFrom, overridesItem.EffectiveTill, null, "[]")) {
93
+ scheduleInfo.isOpen = false;
94
+ scheduleInfo.isRegularDay = false;
95
+ const HoopDescription = new HoopDescriptionModel_1.HoopDescriptionModel(overridesItem.Name, "00:00:00", "00:00:00");
96
+ if (HoopDescription.validationMessages.length > 0) {
97
+ throw HoopDescription.validationMessages; // Throw error if data validation fails
98
+ }
99
+ scheduleInfo.description =
100
+ HoopDescription.serialize;
101
+ if (overridesItem.Config.length > 0) {
102
+ overridesItem["LastModifiedTime"] =
103
+ overrides.result.LastModifiedTime;
104
+ const OverrideOperationHours = yield operationsController.mapOperations(overridesItem.Config, scheduleInfo.timeZone, overridesItem);
105
+ yield this.evaluateTodayBusinessHours(currentDay, OverrideOperationHours, scheduleInfo, currentDate);
106
+ scheduleInfo.isRegularDay = false;
107
+ }
108
+ scheduleInfo.description.hoopDesc = overridesItem.Name;
109
+ }
110
+ }
111
+ if (scheduleInfo.validationMessages.length > 0) {
112
+ throw scheduleInfo.validationMessages;
113
+ }
114
+ scheduleInfo.weeklyTimingString = yield this.generateBusinessHoursString(scheduleInfo.weeklyTiming, scheduleInfo.timeZone);
115
+ if (scheduleInfo.isOpen === false) {
116
+ const reOpenTiming = yield this.findNextReopeningDate(moment_timezone_1.default.tz(scheduleInfo.timeZone), scheduleInfo.timeZone, resolvedWeeklyTimings, HoursOfOperationOverrideList);
117
+ scheduleInfo.reopenTiming = reOpenTiming.toDate();
118
+ }
119
+ const businessHours = scheduleInfo.serialize;
120
+ return businessHours;
121
+ }
122
+ catch (error) {
123
+ // Log and return the error if an exception occurs
124
+ return error;
125
+ }
126
+ });
127
+ }
128
+ formatTime(time) {
129
+ return __awaiter(this, void 0, void 0, function* () {
130
+ return time.toISOString().slice(11, 19); // Extracts the time portion (HH:MM:SS)
131
+ });
132
+ }
133
+ evaluateTodayBusinessHours(currentDay, operationHours, scheduleInfo, currentDate) {
134
+ return __awaiter(this, void 0, void 0, function* () {
135
+ const todayEntries = operationHours.filter((hour) => hour.day === currentDay);
136
+ if (todayEntries.length > 0) {
137
+ scheduleInfo.timeZone = todayEntries[0].timeZone;
138
+ let isWithinWorkingHours = false;
139
+ var isBeforeBeginTime = true;
140
+ for (const entry of todayEntries) {
141
+ const beginTime = moment_timezone_1.default.utc(entry.beginTime.toISOString()).format();
142
+ const endTime = moment_timezone_1.default.utc(entry.endTime.toISOString()).format();
143
+ const currentTime = (0, moment_timezone_1.default)().tz(entry.timeZone).format();
144
+ var isBeforeBeginTime = currentTime < beginTime ? true : currentTime > beginTime;
145
+ const isCurrentTimeWithinRange = currentTime >= beginTime && currentTime <= endTime;
146
+ isWithinWorkingHours = isWithinWorkingHours || isCurrentTimeWithinRange;
147
+ const description = new HoopDescriptionModel_1.HoopDescriptionModel(isCurrentTimeWithinRange
148
+ ? "Normal Business Hours"
149
+ : "Out of Business Hours", yield this.formatTime(entry.beginTime), yield this.formatTime(entry.endTime));
150
+ if (description.validationMessages.length > 0)
151
+ throw description.validationMessages;
152
+ scheduleInfo.description =
153
+ description.serialize;
154
+ if (isCurrentTimeWithinRange)
155
+ break;
156
+ }
157
+ scheduleInfo.isOpen = isWithinWorkingHours;
158
+ scheduleInfo.isRegularDay = true;
159
+ }
160
+ else {
161
+ scheduleInfo.isOpen = false;
162
+ scheduleInfo.isRegularDay = false;
163
+ const description = new HoopDescriptionModel_1.HoopDescriptionModel("Out of Business Hours", "00:00:00", "00:00:00");
164
+ if (description.validationMessages.length > 0)
165
+ throw description.validationMessages;
166
+ scheduleInfo.description = description.serialize;
167
+ }
168
+ });
169
+ }
170
+ groupWeeklyTimings(weeklyTiming) {
171
+ return __awaiter(this, void 0, void 0, function* () {
172
+ const dayOrder = Object.keys(Hoop_type_1.AvailableDay)
173
+ .filter((key) => isNaN(Number(key))) // Filter out numeric keys (if any)
174
+ .map((key) => key.toUpperCase());
175
+ // Sort the input by day order and startTime
176
+ const sortedTiming = [...weeklyTiming].sort((a, b) => {
177
+ const dayComparison = dayOrder.indexOf(a.startDay.toUpperCase()) -
178
+ dayOrder.indexOf(b.startDay.toUpperCase());
179
+ if (dayComparison === 0) {
180
+ // If startDay is the same, sort by startTime
181
+ return a.startTime.localeCompare(b.startTime);
182
+ }
183
+ return dayComparison;
184
+ });
185
+ return sortedTiming.reduce((result, current) => {
186
+ const lastGroup = result[result.length - 1];
187
+ // If there is a last group and it matches the current timing
188
+ if (lastGroup &&
189
+ lastGroup.startTime === current.startTime &&
190
+ lastGroup.endTime === current.endTime &&
191
+ dayOrder.indexOf(current.startDay) ===
192
+ dayOrder.indexOf(lastGroup.endDay) + 1) {
193
+ // Extend the last group's endDay and description
194
+ lastGroup.endDay = current.endDay;
195
+ lastGroup.description = `${lastGroup.startDay}-${lastGroup.endDay}`;
196
+ }
197
+ else {
198
+ // Start a new group
199
+ const HoopWeeklyTiming = new HoopWeeklyTimingModel_1.HoopWeeklyTimingModel(current.startDay, current.endDay, current.startTime, current.endTime, current.startDay);
200
+ if (HoopWeeklyTiming.validationMessages.length > 0) {
201
+ throw HoopWeeklyTiming.validationMessages;
202
+ }
203
+ result.push(HoopWeeklyTiming.serialize);
204
+ }
205
+ return result;
206
+ }, []);
207
+ });
208
+ }
209
+ generateBusinessHoursString(weeklyTimings, timeZone) {
210
+ return __awaiter(this, void 0, void 0, function* () {
211
+ const formatTime = (time) => {
212
+ let [hours, minutes] = time.split(":");
213
+ let period = parseInt(hours) >= 12 ? "PM" : "AM";
214
+ if (parseInt(hours) > 12) {
215
+ hours = (parseInt(hours) - 12).toString().padStart(2, "0");
216
+ }
217
+ else if (parseInt(hours) === 0) {
218
+ hours = "12";
219
+ }
220
+ return `${hours}:${minutes} ${period}`;
221
+ };
222
+ return weeklyTimings
223
+ .map((item) => {
224
+ if (item.startDay === item.endDay) {
225
+ return `${item.startDay} from ${formatTime(item.startTime)} to ${formatTime(item.endTime)} ${timeZone}`;
226
+ }
227
+ else {
228
+ return `${item.startDay} through ${item.endDay} from ${formatTime(item.startTime)} to ${formatTime(item.endTime)} ${timeZone}`;
229
+ }
230
+ })
231
+ .join(", ");
232
+ });
233
+ }
234
+ findNextReopeningDate(currentDate, timeZone, weeklySchedule, holidayOverrides) {
235
+ return __awaiter(this, void 0, void 0, function* () {
236
+ // Check if the weekly schedule is empty
237
+ if (!weeklySchedule || weeklySchedule.length === 0) {
238
+ throw new Error("Weekly schedule is empty. Cannot determine the next reopening date.");
239
+ }
240
+ let dayOffset = 0;
241
+ let potentialReopeningDate = currentDate;
242
+ let overrideReopeningDate = "";
243
+ const currentDayName = currentDate.format("dddd").toUpperCase();
244
+ let targetDayName = potentialReopeningDate.format("dddd").toUpperCase();
245
+ while (true) {
246
+ const matchingWeeklySchedule = weeklySchedule.find((item) => item.startDay === targetDayName);
247
+ if (matchingWeeklySchedule) {
248
+ const holidayCheckResult = yield this.checkHolidayOverride(potentialReopeningDate, holidayOverrides, timeZone);
249
+ if (holidayCheckResult) {
250
+ if (holidayCheckResult.nextOpeningDay &&
251
+ holidayCheckResult.hasReopeningTime === true) {
252
+ overrideReopeningDate = holidayCheckResult.nextOpeningDay;
253
+ break;
254
+ }
255
+ else if (holidayCheckResult.nextOpeningDay &&
256
+ holidayCheckResult.hasReopeningTime === false) {
257
+ potentialReopeningDate = holidayCheckResult.nextOpeningDay;
258
+ }
259
+ else {
260
+ potentialReopeningDate = moment_timezone_1.default
261
+ .tz(potentialReopeningDate, timeZone)
262
+ .add(1, "days");
263
+ }
264
+ }
265
+ else {
266
+ const fetchCurrentDays = weeklySchedule.filter((item) => item.startDay ===
267
+ potentialReopeningDate.format("dddd").toUpperCase());
268
+ const checkTimingForToday = yield this.checkTimingsForToday(potentialReopeningDate, fetchCurrentDays, timeZone);
269
+ if (checkTimingForToday) {
270
+ overrideReopeningDate = checkTimingForToday;
271
+ break;
272
+ }
273
+ else {
274
+ potentialReopeningDate = moment_timezone_1.default
275
+ .tz(potentialReopeningDate, timeZone)
276
+ .add(1, "days");
277
+ }
278
+ }
279
+ }
280
+ else {
281
+ potentialReopeningDate = moment_timezone_1.default
282
+ .tz(currentDate, timeZone)
283
+ .add(dayOffset, "days");
284
+ targetDayName = potentialReopeningDate.format("dddd").toUpperCase(); // Update day in uppercase
285
+ const holidayCheckResult = yield this.checkHolidayOverride(potentialReopeningDate, holidayOverrides, timeZone);
286
+ if (holidayCheckResult) {
287
+ if (holidayCheckResult.nextOpeningDay &&
288
+ holidayCheckResult.hasReopeningTime === true) {
289
+ overrideReopeningDate = holidayCheckResult.nextOpeningDay;
290
+ break;
291
+ }
292
+ else if (holidayCheckResult.nextOpeningDay &&
293
+ holidayCheckResult.hasReopeningTime === false) {
294
+ const weeklyScheduleMatch = weeklySchedule.find((item) => item.startDay === targetDayName);
295
+ potentialReopeningDate = holidayCheckResult.nextOpeningDay;
296
+ dayOffset += 1;
297
+ }
298
+ else {
299
+ dayOffset += 1;
300
+ }
301
+ }
302
+ else {
303
+ dayOffset += 1;
304
+ }
305
+ }
306
+ }
307
+ if (!overrideReopeningDate) {
308
+ const matchedSchedule = weeklySchedule.find((i) => i.startDay === potentialReopeningDate.format("dddd").toUpperCase());
309
+ const reopeningDateTime = moment_timezone_1.default.tz(`${potentialReopeningDate.format("YYYY-MM-DD")}T${matchedSchedule.startTime}`, timeZone);
310
+ overrideReopeningDate = reopeningDateTime;
311
+ }
312
+ return overrideReopeningDate;
313
+ });
314
+ }
315
+ checkHolidayOverride(potentialDate, holidayOverrides, timeZone) {
316
+ return __awaiter(this, void 0, void 0, function* () {
317
+ const potentialDayName = potentialDate.format("dddd").toUpperCase();
318
+ const potentialDateString = potentialDate.format("YYYY-MM-DD");
319
+ for (const overrideKey in holidayOverrides) {
320
+ const overrideStart = holidayOverrides[overrideKey].EffectiveFrom;
321
+ const overrideEnd = holidayOverrides[overrideKey].EffectiveTill;
322
+ if (potentialDateString >= overrideStart &&
323
+ potentialDateString <= overrideEnd) {
324
+ if (holidayOverrides[overrideKey].Config.length > 0) {
325
+ const filteredOverrides = holidayOverrides[overrideKey].Config.filter((item) => item.Day === potentialDayName);
326
+ let nextOpeningDay = "";
327
+ try {
328
+ const openingTime = yield this.determineOpeningTime(potentialDate, filteredOverrides, timeZone);
329
+ nextOpeningDay = openingTime ? openingTime : "";
330
+ }
331
+ catch (error) {
332
+ console.error("Error in determineOpeningTime:", error);
333
+ return undefined; // Return undefined if determineOpeningTime fails
334
+ }
335
+ return { nextOpeningDay, hasReopeningTime: true };
336
+ }
337
+ else {
338
+ const nextAvailableDate = moment_timezone_1.default
339
+ .tz(overrideEnd, timeZone)
340
+ .add(1, "days");
341
+ return { nextOpeningDay: nextAvailableDate, hasReopeningTime: false };
342
+ }
343
+ }
344
+ }
345
+ });
346
+ }
347
+ determineOpeningTime(reopeningDate, dailySchedule, timeZone) {
348
+ return __awaiter(this, void 0, void 0, function* () {
349
+ try {
350
+ // Sort the daily schedule by StartTime
351
+ const sortedSchedule = [...dailySchedule].sort((a, b) => {
352
+ const aTimeInMinutes = a.StartTime.Hours * 60 + a.StartTime.Minutes;
353
+ const bTimeInMinutes = b.StartTime.Hours * 60 + b.StartTime.Minutes;
354
+ return aTimeInMinutes - bTimeInMinutes;
355
+ });
356
+ if (sortedSchedule.length === 0) {
357
+ throw Error;
358
+ }
359
+ let potentialOpeningTimes = [];
360
+ sortedSchedule.forEach((scheduleItem) => {
361
+ const currentDateString = moment_timezone_1.default.tz(timeZone).format("YYYY-MM-DD");
362
+ const startTime = (0, moment_timezone_1.default)(reopeningDate).set({
363
+ hour: scheduleItem.StartTime.Hours,
364
+ minute: scheduleItem.StartTime.Minutes,
365
+ second: 0,
366
+ });
367
+ const endTime = (0, moment_timezone_1.default)(reopeningDate).set({
368
+ hour: scheduleItem.EndTime.Hours,
369
+ minute: scheduleItem.EndTime.Minutes,
370
+ second: 0,
371
+ });
372
+ if (currentDateString !== startTime.format("YYYY-MM-DD")) {
373
+ potentialOpeningTimes.push(startTime);
374
+ }
375
+ if (reopeningDate.isBefore(startTime) &&
376
+ reopeningDate.isBefore(endTime)) {
377
+ potentialOpeningTimes.push(startTime);
378
+ }
379
+ });
380
+ return potentialOpeningTimes[0];
381
+ }
382
+ catch (error) {
383
+ console.error("Error in determineOpeningTime:", error);
384
+ throw error; // Rethrow the error to be handled in checkHolidayOverride
385
+ }
386
+ });
387
+ }
388
+ checkTimingsForToday(reopeningDate, fetchCurrentDays, timeZone) {
389
+ return __awaiter(this, void 0, void 0, function* () {
390
+ const sortedSchedule = fetchCurrentDays.sort((a, b) => a.startTime.localeCompare(b.startTime));
391
+ let potentialOpeningTimes = [];
392
+ sortedSchedule.forEach((item) => {
393
+ const currentDateString = moment_timezone_1.default.tz(timeZone).format("YYYY-MM-DD");
394
+ const startTime = moment_timezone_1.default.tz(`${reopeningDate.format("YYYY-MM-DD")} ${item.startTime}`, "YYYY-MM-DD HH:mm:ss", timeZone);
395
+ const endTime = moment_timezone_1.default.tz(`${reopeningDate.format("YYYY-MM-DD")} ${item.endTime}`, "YYYY-MM-DD HH:mm:ss", timeZone);
396
+ if (currentDateString !== startTime.format("YYYY-MM-DD")) {
397
+ potentialOpeningTimes.push(startTime);
398
+ }
399
+ if (reopeningDate.isBefore(startTime) &&
400
+ reopeningDate.isBefore(endTime)) {
401
+ potentialOpeningTimes.push(startTime);
402
+ }
403
+ });
404
+ return potentialOpeningTimes[0];
405
+ });
406
+ }
407
+ }
408
+ exports.HoopBusinessHoursControllerAConnect = HoopBusinessHoursControllerAConnect;
@@ -0,0 +1,9 @@
1
+ import { HoopServiceFactory } from "../../aws/impl/HoopServices/HoopServiceFactory";
2
+ import { SearchParameterType } from "../../common/type/SearchParameterType";
3
+ export declare class HoopOperationsControllerAConnect {
4
+ private _dbFactory;
5
+ constructor(dbFactory: HoopServiceFactory);
6
+ getAll(query: SearchParameterType): Promise<any>;
7
+ private dateTimeConversion;
8
+ mapOperations(config: any[], timezone: string, request: any): Promise<any[]>;
9
+ }
@@ -1 +1,86 @@
1
- Object.defineProperty(exports,"__esModule",{value:!0}),exports.HoopOperationsControllerAConnect=void 0;const e=require("tslib"),t=require("../../config/DatabaseConfig"),o=require("uuid"),i=e.__importDefault(require("moment-timezone")),r=require("../../models/impl/hoop/HoopOperationsImplModel");exports.HoopOperationsControllerAConnect=class{constructor(e){this._dbFactory=e}getAll(o){return e.__awaiter(this,void 0,void 0,(function*(){try{const e=(yield this._dbFactory.asyncOpen(t.databaseConfig.databaseName,t.databaseConfig.version)).result;let i=e.transaction(t.databaseConfig.tables.hoopOverrideBranches,"readwrite").objectStore(t.databaseConfig.tables.hoopOverrideBranches);const r=yield i.customGetHoop(o),a=r.Config,n=r.TimeZone||"EST";return yield this.mapOperations(a,n,r)}catch(e){return e}}))}dateTimeConversion(t,o){return e.__awaiter(this,void 0,void 0,(function*(){const e=(0,i.default)().tz(o).format("YYYY-MM-DD");return new Date(Date.parse(`${e}T${t}:00Z`))}))}mapOperations(t,i,a){return e.__awaiter(this,void 0,void 0,(function*(){try{return Promise.all(t.map((t=>e.__awaiter(this,void 0,void 0,(function*(){const{Day:e,StartTime:n,EndTime:s}=t,d=String(n.Minutes).padStart(2,"0"),l=String(s.Minutes).padStart(2,"0"),p=`${String(n.Hours).padStart(2,"0")}:${d}`,u=`${String(s.Hours).padStart(2,"0")}:${l}`,c=yield this.dateTimeConversion(p,i),m=yield this.dateTimeConversion(u,i),f=(0,o.v4)(),v=new r.HoopOperationsImplModel(f,a.HoursOfOperationId,e,c,m,new Date(a.LastModifiedTime),new Date(a.LastModifiedTime));if(v.validationMessages.length>0)throw v.validationMessages;const h=v.serialize;return h.timeZone=a.TimeZone||i,h})))))}catch(e){return e}}))}};
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.HoopOperationsControllerAConnect = void 0;
16
+ const DatabaseConfig_1 = require("../../config/DatabaseConfig");
17
+ const uuid_1 = require("uuid");
18
+ const moment_timezone_1 = __importDefault(require("moment-timezone"));
19
+ // import { operationsModel } from "../../models/Hoop.model";
20
+ const HoopOperationsImplModel_1 = require("../../models/impl/hoop/HoopOperationsImplModel");
21
+ class HoopOperationsControllerAConnect {
22
+ // Constructor to initialize HoopServiceFactory
23
+ constructor(dbFactory) {
24
+ this._dbFactory = dbFactory;
25
+ }
26
+ // Method to get all data with query parameters
27
+ getAll(query) {
28
+ return __awaiter(this, void 0, void 0, function* () {
29
+ try {
30
+ // Open database connection
31
+ const databaseConnection = yield this._dbFactory.asyncOpen(DatabaseConfig_1.databaseConfig.databaseName, DatabaseConfig_1.databaseConfig.version);
32
+ const database = databaseConnection.result;
33
+ // Start database transaction
34
+ const dbTransaction = database.transaction(DatabaseConfig_1.databaseConfig.tables.hoopOverrideBranches, "readwrite");
35
+ // Access object store
36
+ let table = dbTransaction.objectStore(DatabaseConfig_1.databaseConfig.tables.hoopOverrideBranches);
37
+ // Retrieve all data from the object store
38
+ const request = yield table.customGetHoop(query);
39
+ const config = request.Config;
40
+ const timeZone = request.TimeZone || "EST";
41
+ // const hoursOfOperationId = request.HoursOfOperationId
42
+ const result = yield this.mapOperations(config, timeZone, request);
43
+ return result;
44
+ }
45
+ catch (error) {
46
+ return error;
47
+ }
48
+ });
49
+ }
50
+ dateTimeConversion(timeString, timeZone) {
51
+ return __awaiter(this, void 0, void 0, function* () {
52
+ const currentDate = (0, moment_timezone_1.default)().tz(timeZone).format('YYYY-MM-DD'); // Current date in the desired timezone
53
+ const date = new Date(Date.parse(`${currentDate}T${timeString}:00Z`));
54
+ return date;
55
+ });
56
+ }
57
+ mapOperations(config, timezone, request) {
58
+ return __awaiter(this, void 0, void 0, function* () {
59
+ try {
60
+ return Promise.all(config.map((item) => __awaiter(this, void 0, void 0, function* () {
61
+ const { Day, StartTime, EndTime } = item;
62
+ const formattedStartTimeMinutes = String(StartTime.Minutes).padStart(2, '0');
63
+ const formattedEndTimeMinutes = String(EndTime.Minutes).padStart(2, '0');
64
+ const formattedStartTimeHours = String(StartTime.Hours).padStart(2, '0');
65
+ const formattedEndTimeHours = String(EndTime.Hours).padStart(2, '0');
66
+ const startTime = `${formattedStartTimeHours}:${formattedStartTimeMinutes}`;
67
+ const endTime = `${formattedEndTimeHours}:${formattedEndTimeMinutes}`;
68
+ const startDateTime = yield this.dateTimeConversion(startTime, timezone);
69
+ const endDateTime = yield this.dateTimeConversion(endTime, timezone);
70
+ const uuid = (0, uuid_1.v4)();
71
+ const operation = new HoopOperationsImplModel_1.HoopOperationsImplModel(uuid, request.HoursOfOperationId, Day, startDateTime, endDateTime, new Date(request.LastModifiedTime), new Date(request.LastModifiedTime));
72
+ if (operation.validationMessages.length > 0) {
73
+ throw operation.validationMessages;
74
+ }
75
+ const operationData = operation.serialize;
76
+ operationData['timeZone'] = request.TimeZone || timezone;
77
+ return operationData;
78
+ })));
79
+ }
80
+ catch (error) {
81
+ return error;
82
+ }
83
+ });
84
+ }
85
+ }
86
+ exports.HoopOperationsControllerAConnect = HoopOperationsControllerAConnect;
@@ -0,0 +1,7 @@
1
+ import { HoopServiceFactory } from "../../aws/impl/HoopServices/HoopServiceFactory";
2
+ import { SearchParameterType } from "../../common/type/SearchParameterType";
3
+ export declare class HoopOverrideBranchesControllerAConnect {
4
+ private _dbFactory;
5
+ constructor(dbFactory: HoopServiceFactory);
6
+ getAll(query: SearchParameterType): Promise<any>;
7
+ }
@@ -1 +1,40 @@
1
- Object.defineProperty(exports,"__esModule",{value:!0}),exports.HoopOverrideBranchesControllerAConnect=void 0;const e=require("tslib"),r=require("../../config/DatabaseConfig");exports.HoopOverrideBranchesControllerAConnect=class{constructor(e){this._dbFactory=e}getAll(t){return e.__awaiter(this,void 0,void 0,(function*(){try{const e=(yield this._dbFactory.asyncOpen(r.databaseConfig.databaseName,r.databaseConfig.version)).result;let o=e.transaction(r.databaseConfig.tables.hoopOverrideBranches,"readwrite").objectStore(r.databaseConfig.tables.hoopOverrideBranches);return{result:yield o.customGetOverrides(t)}}catch(e){return e}}))}};
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.HoopOverrideBranchesControllerAConnect = void 0;
13
+ const DatabaseConfig_1 = require("../../config/DatabaseConfig");
14
+ class HoopOverrideBranchesControllerAConnect {
15
+ // Constructor to initialize HoopServiceFactory
16
+ constructor(dbFactory) {
17
+ this._dbFactory = dbFactory;
18
+ }
19
+ // Method to get all data with query parameters
20
+ getAll(query) {
21
+ return __awaiter(this, void 0, void 0, function* () {
22
+ try {
23
+ // Open database connection
24
+ const databaseConnection = yield this._dbFactory.asyncOpen(DatabaseConfig_1.databaseConfig.databaseName, DatabaseConfig_1.databaseConfig.version);
25
+ const database = databaseConnection.result;
26
+ // Start database transaction
27
+ const dbTransaction = database.transaction(DatabaseConfig_1.databaseConfig.tables.hoopOverrideBranches, "readwrite");
28
+ // Access object store
29
+ let table = dbTransaction.objectStore(DatabaseConfig_1.databaseConfig.tables.hoopOverrideBranches);
30
+ // Retrieve all data from the object store
31
+ let result = yield table.customGetOverrides(query);
32
+ return { result }; // Return result with meta data
33
+ }
34
+ catch (error) {
35
+ return error;
36
+ }
37
+ });
38
+ }
39
+ }
40
+ exports.HoopOverrideBranchesControllerAConnect = HoopOverrideBranchesControllerAConnect;
@@ -0,0 +1,8 @@
1
+ import { HoopServiceFactory } from "../../aws/impl/HoopServices/HoopServiceFactory";
2
+ export declare class HoopProfilesListControllerAConnect {
3
+ private _dbFactory;
4
+ constructor(dbFactory: HoopServiceFactory);
5
+ get(query: {
6
+ instanceId: string;
7
+ }): Promise<any>;
8
+ }
@@ -1 +1,61 @@
1
- Object.defineProperty(exports,"__esModule",{value:!0}),exports.HoopProfilesListControllerAConnect=void 0;const e=require("tslib"),t=require("../../config/DatabaseConfig"),o=require("../../models/impl/hoop/HoopProfilesListImplModel");exports.HoopProfilesListControllerAConnect=class{constructor(e){this._dbFactory=e}get(i){return e.__awaiter(this,void 0,void 0,(function*(){try{if("string"!=typeof i.instanceId)throw new Error("instanceId must be a string");const e=(yield this._dbFactory.asyncOpen(t.databaseConfig.databaseName,t.databaseConfig.version)).result;let s=e.transaction(t.databaseConfig.tables.hoopProfileList,"readwrite").objectStore(t.databaseConfig.tables.hoopProfileList),a=yield s.asyncGet(i.instanceId);return a.map((e=>{const t=new o.HoopProfilesListImplModel(e.Id,e.Name,"EST",new Date(e.LastModifiedTime),new Date(e.LastModifiedTime));if(t.validationMessages.length>0)throw t.validationMessages;return t.serialize}))}catch(e){return e}}))}};
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.HoopProfilesListControllerAConnect = void 0;
13
+ const DatabaseConfig_1 = require("../../config/DatabaseConfig");
14
+ const HoopProfilesListImplModel_1 = require("../../models/impl/hoop/HoopProfilesListImplModel");
15
+ class HoopProfilesListControllerAConnect {
16
+ // Constructor to initialize HoopServiceFactory
17
+ constructor(dbFactory) {
18
+ this._dbFactory = dbFactory;
19
+ }
20
+ // Method to get data by profileId
21
+ get(query) {
22
+ return __awaiter(this, void 0, void 0, function* () {
23
+ try {
24
+ if (typeof query.instanceId !== "string") {
25
+ throw new Error("instanceId must be a string");
26
+ }
27
+ // Open database connection
28
+ const databaseConnection = yield this._dbFactory.asyncOpen(DatabaseConfig_1.databaseConfig.databaseName, DatabaseConfig_1.databaseConfig.version);
29
+ const database = databaseConnection.result;
30
+ // Start database transaction
31
+ const dbTransaction = database.transaction(DatabaseConfig_1.databaseConfig.tables.hoopProfileList, "readwrite");
32
+ // Access object store
33
+ let table = dbTransaction.objectStore(DatabaseConfig_1.databaseConfig.tables.hoopProfileList);
34
+ // Get data by profileId from the object store
35
+ let result = yield table.asyncGet(query.instanceId);
36
+ // Use a Promise to handle the `IDBRequest`
37
+ // const k = Array(result)
38
+ const profiles = result.map((item) => {
39
+ // Construct the profile model instance
40
+ const profile = new HoopProfilesListImplModel_1.HoopProfilesListImplModel(item.Id, // profileId
41
+ item.Name, // profileName
42
+ 'EST', // timeZone (adjust if dynamic)
43
+ new Date(item.LastModifiedTime), // createdAt
44
+ new Date(item.LastModifiedTime) // updatedAt
45
+ );
46
+ if (profile.validationMessages.length > 0) {
47
+ throw profile.validationMessages;
48
+ }
49
+ const result = profile.serialize;
50
+ // Return the output format
51
+ return result;
52
+ });
53
+ return profiles;
54
+ }
55
+ catch (error) {
56
+ return error;
57
+ }
58
+ });
59
+ }
60
+ }
61
+ exports.HoopProfilesListControllerAConnect = HoopProfilesListControllerAConnect;